Découverte de l'outil powershell ISE pour se connecter à Office 365

Voici le Script utilisé:

# Section1: this will record the password encrypted

# the line bleow is to the executed each time you need the record the password
#read-host -assecurestring | convertfrom-securestring | out-file C:\securestring.txt

# Specify your administrative user credentials on the line below

$user = "admin@XXXX.OnMicrosoft.com"
$password = cat C:\securestring.txt | convertto-securestring
$cred = new-object -typename System.Management.Automation.PSCredentia­l -argumentlist $user, $password

#Section 2: This will pop-up a dialog and request your password please make sure that section 1 is in comment

#$cred = Get-Credential

#——-- Import the Local Microsoft Online PowerShell Module. AZURE Directory rights Cmdlets and Connect to O365 Online / AD RMS———--

Import-Module MSOnline
Import-Module AADRM
Connect-AadrmService -Credential $cred
Connect-MsolService -Credential $cred

#———— Establish an Remote PowerShell Session to Exchange Online ———————
$msoExchangeURL = "https://ps.outlook.com/powershell/"

$session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri $msoExchangeURL -Credential $cred -Authentication Basic -AllowRedirection

Import-PSSession $session


# You can now use the:

# 1] MSOL Powershell cmdlets such as Get-MsolUser

# 2] Exchange Online cmdlets such as Get-Mailbox

# ** It is good to remove your Remote Exchange Online session when you are all done.

# Remove-PsSession $session

Vidéo: http://youtu.be/dJzsL6OXCY8