Here is a script if you want to move an object to a ou where another server is located
you can double click the bat file and that will start the powershell script.
I made this to automate a process
Bat:
PowerShell.exe -File c:\users\user1\desktop\moveobj.ps1
Ps1
Add-PSSnapin Quest.ActiveRoles.ADManagement
Connect-QADService -service 250-ad
Move-QADObject -NewParentContainer (get-qadcomputer pc1).parentcontainer
*
To use: get the powershell commandlets from quest. It is possible without them but requires a lot more effort.
PowerShell.exe -File c:\users\user1\desktop\moveobj.ps1
The reason I added this line rather than .\moveobj.ps1 was because it was opening the ps1 in notepad. This way it forces the ps1 to load in powershell.
Add-PSSnapin Quest.ActiveRoles.ADManagement
Loads the powershell admanagement from quest into powershell. Otherwise the commands wont work.
Connect-QADService -service 250-ad
Forces a connection to a particualr dc. Example if you are in ny and wanted to conenct to a cali DC
Move-QADObject objectname -NewParentContainer (get-qadcomputer pc1).parentcontainer
Moves object objectname to the ou where pc1 is loacted. you could also just add the path of the ou.
If you leave out objectname, a prompt will come up
0 comments:
Post a Comment