'========================================================= ' ' NAME: Removes Computer Accounts in the domain from a list. ' ' USAGE: Change the file path to the location of the file ' that contains your account list. ' (strFilePath = InputBox(Message3,Title,"\\server\share\file.csv")) ' ' AUTHOR: Todd Woolums (twoolums@toddwoolums.com) ' DATE : 05/29/2004 ' VERSION: 1.0 '========================================================= On Error Resume Next Const ForReading = 1 Message1 = "Please enter your username." & vbCrLf Title = "Computer Account Deletion Tool" strUserName = InputBox(Message1,Title,"DOMAIN\USERNAME") Message2 = "Please enter your password." & vbCrLf strPassword = InputBox(Message2,Title,"Password") Message3 = "Please enter the path to your input file." & vbCrLf strFilePath = InputBox(Message3,Title,"\\server\share\file.csv") Message4 = "Please enter the Domain to remove from." & vbCrLf strDomain = InputBox(Message3,Title,"DOMAIN") Set objExplorer = WScript.CreateObject ("InternetExplorer.Application") objExplorer.Navigate "about:blank" objExplorer.ToolBar = 0 objExplorer.StatusBar = 0 objExplorer.Width=400 objExplorer.Height = 200 objExplorer.Left = 375 objExplorer.Top = 40 objExplorer.Visible = 1 objExplorer.Document.Body.InnerHTML = "Please wait while your computer accounts are created." Set objFSO = CreateObject("Scripting.FileSystemObject") Set objTextFile = objFSO.OpenTextFile(strFilePath, ForReading) While Not objTextFile.AtEndOfStream strLine = objtextFile.ReadLine Set oProvider = GetObject("WinNT:") Set oContainer = oProvider.OpenDSObject("WinNT://" & strDomain, strUserName, strPassword, 1) Set oComputer = oContainer.Delete("Computer", strLine) oComputer.SetInfo Wend objTextFile.Close Set objTextFile = Nothing Set Message1 = Nothing Set Message2 = Nothing Set Message3 = Nothing Set Message4 = Nothing Set Title = Nothing Set strUserName = Nothing Set strPassword = Nothing Set strFilePath = Nothing objExplorer.Quit MsgBox "Your computer accounts have been deleted.", vbOKOnly + vbInformation