[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1750
  • Last Modified:

When running "objShell.Run + command" how do we hide the cmd.exe window so it doesn't show up?

From the folloowing script is there any way to hide the cmdshell screen (cmd.exe) so the user doesn't see the black window with what is being executed. (Notice that this is going to be part of the logon script)

Basically with this code the cmd.exe appear while the users are doing the logon and I would like to hide (so they can't close it or know that even exist)

objShell.Run "\\server\NETLOGON\tranguid.exe", 1, True
objShell.Run "net Stop ccmexec", 1, True
Wscript.Sleep intShortSleep
objShell.Run "net Start ccmexec", 1, True

Set objShell = CreateObject("WScript.Shell")  
Set objFSO = CreateObject("Scripting.FileSystemObject")  
strRegFile = "\\server\NETLOGON\tranguid /r.exe" 
Dim intShortSleep 
 
' Values set 
intShortSleep = 3000 
   
objShell.Run "\\server\NETLOGON\tranguid.exe", 1, True 
objShell.Run "net Stop ccmexec", 1, True 
Wscript.Sleep intShortSleep 
objShell.Run "net Start ccmexec", 1, True

Open in new window

0
llarava
Asked:
llarava
  • 3
2 Solutions
 
Om PrakashCommented:
http://blogs.technet.com/heyscriptingguy/archive/2006/05/19/how-can-i-hide-the-command-window-when-executing-a-command-like-net-localgroup-administrators.aspx
Set objShell = CreateObject("Wscript.Shell")
strCommand = "net localgroup Administrators" 

Set objExec = objShell.Exec(strCommand) 
   
Do Until objExec.Status
    Wscript.Sleep 250
Loop 

Wscript.Echo objExec.StdOut.ReadAll()

Open in new window

0
 
llaravaAuthor Commented:
I am not quite sure how to integrate that into the script could someone help?
0
 
llaravaAuthor Commented:
I have tried this but it doesn't seem to work I don't get any errors but it doesn't seem to do what work.

Basically the script needs to:

1.) Execute the tranguid /r.exe on a remote share

2.) Stop ccmexec service

3.) Allow some time

4.) Start ccmexec

Any help?

Thanks.
Set objShell = CreateObject("WScript.Shell")   
Set objFSO = CreateObject("Scripting.FileSystemObject")   
strRegFile = "\\server\NETLOGON\tranguid /r.exe"
strnetstop = "net Stop ccmexec"   
strnetstart = "net Start ccmexec"  
   
Set objExec = objShell.Exec(strRegFile)  
    
Do Until objExec.Status 
    Wscript.Sleep 250 
Loop  
 
'Wscript.Echo objExec.StdOut.ReadAll()

Set objExec = objShell.Exec(strnetstop)  
    
Do Until objExec.Status 
    Wscript.Sleep 250 
Loop  
 
Wscript.Echo objExec.StdOut.ReadAll()


'Set objExec = objShell.Exec(strnetstart)  
    
'Do Until objExec.Status 
'    Wscript.Sleep 250 
'Loop  
 
'Wscript.Echo objExec.StdOut.ReadAll()

Open in new window

0
 
llaravaAuthor Commented:
I modified the script an used to hide the window.

objShell.Run "net Stop ccmexec", 0, True
0
 
merowingerCommented:
This is the correct option!
0 = Hide the executed application
true = script waits until the application is finished (wait = in the case the script continues with waitiing for the appliction)
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now