Category Archives: Powershell

PowerShell to find enabled user objects per OU in Active Directory

SO you’ve been tasked with trying to find out how many user objects exist i your domain, but the OU structure is so disorganised, you don’t know where to start?

This simple PowerShell script will tweeze out all any user objects no matter where they are hidden, so long as the account context you run it in can see them.
Continue reading PowerShell to find enabled user objects per OU in Active Directory

PowerShell to find unused AD user accounts

When you run scripts to find Active Directory user accounts that haven’t been used in a while, one thing the standard approach misses is accounts that have never been used.

Finding Active Directory user accounts that have never been used is a little tricky, in that the lastlogontimestamp is NULL although the attribute type is a large integer.  Querying this in PowerShell requires a back-to-front approach as we can’t query if the value is NULL, we have to query if the value is not ‘not-NULL’…. i.e. lastlogontimestamp -like “*”

Continue reading PowerShell to find unused AD user accounts

Powershell script to query Dell website for Warranty End Date

This little powershell script uses WMI to get the local PCs Service Tag from the bios.  It then queries Dell’s website for the warranty information and loops through each warranty line item to find the latest date.  Once we have the date, it is then written to the registry.  The warranty end date is then ready to be used in BGInfo or exported to a MOE tool such as Altiris NS for easy reporting. Continue reading Powershell script to query Dell website for Warranty End Date