Connect
PS> $LiveCred = Get-Credential
PS> $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
PS> Import-PSSession $Session
Disconnect
PS> Remove-PSSession
PS> Remove-PSSession $Session
PS> Get-QADUser -SearchRoot “simonalsa.com/Users/PowerUsers” -SearchScope Subtree | select Name, Email
The value of SearchScope can be:
‘Base’ Limits the search to the base (SearchRoot) object. The result contains a maximum of one object.
‘OneLevel’ Searches the immediate child objects of the base (SearchRoot) object, excluding the base object.
‘Subtree’ Searches the whole sub-tree, including the base (SearchRoot) object and all its child objects.
Check the Domain OU list with
PS> Get-QADObject -Type OrganizationalUnit
Make a new Security Group
PS C:\> New-DistributionGroup -Name WL-Test -Type Security
Assign User to the Security Group
PS C:\> Add-DistributionGroupMember -Identity WL-Test -Member id@simonalsa.com
Remove User from the Security Group
PS C:\> Remove-DistributionGroupMember -Identity WL-Test -Member id@simonalsa.com
Remove Security Group from AD
PS C:\> Remove-DistributionGroup -Identity WL-Test