Archive for the ‘Power Shell’ Category

Query AD group membership with Powershell

Here are a couple of very useful scriptlets if you ever need to enumerate or count the quantity of users in an AD group.

Posted on October 25, 2012 at 14:47 by simon · Permalink · Leave a comment
In: AD, Power Shell

loop until a certain time (in powershell)

Today I needed to write a bit of code that would enable a script to run for 23 hours and 55 minutes before ending itself.  So I dug in to PowerShell and again it came up with a fantastic solution for looping until a certain time.

Posted on September 30, 2012 at 14:35 by admin · Permalink · 5 Comments
In: Power Shell · Tagged with: ,

Powershell NSLOOKUP

The following PowerShell one liners give you hostname to IP or vice versa.

Posted on August 18, 2012 at 11:17 by simon · Permalink · Leave a comment
In: Power Shell · Tagged with: , , , ,

Validate an IP address in PowerShell

Today I needed to validate an IP address after a user types it in to a script.  I don’t want to ping or check connectivity, I just want to validate that the format looks like a valid IP address.  I looked at various regex expressions which were getting complicated.  Then I stumbled upon this little nugget:

Posted on August 17, 2012 at 19:57 by simon · Permalink · One Comment
In: Power Shell · Tagged with: , ,

Copy members of one AD group to another group

Today I needed to copy about 300 users from one AD group to another and there was no way I was going to do that manually.  So I started looking in to what PowerShell can do adn here is what I found:

Posted on August 3, 2012 at 11:19 by simon · Permalink · Leave a comment
In: AD, Power Shell · Tagged with: , , , ,