PowerShell: Add All Members of an OU to a Security Group
KB ID 0001589 Problem I’ve written in the past about ‘Bulk Adding Users from CSV files, into Groups’. But what if you want to add ALL users in a particular OU into a security group? Solution The syntax is; Get-ADUser -SearchBase ‘OU=Source-OU,OU=PNL,DC=pnl,DC=com’ -Filter * | ForEach-Object {Add-ADGroupMember -Identity ‘SG-Test-Group’ -Members $_ } Here I’ve got 20 users that need adding to a group, in this...
Windows Server ‘Can’t Delete an OU’
KB ID 0000105 Problem Error “You do not have sufficient privileges to delete {OU Name}, or this object is protected from accidental deletion” Cause In Windows domains you have the option to prevent an OU from accidental deletion so that even a Domain/Enterprise admin cannot delete it. That’s fine until you need to delete one. Solution To delete a protected OU 1. On the the Server (with administrative privileges). 2. Start...
Exchange – Creating Dynamic Distribution Groups Based on Organizational Units
KB ID 0000820 Problem A Dynamic Distribution list, (as the name implies), maintains its membership for you. Unlike a normal static distribution list that you need to add/remove mailboxes manually. Solution Use PowerShell/Exchange Management Shell 1. I’m assuming you already have an OU populated with mail enabled users, in this example called Engineering. 2. Launch the Exchange Management Shell, Execute the following command, (change...
Windows – Reset all User Passwords in an OU
KB ID 0000497 Problem I did some bulk user imports for a client this week, and then needed to set all the passwords on these accounts. Seeing as it was a school, and each year group was in its own OU in Active Directory, I needed a way to “Bulk Reset” the passwords. Note: Passwords can NOT be set with a CSV / CSVDE import. Solution 1. We are going to perform this procedure while logged onto a domain controller with...
Bulk Importing Users with CSVDE
KB ID 0000498 Problem This is not a task I’ve had to do for ages, so when I had to do it this week, I thought I’d just do a quick Google search as a refresher. What I can remember was a simple task took me far too long to work out. So heres a quick solution for everybody else. Solution Before I begin, the spreadsheet below, was the hard work of John Haddock, I have only made some minor tweaks and adjustments. 1. You will...