In order to avoid to popup you need to run it via command line
:/>cscript //nologo <scriptname>.vbs
then you can redirect the output to a file by adding "> <somename>.txt"
-J
"sircooljoe" wrote:
[Quoted Text] > Hello, > I need some help with a script. I am trying to get a list of all computer > accounts in my domain. I found the script in the respository, however it > just gives me a pop up window for each machine. > I am looking for a way to take this script and export the information into a > file. > Any help would be appreciated. > > Const ADS_SCOPE_SUBTREE = 2 > > Set objConnection = CreateObject("ADODB.Connection") > Set objCommand = CreateObject("ADODB.Command") > objConnection.Provider = "ADsDSOObject" > objConnection.Open "Active Directory Provider" > > Set objCOmmand.ActiveConnection = objConnection > objCommand.CommandText = _ > "Select Name, Location from 'LDAP://DC=am,DC=wj,DC=MS,DC=lvmh' " _ > & "Where objectClass='computer'" > objCommand.Properties("Page Size") = 1000 > objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE > Set objRecordSet = objCommand.Execute > objRecordSet.MoveFirst > > Do Until objRecordSet.EOF > Wscript.Echo "Computer Name: " & objRecordSet.Fields("Name").Value > Wscript.Echo "Location: " & objRecordSet.Fields("Location").Value > objRecordSet.MoveNext > Loop >
|