PowerShell – Listing aged out computer accounts in Active Directory

PowerShellDo you remember having to use OldCmp.exe  from JoeWare (great tools by the way) to capture a a list of computer accounts which have not been attached to your Active Directory for a period of time. Luckily with PowerShell and Quest ActiveRoles you can do this with a simple two line script.

Here’s the code: http://gist.github.com/492494

Find Old Computers In Active Directory

Find Old Computers In Active Directory




PowerShell – Get serial numbers for computers in Active Directory

PowerShellThere are a lot of posts about pulling data from a file to do actions against computers/users. While this is valuable, I prefer to do dynamic capturing of computer and user objects directly from my Active Directory.

This is a simple script which will capture a list of computers from Active Directory and subsequently pull the serial number using the Get-WMIObject CmdLet using the Win32_BIOS class.

The neat addition over many other scripts I have used is the addition of the -ErrorAction SilentlyContinue option which prevents offline computers from sending error information in the output. Add some error handling and you now have a list of computers which are offline or inaccessible.

As with many of the scripts I will show you, you need to install ActiveRoles CmdLets from Quest Software (follow the link in the Gist)

Here’s the code: http://gist.github.com/492475

List of serial numbers from Active Directory computers

List of serial numbers from Active Directory computers




PowerShell bundle for TextMate

I’ve just installed this bundle for TextMate and it is nothing short of awesome. TextMate = happiness.TextMate

http://github.com/caisson/powershell.tmbundle

With these powers I can become invincible!!!*

Now if only I was a proper programmer I could really work some magic with these tools 🙂

* TextMate bundles do not actually make you invincible



PowerShell – Active Directory – Email users with password expiry < 14 days

PowerShell – Active Directory – Email users with password expiry under 14 daysPowerShell

This script is handy for users who are not typically on your network (remote access, email only etc…). Normally users are warned at 14 days before expiry unless they are not logging into Active Directory through the workstation in which case they will not receive warnings until the password expires.

Simply set this to run daily and it will locate and email anyone who has a password expiry less than 14 days. To change the criteria, simply modify the If statement.

You need to install the ActiveRoles CmdLets from Quest Software (follow the link in the Gist)

Here’s the code: http://gist.github.com/469656

PowerShell Script

Email Password Expiry Under 14 days