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.
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.
In: Power Shell · Tagged with: loop, PowerShell
Powershell NSLOOKUP
The following PowerShell one liners give you hostname to IP or vice versa.
In: Power Shell · Tagged with: dns, hostname, ip address, nslookup, PowerShell
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:
In: Power Shell · Tagged with: .NET, ip address, validate
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:
In: AD, Power Shell · Tagged with: AD, copy, dsquery, PowerShell, users