SHARE
TWEET

Untitled

a guest Feb 10th, 2014 156 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $username  = "username@tenancy.onmicrosoft.com"
  2. $password = "PASSWORDHERE"
  3. $secstr = New-Object -TypeName System.Security.SecureString
  4. $password.ToCharArray() | ForEach-Object {$secstr.AppendChar($_)}
  5. $cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $secstr
  6. try
  7. {
  8.         $msc = Connect-MsolService -Credential $cred -ErrorAction Stop
  9.         Write-Output "Connected. <br />"
  10. }
  11. catch
  12. {
  13.         Write-Output "Could not connect. <br />"
  14. }
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