Connect and disconnect Windows PowerShell to the Service (Live@edu Office 365)

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

Powershell Get-QADUser extracts Name and Email from an active directory OU organization unit

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

How To manage Office 365 / Live edu Security Groups and Users usign Powershell

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

WordPress Themes