Category Archives: PowerShell

Cleaning up AdminSDHolder orphans

I quite regularly come across Active Directory environments where users have been mistakenly added to groups protected by the AdminSDHolder and subsequently removed when the mistake has been realised.  This process creates “orphans” because the AdminSDHolder process doesn’t tidy up after itself.  Here’s what happens: User added to group protected by the AdminSDHolder (e.g. Account… Read More: Cleaning up AdminSDHolder orphans »

Powershell version of oidgen.vbs

For those of you planning to extend your AD DS or AD LDS schema, you will need to find a unique object identifier (OID) for each new schema class and attribute.  The process by which you can acquire the OIDs is described by Microsoft here: http://msdn.microsoft.com/en-us/library/windows/desktop/ms677619(v=vs.85).aspx In summary, Microsoft suggests two methods for obtaining an… Read More: Powershell version of oidgen.vbs »

Powershell method to find when your Domain Controllers were promoted

I recently came across an old blog post by fellow MVP Joe Richards.  In the post Joe points out that whenChanged is not a replicated attribute, which makes it a poor candidate for accurately determining when an object was last modified.  He does however indicate that the whenChanged attribute provides a handy way to report… Read More: Powershell method to find when your Domain Controllers were promoted »

PowerShell script to submit certificate requests in bulk using certreq.exe

Here’s something I put together to handle bulk certificate requests for submission to an Enterprise CA using certreq.exe.  Enjoy! ######################################################### # # Name: Request-Certificates.ps1 # Author: Tony Murray # Version: 1.0 # Date: 4/12/2012 # Comment: PowerShell script to submit certificate # requests in bulk using certreq.exe # ######################################################### # Specify the location of the… Read More: PowerShell script to submit certificate requests in bulk using certreq.exe »

Powershell search for Active Directory objects excluding an OU

If you’re familiar with LDAP searches you will probably at some point have been frustrated at the inability to exclude objects in a specific Organisational Unit, i.e “Give me all User objects in the domain, except those in the Sales OU”.   To workaround the problem you typically need to do some scripting. There are several… Read More: Powershell search for Active Directory objects excluding an OU »

The directory service can perform the requested operation only on a leaf object

If you come across this error when using Powershell to delete an object, it is most likely because the object has child objects associated with it.  The most obvious example is computer objects that have print queue, service connection point, RRAS or various other types of child objects.  The workaround is to determine the child… Read More: The directory service can perform the requested operation only on… »

Powershell: Counting messages processed by a Receive Connector

Recently I was doing some testing with a new Exchange 2010 Receive Connector and wanted a method to check how many messages it was processing.  I came up with the following Powershell snippet that seems to work well. $i = 0 do { $now = get-date (Get-MessageTrackingLog -ResultSize unlimited -Start “11/10/2012 3:00PM” -End $now -Server… Read More: Powershell: Counting messages processed by a Receive Connector »