How do I find orphaned computer objects in Active Directory using PowerShell?

How can I find all computer accounts in my Active Directory domain that have been inactive for x days using PowerShell?

This would give you all computer accounts that have no activity for the last 365 Days.

Search-ADAccount -AccountInactive -ComputersOnly -TimeSpan 365.00:00:00

This would sort it for you by lastlogondate.

Search-ADAccount -AccountInactive -ComputersOnly -TimeSpan 365.00:00:00 | Sort-Object lastlogondate | Ft name,lastlogondate -auto

This would give you disabled computer accounts.

Search-ADAccount -AccountDisabled -ComputersOnly 

Installing Windows to a new bootable VHD with no host OS

I love the performance gains I get by using bootable VHDs. I’ve always enjoyed using VHDs but I generally had a host OS first, then installed a bunch of VHDs that I made bootable. Recently I’ve changed all of this on my computer after a spent some time reading a post from John Papa. This leads  to more flexibility. The idea is simple: take a clean drive with no host OS and add or remove bootable VHDs as needed.

Logo_winlogo

Continue reading

Deleting a Windows Service – did you know it’s so easy?

Whenever i had to delete an orphaned Windows Service, i started RegEdit.exe and navigated to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services. Then i searched for the Service and removed the whole registry key including all subkeys. Then i rebooted the system. Yes, i know, don’t tell me that this a horrible way, that’s why i want to share this post with you.. Logo_cmd

Continue reading