Active Directory Powershell

Using this page to keep track of all the useful powershell “mini-scripts” I’ve used: Copy users from one security group to another security group Add-ADGroupMember -Identity destination-group-name -Members (Get-ADGroupMember -Identity source-group-name -Recursive) Add enabled users from an OU to a security group Get-ADUser -SearchBase 'OU=Your-OU,DC=corp,DC=company,DC=com' -Filter {Enabled -eq $true} | ForEach-Object {Add-ADGroupMember -Identity 'your-group-name' -Members $_ } Add users from a CSV file to a security group (username column is called “name”) ...

August 4, 2017 · 1 min · Daniel Kuchenski

Office 365 - Powershell

Connecting to Office 365 via Powershell for the first time? Here are the steps to get started: Install the Microsoft Online Services Sign-In Assistant for IT Professionals RTW Install the Azure Active Directory Module for Windows Powershell (64-bit version) Open Powershell and run this command the first time you connect on your computer: Set-ExecutionPolicy RemoteSigned Next, run these three commands (you’ll do this everytime you want to connect): $UserCredential = Get-Credential $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection Import-PSSession $Session You should now be connected. When finished, run: Remove-PSSession $Session Update: Here is an awesome project on github that is a Office 365 Powershell GUI: https://github.com/bwya77/O365-Administration-Center ...

April 12, 2016 · 1 min · Daniel Kuchenski

Office 365 Full Access Mailbox Permissions

If you administer an Office365/Exchange Online organization, you might have noticed you cannot modify Full Access/Send As permissions from the web console. You need to change these permissions through PowerShell; here are the required steps: The first time you do this, make sure the following steps have been completed: Right click and run PowerShell as Administrator (Start -> Programs -> Accessories -> Windows PowerShell -> Windows PowerShell) on your local PC ...

April 1, 2013 · 2 min · Daniel Kuchenski