Disabling machine

Author Message
ray3d84

  • Total Posts : 1
  • Scores: 0
  • Reward points : 0
  • Joined: 8/31/2009
  • Status: offline
Disabling machine Monday, August 31, 2009 6:37 AM (permalink)
0
I came across this script below for Disabling machine and written by Ronen Shurer. I have tried modifying to disable computer account on my domain and get error Code 800a000d and it fails.  Wondering how can I modify this so it s successful. My AD structure domain is XXX the computers are in a OU called NY that has a OU name computers and finally the desktop computers are in OU desktop. Can any one help?
BScript'==========================================================================
' NAME:    DisableMachines.vbs
' AUTHOR:  Ronen Shurer
' DATE  :  02/05/2006
' COMMENT: This script will disable computer accounts on the domain
'          according to a supplied list of machines.
'==========================================================================
'Constants Declaration
            Const ForReading = 1 'For text file reading
            InputFileName = "c:\machines.txt"
            DomainString = "netbiosdomainname"
'==========================================================================
On Error Resume Next
 
set myFSO = CreateObject("Scripting.FileSystemObject")
set myFile = myfso.openTextFile(InputFileName, ForReading)
set DomainObj = GetObject("WinNT://" & DomainString)
Do
            strComputer = myFile.readline
            set objComputer = GetObject("LDAP://CN=" & strComputer & ",CN=Computers,DC=mydomain,DC=com")
            objComputer.AccountDisabled = True
            objComputer.SetInfo
            WScript.Echo("Disabled " & strComputer & " on Active Directory")
Loop Until myFile.AtEndOfStream
Set DomainObj = Nothing
myFile.Close
 
#1

    Online Bookmarks Sharing: Share/Bookmark

    Jump to:

    Current active users

    There are 0 members and 1 guests.

    Icon Legend and Permission

    • New Messages
    • No New Messages
    • Hot Topic w/ New Messages
    • Hot Topic w/o New Messages
    • Locked w/ New Messages
    • Locked w/o New Messages
    • Read Message
    • Post New Thread
    • Reply to message
    • Post New Poll
    • Submit Vote
    • Post reward post
    • Delete my own posts
    • Delete my own threads
    • Rate post

    2000-2012 ASPPlayground.NET Forum Version 3.9