|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
![]() 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 |
#2
| |||
| |||
Re: How to suppress command prompt in vbscript I found something similar which will do a similar job, obviously doesn't include ttl values etc but works never the less. input = InputBox("Please enter IP address(s) of machine(s) to test, each seperated by a "":"" character", "My connectivity programme") If input ="" Then WScript.Echo("Please enter IP Address(s) of Teminal(s)/Host(s) to ping computer name to Ping, each seperated by a "":"" character") Else strMachines = input aMachines = Split(StrMachines, ":") For Each machine In aMachines Set ObjPing = GetObject("winmgmts:")._ ExecQuery("select * from Win32_PingStatus where address = '"_ & machine & "'") For Each objStatus in ObjPing If IsNull(ObjStatus.StatusCode) Or objStatus.StatusCode<>0 Then MsgBox machine & " Is not online - Check IP and connectivity",,"my app" Else MsgBox machine & " is online and responding",,"my app" End If Next Next End If |
#3
| |||
| |||
Re: How to suppress command prompt in vbscript i think you are out of my conpect i need the command prompt window should not appear for cilent whose run this code the code which i have posted working very fine? what i need is i dont want the command prompt window should appear |
![]() |
|
Tags: active directory, code, command prompt, dos prompt, vbscript |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to create ZIP Files from Command-Line via VBScript? | FB | Windows Server Help | 10 | 22-12-2011 12:18 AM |
about the command prompt | Gorganzola | Windows Software | 2 | 17-10-2008 06:24 PM |
How to add a variable to a shell command in a vbscript | Dee | Windows Server Help | 4 | 28-04-2008 09:13 PM |
Command prompt "COPY" command not working in brand new Windows Vis | CMD COPY command not working in Vista | Vista Help | 7 | 06-02-2008 02:50 AM |
Set Affinity using command prompt? | zachlr1@gmail.com | Vista Help | 3 | 23-12-2007 05:09 AM |