Difference between revisions of "Powershell"
From MyWiki
Line 12: | Line 12: | ||
To connect to Office365<br> | To connect to Office365<br> | ||
− | $O365Cred=Get-Credential | + | $O365Cred=Get-Credential <br> |
− | $O365Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $O365Cred -Authentication Basic -AllowRedirection | + | $O365Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $O365Cred -Authentication Basic -AllowRedirection |
Import-PSSession $O365Session | Import-PSSession $O365Session | ||
Connect-MsolService -Credential $O365Cred | Connect-MsolService -Credential $O365Cred |
Revision as of 09:13, 27 May 2014
Add-PSSnapin Quest.ActiveRoles.ADManagement
To disconnect at the end of session : Disconnect-QADService
$pw = read-host "Enter password" -AsSecureString
connect-QADService -service 'cgs-vsvr-dc02.campus.goldsmiths.ac.uk'-ConnectionAccount 'CAMPUS\da_gthom001'-ConnectionPassword $pw
The following are examples of configuring the ProxyAddresses atribute :
$roy = get-qaduser gthom009 $roy | set-qaduser -objectAttributes @{ProxyAddresses=@{Update=@("SMTP:roy@globomantics.com")}} $roy | set-qaduser -objectAttributes @{ProxyAddresses=@{Delete=@("SMTP:roy@globomantics.com")} $roy | set-qaduser -objectAttributes @{ProxyAddresses=@{Append=@("smtp:george2@gold.ac.uk")}}
The following sets the users password.
Set-QADUser <user> -UserPassword “Password”
To connect to Office365
$O365Cred=Get-Credential
$O365Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $O365Cred -Authentication Basic -AllowRedirection
Import-PSSession $O365Session Connect-MsolService -Credential $O365Cred