Difference between revisions of "Powershell"

From MyWiki
Jump to: navigation, search
(Replaced content with " Quest Active Directory and O365 ")
Line 1: Line 1:
Add-PSSnapin Quest.ActiveRoles.ADManagement<br>
+
[[ Quest Active Directory and O365 ]]
To disconnect at the end of session : Disconnect-QADService<br>
+
$pw = read-host "Enter password" -AsSecureString<br>
+
connect-QADService -service 'cgs-vsvr-dc02.campus.goldsmiths.ac.uk'-ConnectionAccount 'CAMPUS\da_gthom001'-ConnectionPassword $pw<br>
+
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. <br>
+
Set-QADUser <user> -UserPassword “Password”<br>
+
 
+
'''To connect to Office365'''<br>
+
$O365Cred = Get-Credential<br>
+
$O365Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $O365Cred -Authentication Basic -AllowRedirection<br>
+
Import-PSSession $O365Session<br>
+
Connect-MsolService -Credential $O365Cred<br>
+
'''Unlock a specific user account'''<br>
+
Unlock-QADUser DSotnikov<br>
+
'''Get all disabled accounts'''<br>
+
Get-QADUser -Disabled<br>
+
'''Get all locked accounts in the accounting department'''<br>
+
Get-QADUser -Locked -Department Accounting<br>
+
'''Examples of get-QADGroup'''<br>
+
Display the description of the 'SuperAdmins' group in domain ss64Dom
+
PS C:>(get-QADGroup 'ss64Dom\SuperAdmins').DirectoryEntry.description
+
Using an LDAP search filter, display all the groups whose description starts with an 's'
+
PS C:> get-QADGroup -SearchRoot 'ss64.com/sampleOU' -LdapFilter '(description=s*)'
+
List all distribution groups in a specific OU container:
+
PS C:> get-QADGroup -SearchRoot 'ss64.com/sampleOU' -GroupType 'Distribution' ( Security ??? )
+
Retrieve groups from a particular container that have the user usr1021 as a direct or indirect member:
+
PS C:> get-QADGroup -SearchRoot '<DN of container>' -ContainsIndirectMember 'ss64Dom\usr1021'
+

Revision as of 10:19, 30 May 2014

Quest Active Directory and O365