VBS Active Directory Workstations Organization Unit to Text file Reboot Whole Computer List

In Knowledge Base Blog by angeladmin

‘ Declare Variables
query=”LDAP://OU=Computers,OU=Workstations,dc=domain,dc=com”
fldrvar=”c:temp”
filevar=”computerlist.txt”

Set objOU = GetObject(query)
objOU.Filter = Array(“Computer”)
computers=””
For Each objComputer in objOU
computers=computers & objComputer.cn & vbcrlf
Next

Set fso = CreateObject(“Scripting.FileSystemObject”)
if not fso.folderexists(fldrvar) then fso.createfolder(fldrvar)
Set ts = fso.OpenTextFile(fldrvar & “” & filevar, 2, True)
ts.writeline computers
ts.close

Msgbox “All Done file is located at: ” & fldrvar & “” & filevar
msgbox “Usefull Command #1: Start Cmd Box -> Type “”shutdown -i”” without quotes”

Angel Computers – Contact Us