Scripting Blog

A place to learn about PowerShell and share stories of automation

Hey, Scripting Guy! How Can I Find Old Computer Accounts?

Hey, Scripting Guy! We have had a number of changes at our company recently. As a result, our Active Directory Domain Services (AD DS) installation is somewhat shabby. Okay, a lot shabby. When I go into AD DS Users and Computers and look through it, I cannot tell which computers are supposed to be there or not. How can I get rid of all the ...

Hey, Scripting Guy! How Can Retrieve a List of All My Computer Accounts, Grouped By OU?

Hey, Scripting Guy! How can I get a list of all the computers in my domain, grouping those computers by the OU in which the computer account resides?-- TA Hey, TA. Well, today is Monday, and the Scripting Guy who writes this column is actually glad it’s Monday. Not that he’s all that excited about coming back to work, mind you; it’s ...

Hey, Scripting Guy! How Can I Read Computer Names From a Text File and Then Verify Whether or Not Those Computers Still Exist?

Hey, Scripting Guy! How can I read a list of computer names from a text file, and then check to see if those computers still exist in Active Directory?-- CL You know, that’s a good question, CL, we – hold on a second. Some of you out there look so sad; why the long faces? After all, the 2008 Winter Scripting Games start in less than two ...

How Can I Prompt for a Computer Name and Then Delete That Computer Account From Active Directory?

Hey, Scripting Guy! How can I write a script that prompts the user for a computer name, then goes out and deletes that computer account from Active Directory?-- PH Hey, PH. As a general rule, technical writers never experience writer’s block. Why not? Well, writer’s block usually comes about because you can’t figure out how to get ...

How Can I Use Windows PowerShell to Get a List of All My Computers?

Using Windows PowerShell, how can I retrieve a list of all the computer accounts in my domain?-- TE Hey, TE. You know, several years ago the Scripting Guy who writes this column was playing basketball with one of his brothers. Because there were a total of 5 people at the park they had to play 2-on-2, with one person forced to sit out. After ...