# Autentiseringsinfo
$username = " admin@yourdomain.no This e-mail address is being protected from spambots. You need JavaScript enabled to view it "
$password = ConvertTo-SecureString -AsPlainText "yoursecretpassword" -Force
$liveCred = New-Object System.Management.Automation.PSCredential $Username, $Password
# Connect
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
# Import the session to the shell
Import-PSSession $Session
# Do something...
Get-Mailbox
# The PS way of pausing the script...
Write-Host "Press any key to continue ..."
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
Import-PSSession $Session
# Do something...
Get-Mailbox
# The PS way of pausing the script...
Write-Host "Press any key to continue ..."
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
#End the session
Get-PSSession | Remove-PSSession
No hay comentarios:
Publicar un comentario