mroberts
Posts: 90
Score: 0 Joined: 9/24/2004 Status: offline
|
I' m not having any luck with this. When reume error is off I the script pops ups and says error moving PC name. When I enable resume error I get an error " there is no such object on the server on line 13. Here is the code I' m using, any help please ' On Error Resume Next
Set objFSO = CreateObject(" Scripting.FileSystemObject" )
Set objFile = objFSO.OpenTextFile(" c:\test.txt" , 1)
Do Until objFile.AtEndOfStream
Computer = objFile.ReadLine
Set objNewOU = GetObject _
(" LDAP://OU=Inactive Computer Accounts,DC=test,DC=net" ) ' OU to move PC to
Err.Clear
Set objMoveComputer = objNewOU.MoveHere _
(" LDAP://CN= & Computer,OU=BPS Computers,DC=test,DC=net" , " CN= & Computer" ) ' Target OU
If Err.Number <> 0 Then
Wscript.Echo " Error moving " & Computer & " . (" & Err.Number & " )"
Else
WScript.Echo " Successfully moved " & Computer & " ."
End if
Loop
objFile.Close
Wscript.echo " Done"
|