Onedrivemapper v2.23 released!

Version 2.23 of OneDriveMapper has been released.

  • an additional parameter was added by request which will stop the script if no ADFS server was found
  • two minor bugfixes
  • improved detection of driveletter presence, OM will actually remap the drive if it is mapped to another location than your O4B instead of detecting it as ‘active’.

Get the new version here

Verifying the ServiceStatus of a specific sublicense in Office 365

If you assign licenses in Office 365, you’re essentially assigning license bundles. Each license usually consists of several sublicenses, like this:

In a case I ran into for a customer, the ‘Exchange Online’ component was sometimes not enabled for certain users. It took us  a while to notice that the serviceplan of the main license had been unchecked. In Powershell, it would normally look like this:

O365_servicestatusPS_screenshot

Of course now we’d like to know which of our thousands of users did not have a EXCHANGE _S_STANDARD ServicePlan with a ProvisioningStatus of “Success”  after the migration to Office 365.

So, I wrote the following Powershell snippet Continue reading Verifying the ServiceStatus of a specific sublicense in Office 365

Intune supports MSI deployment to auto-enrolled devices!

As of yesterday, Intune now lets us deploy MSI files to (auto) enrolled devices!*

This is another nice step forward into making this product more mature, hopefully in the future we’ll be able to use Intune auto enrollment to manage anything, anywhere, anytime. Until now, managing roaming laptops with Intune was basically useless if you wanted to deploy any type of software outside of the Windows Store.

Some gotcha’s with this improvement:

  • you need a full deployment of SCCM (2012 R2 SP1 CU1)
  • this only works with Windows 10 as target OS
  • only a single MSI file is supported

 

Viewing permissions on a Sharepoint Online site with Powershell

If you want to use the Sharepoint Online Management Shell module for Powershell to view user permissions on your Sharepoint Online site, start a Powershell window as admin. If you’re not running as admin you’ll have to add the module path to your environment variable like this:

$env:PSModulePath += ";C:\Program Files\SharePoint Online Management Shell\"

Then load the SPO module:

Import-Module Microsoft.Online.SharePoint.PowerShell

And connect to your sharepoint tenant: Continue reading Viewing permissions on a Sharepoint Online site with Powershell

Automating remote mailbox creation in an Exchange 2010/2013 and Office 365 hybrid setup

In organisations that have moved to Office 365, or are moving to Office 365 while using a hybrid setup with an on-premises Exchange 2010, 2013 or 2016 server and/or Lync/Skype, your helpdesk tools and scripts need to be adjusted.

While previously, you would provision your account in Active Directory, the mailbox on the onpremises Exchange Server and voip functionality on the Lync/Skype server, after your migration, you no longer need to provision mailboxes or lync accounts on premises. After a user has been migrated to Office 365, his ‘user type’ in the Exchange on premises server is ‘Remote Mailbox’. But for new users, this is not set automatically.

If you’re using scripting or tools like ADManager, you can use some simple Powershell commands to set the correct properties on a newly created user.

Configure and run below script Continue reading Automating remote mailbox creation in an Exchange 2010/2013 and Office 365 hybrid setup

Installing Adobe Reader DC including the latest patch, with Powershell

Just a code example today, where Powershell downloads the Adobe MSI, runs it, then downloads the latest patch and applies it. Finally, it will disable the auto updater of Adobe Reader DC.

Code:


$tempFolder=$Env:TEMP

function runProcess ($cmd, $params) {
$p = new-object System.Diagnostics.Process
$p.StartInfo = new-object System.Diagnostics.ProcessStartInfo
$exitcode = $false
$p.StartInfo.FileName = $cmd
$p.StartInfo.Arguments = $params
$p.StartInfo.UseShellExecute = $False
$p.StartInfo.RedirectStandardError = $True
$p.StartInfo.RedirectStandardOutput = $True
$p.StartInfo.WindowStyle = 1;
$null = $p.Start()
$p.WaitForExit()
$output = $p.StandardOutput.ReadToEnd()
$exitcode = $p.ExitCode
$p.Dispose()
$exitcode
$output
}

#download installer
invoke-webrequest "ftp://ftp.adobe.com/pub/adobe/reader/win/AcrobatDC/1500720033/AcroRdrDC1500720033_nl_NL.msi" -OutFile "$tempFolder\AcroRdrDC1500720033_nl_NL.msi" -ErrorAction Stop

#run installer
$res = runProcess msiexec "/i $tempFolder\AcroRdrDC1500720033_nl_NL.msi /qb"

#check if return code is 0
if(0 -ne $res[0]){
return "Failed to install Adobe Reader: $($res[0]) $($res[1])"
}

#download the patch
invoke-webrequest "ftp://ftp.adobe.com/pub/adobe/reader/win/AcrobatDC/1500920079/AcroRdrDCUpd1500920079.msp" -OutFile "$tempFolder\AcroRdrDCUpd1500920079.msp" -ErrorAction Stop

#install it
$res = runProcess msiexec "/p $tempFolder\AcroRdrDCUpd1500920077.msp /qb"

#check if return code is 0
if(0 -ne $res[0]){
return "Failed to install Adobe Reader DC Patch: $($res[0]) $($res[1])"
}else{
#Attempt to silently disable the auto updater if set in this script
new-itemproperty "HKLM:\Software\Policies\Adobe\Acrobat Reader\DC\FeatureLockDown" -name bUpdater -value 0 -ErrorAction SilentlyContinue
}

RunProcess from Powershell

Sometimes I want to run older programs / tools like MSIEXEC or such to run from within my Powershell scripts or modules. I wanted to make it easy for myself to format the exact command line, and capturing non-standard output that is written to the screen .

I wrote this simple function to start any  .exe or other w32 process, wait for it to complete, and capturing both the exit code and the full output in an array while the window remains hidden.

Example call to this function:


$res = runProcess msiexec "/i AcroRdrDC1500720033_nl_NL.msi /quiet"
write-host "Result code of msiexec: $($res[0])"
write-host "All output of msiexec: $($res[1])"

And here is the function:


function runProcess ($cmd, $params, $windowStyle=1) {
$p = new-object System.Diagnostics.Process
$p.StartInfo = new-object System.Diagnostics.ProcessStartInfo
$exitcode = $false
$p.StartInfo.FileName = $cmd
$p.StartInfo.Arguments = $params
$p.StartInfo.UseShellExecute = $False
$p.StartInfo.RedirectStandardError = $True
$p.StartInfo.RedirectStandardOutput = $True
$p.StartInfo.WindowStyle = $windowStyle; #1 = hidden, 2 =maximized, 3=minimized, 4=normal
$null = $p.Start()
$output = $p.StandardOutput.ReadToEnd()
$exitcode = $p.ExitCode
$p.Dispose()
$exitcode
$output
}