Office 365 powershell scripts:Write User UPNs to a file

Follow me The following Office 365 powershell script helps you to dump UserPrincipalName of all users to a file First step of procedure is to connect to Azure PowerShell, refer here for procedure Once we have successfully connected to Office 365 Azure PowerShell, use the following script #Step1 : Get list of all the users in a variable named $UserList $UserList = Get-MsolUser -all #Step2 : Create a csv file to dump all the information $filepath= “C:\UPN.csv” $outFile=$filepath -f (Get-Date) #Step 3: Query each user for in $UserList for UPN and store it in file foreach ($u in $userList) { $upn = $u.UserPrincipalName Out-File -FilePath $outfile -Append -NoClobber -InputObject $upn } Hope this scripts helps you, for any more help regarding this or to report any other issue, feel free to start a new thread on our forum Follow me...

Office 365 helper scripts to find users with specific license pack

Follow me Following Office 365 helper script to find users with specific license pack, helps you list users with a specific license pack. You need to replace the tenant:licensepack in the script with the actual SKU in your tenant. Before Executing the script, please connect to Microsoft Online PowerShell, instructions provided here #Create a file on user’s desktop with current date and time $filepath=”c:\licenses_{0:yyyyMMdd-HHmm}.csv” $outFile=$filepath -f (Get-Date) #Write files to disk Out-File -FilePath $outFile -InputObject $header #Following Cmdlet help you find the names of Licence pack already subscribed by your tenant Get-MsolAccountSku #Set a variable with the license pack you want to find $accountSKU = “tenant:licensepack” #Get users $userList = Get-MsolUser -all foreach ($i in $userList){ if ($i.Licenses.AccountSkuID -like $accountSKU ) { Out-File -FilePath $outFileLicensed -Append -NoClobber -InputObject $lineOut Write-Host $i.UserPrincipalName ” is licensed with ” $accountSKU } } For more scripts to make your work easier , keep following our blog. If you want to report a new issue or looking for solutions, please start a new thread on our forum Follow me...