hi everyone,
i am running vbscript code which fetch me the DN of the server through command prompt (using dsquery) i am having more than 300 server, so each time when it invokes command prompt the DOS prompt window will appear i want this windows should be suppersed but the code should run and get its result.
how its possible is there any possible way to do this?
here i have given my code
Option Explicit
'dim FilePath1
Const FilePath1 = "c:\distinguish name.txt"
Dim objFSO,objFile,objFile1,i
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("c:\Server move list.txt", ForReading)
Set objFile1 = objFSO.CreateTextFile(FilePath1, True)
Const ForReading = 1
Dim arrFileLines()
i = 0
Do Until objFile.AtEndOfStream
Redim Preserve arrFileLines(i)
arrFileLines(i)= objFile.ReadLine
Dim objShell,objWshScriptExec,objStdOut,strline,strcom mand
strcommand="dsquery computer -name" & Chr(32)& arrFileLines(i)
WScript.Echo strcommand
Set objShell = CreateObject("WScript.Shell")
Set objWshScriptExec = objShell.Exec(strcommand)
Set objStdOut = objWshScriptExec.StdOut
strline=objStdOut.ReadLine
MsgBox strline
objFile1.WriteLine(strline)
i = i + 1
Loop
objFile.Close
Bookmarks