PowerShell – Remote Session to Domain Controller

Sometimes you need to run Active Directory scriptlets in PowerShell, but logging into your DC takes too long, there are too many RDCs already, or you’re just lazy.  Regardless, the following script will allow you to initiate a remote PowerShell session to your DC and import the ActiveDirectory module, so you can perform AD administration … [Read more…]

Use PowerShell to Add Permissions to AD Container Objects for Machine Accounts Without using the AD Module

I am taking on SCCM 2012 at work, so currently, I’m working on a PowerShell script that installs all the prerequisites before installing the actual product. The list of prereqs is about a mile long, but so far, I’m batting 1.000. One of the prereqs is to add Full Control permissions on the System Management … [Read more…]

Removing Lingering Object from AD: The Layadmin’s Version

On Friday afternoon, a schema update was performed in our lab. On Monday, DC replication was halting on a majority of the DCs. I was able to detect this instantly because I monitor the health of the DCs using PowerShell.  DCDIAG on the affected servers would report the following message: The replication generated an error (8606): … [Read more…]

PowerShell DC Health Status – Ping, Hard Drive Space, Replication

There is an updated version of this DC Health Check PowerShell script that is much simpler and does not require the Quest add-in. We kept getting reports that DC issues (replication to begin with) were preventing a solution from being implemented. I was tasked with determining the root cause of these issues, and this PowerShell script was born … [Read more…]

PowerShell Script to Copy OUs and Groups from AD Including Group Membership

There is an updated version of this AD Administration PowerShell script that is much simpler. I couldn’t find a clean method to export group membership from AD. LDIF notoriously does not allow importing the MemberOf attribute, so I began looking for a way through PowerShell. I found a method using Quest’s AD Tools SnapIn. The code below … [Read more…]