Advertisement
Guest User

Untitled

a guest
Apr 12th, 2016
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. $User = "user@domain"
  2. $Pass = "mypassword"
  3. Get-Date -Format g
  4. Write-Host "Obteiendo credenciales"
  5. $Cred = New-Object System.Management.Automation.PsCredential($User,(ConvertTo-SecureString $Pass -AsPlainText -Force))
  6. import-module MSOnline
  7. Write-Host "Conectando a la nube..."
  8. Connect-MsolService -Credential $Cred
  9. Write-Host "Obteniendo session"
  10.  
  11. Get-Date -Format o | foreach {$_ -replace ":", "."}
  12.  
  13. $timestamp = Get-Date -Format o | foreach {$_ -replace ":", "."}
  14. Get-MsolUser -All | ? { $_.Licenses.AccountSkuid -ne $null} | Select-Object -Property DisplayName,UserPrincipalName, @{Name="AccountSkuID";e={$_.licenses.AccountSkuid}}| Export-Csv -Path c:\path\Office365-$timestamp.csv -NoTypeInformation
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement