Move and Disable PC's in Quest Powershell

Good Afternoon,

I've written a script to move a list of pc's to a new ou and have them disabled. Can anyone assist with this?

$Computers = Get-content C:\Users\adjustin\Desktop\Test183.txt | ForEach-Object {Get-QADObject -identity $_ | Disable-QADComputer -id $_| Move-QADObject -identity $_ -NewParentContainer Marked_for_Deletion/Disabled_Workstations }
JT3865Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Will SzymkowskiSenior Solution ArchitectCommented:
You do not have to use quest cmdlets to accomplish this. See below...

Import-module activedirectory
$OU = "ou=move,dc=domain,dc=com"
$DC = "dc.domain.com"
$Computers = get-content "c:\filename.txt"
ForEach ($user in $Computers)  {

$props = Get-ADcomputer -identity $user -properties samaccountname, distinguishedName -Server $DC

Move-AdObject -Identity $props.distinguishedName -TargetPath $OU -Server $DC

Set-ADComputer -Identity $user -Enabled $false -Server $DC

}

Open in new window


Will.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JT3865Author Commented:
Thanks Will,

Is there anyway to do it with quest cmdlets? Im still learning how to do this?

Thanks,
Will SzymkowskiSenior Solution ArchitectCommented:
I never use Quest cmdlets as it is just added pluggin's and modules that are not required. This is why i did this using the native cmdlets above.

Will.
JT3865Author Commented:
Understandable, Thanks for the help!
Will SzymkowskiSenior Solution ArchitectCommented:
Glad, that it worked for you!

Will.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.