Hello, I’m trying to move any inactive computers in my AD to an OU called “Disabled Computers” from an input file.
I first created the input file by running the command:
dsquery computer -inactive 13 >> input.csv
I have a list of about 100 computers in this input.csv file in the format of
“CN=computerName,OU=x,OU=y,DC=domain,DC=com”
How would I input this into another PowerShell command so it takes all the machines from this input.csv file and moves it to a specified file?
You don’t have to use dsquery to a file and then use Powershell. Powershell can find inactive computers a couple of ways. If you have RSAT tools installed, you can you the ActiveDirectory module: