daily pastebin goal
35%
SHARE
TWEET

Untitled

a guest Mar 26th, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. cls
  2. $users = @()
  3. #$users = import-csv "<path>" | select -expandproperty <property>
  4.  
  5. $a = @()
  6.  
  7. foreach($user in $users)
  8. {
  9.     Get-MsolUser -userprincipalname $user | %{
  10.         $upn = $_.userprincipalname
  11.         $_.licenses | %{
  12.             $licence = $_.accountsku.skupartnumber
  13.             $_.servicestatus | %{
  14.                 $a += new-object psobject -Property @{
  15.                     UserPrincipalName = $upn
  16.                     Status = $_.ProvisioningStatus
  17.                     Licence = $licence
  18.                     Service = $_.ServicePlan.servicename
  19.                 }
  20.             }
  21.         }
  22.     }
  23. }
  24.  
  25. $a | select userprincipalname, licence, service, status
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top