Category Archives: Scripting

Powershell snippet to enable change notification on all site links

Qasim Zaidi has an old but really good blog entry on enabling change notification for Active Directory site links.  For a long time now I’ve encouraged my customers (those with decent bandwidth between sites) to enable change notifications on site links rather than wait the 15 minutes (minimum) for replication between sites. Qasim’s blog references a Powershell… Read More »

Attribute-Based Active Directory Group Membership

Unfortunately Active Directory doesn’t yet provide dynamic security groups in the way that, for example, Exchange provides dynamic distribution groups.  Sometimes it is useful to maintain a group’s membership based on a specific attribute, or set of attributes.  Here’s a quick Powershell example that shows how to maintain the membership based on the presence of… Read More »

Dump a list of all schemaIDGUIDs with Powershell

There are well known methods for setting Access Control Entries (ACEs) on Active Directory objects using Powershell. One example is the following:   http://blogs.msdn.com/b/adpowershell/archive/2009/10/13/add-object-specific-aces-using-active-directory-powershell.aspx   The method relies on you knowing the schemaIDGUID of the schema object classes you are working with (e.g. User, Computer, Group). Unless you know your way around AD it’s not… Read More »

How old is my Active Directory Forest?

It’s sometimes interesting to know how old your AD forest is and when the various domains were created.  I recently came across a really useful TechNet Blog with a Powershell snippet to do just this.  My version shown below just has some slightly different formatting. # How old is the forest? Get-ADObject -SearchBase (Get-ADForest).PartitionsContainer `… Read More »

Find Windows XP machines in your AD Domain

If you haven’t heard that extended support for Windows XP ended earlier this year you’ve clearly been in a coma.  There are a number of well-publicised methods for finding out whether you still have XP machines in your environment.  Here is my own humble (and spectacularly over engineered) Powershell offering.   ######################################################### # # Name:… Read More »

Powershell function to count files using Robocopy

Reading the post title you maybe wondering whether I’ve taken leave of my senses.  Why call Robocopy from Powershell to count files when Powershell has a perfectly good method of doing this natively? For example, (Get-ChildItem e:\powershell -Recurse -force | ?{! $_.PSIsContainer} | Measure-Object).count Well, the problem comes in when an individual file length exceeds 260… Read More »

Enable Strict Replication Consistency for new DCs using Powershell

Another short blog posting (brevity is obviously my thing for 2014). I occasionally come across environments in which Strict Replication Consistency is not enabled.  This is invariably because these environment have forests that were created with Windows 2000 server, but which have subsequently been upgraded.  If you need to know more about Strict Replication Consitency… Read More »