Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


objShell.Exec minimized

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,47185
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> objShell.Exec minimized
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 objShell.Exec minimized - 5/17/2007 7:42:59 PM   
  4scriptmoni


Posts: 208
Score: 0
Joined: 5/3/2007
Status: offline
I have a script that execute the same cmd many times sometimes 300 times, and I it would be
very cool if I didnt have millions of cmd windows poping up. I have looked everywhere for a solution.
The cmd has to run in EXEC not Run mode. Exemple:
Set objShell = WScript.CreateObject("WScript.Shell")
Set objExecObject = objShell.Exec("cmd /c quser " & username & " /server:" & servername )
or
Set objExecObject = objShell.Exec("cmd /c ipconfig.exe")I wanted it to do like start /min, I have tried  start /min cmd /c ipconfig.exe but nothing...
anyone can help me out?
cheers,

_____________________________

Enterprise Microsoft Scripts
Exchange, Login/Logout Monitor,TS, Monitoring, Security, AD, etc...
http://www.felipeferreira.net
 
 
Post #: 1
 
 RE: objShell.Exec minimized - 5/17/2007 9:13:42 PM   
  gdewrance


Posts: 587
Score: 3
Joined: 3/16/2006
Status: offline
Would this do it

Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run "cmd /c ipconfig /all" , 0, True
objShell.Run "cmd /c ipconfig.exe", 0, True

(in reply to 4scriptmoni)
 
 
Post #: 2
 
 RE: objShell.Exec minimized - 5/17/2007 11:08:13 PM   
  gdewrance


Posts: 587
Score: 3
Joined: 3/16/2006
Status: offline
There are not options for exec only Run read Microsofts Website

http://www.microsoft.com/technet/scriptcenter/guide/sas_wsh_pkoy.mspx?mfr=true

(in reply to 4scriptmoni)
 
 
Post #: 3
 
 RE: objShell.Exec minimized - 5/18/2007 3:49:54 AM   
  DiGiTAL.SkReAM


Posts: 1194
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
You say it can onyl run in exec, and not with Run.  Why?  What are you trying to accomplish that requires exec?

_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to gdewrance)
 
 
Post #: 4
 
 RE: objShell.Exec minimized - 5/18/2007 5:36:35 AM   
  mcds99


Posts: 441
Score: 4
Joined: 2/28/2006
Status: offline
This can be done but it's outside of the script.

Run the script from a .bat or .cmd file like this

  cscript scriptname.vbs
  exit

Open a command prompt and run the batch file.

If you need to run this a lot create a shortcut, in the shortcut properties set the "Run" to minimized.

_____________________________

Sam

Keep it Simple Make it Fun KiSMiF

(in reply to DiGiTAL.SkReAM)
 
 
Post #: 5
 
 RE: objShell.Exec minimized - 5/21/2007 12:07:34 AM   
  4scriptmoni


Posts: 208
Score: 0
Joined: 5/3/2007
Status: offline
i thought there was a way... :(
I guess I will try the batch file option. because its quite anyoning when popup 400 times a cmd window.
in Run mode I can not redirect correctly the output, so it will not work for me. it has be on Exec mode.
thx anyways.

_____________________________

Enterprise Microsoft Scripts
Exchange, Login/Logout Monitor,TS, Monitoring, Security, AD, etc...
http://www.felipeferreira.net

(in reply to 4scriptmoni)
 
 
Post #: 6
 
 RE: objShell.Exec minimized - 5/21/2007 4:51:47 AM   
  Country73


Posts: 735
Score: 10
Status: offline
Have you tried running your script in CSCRIPT mode and then changing this line -
   Set objExecObject = objShell.Exec("cmd /c quser " & username & " /server:" & servername )
to
   Set objExecObject = objShell.Exec("quser " & username & " /server:" & servername)

You can probably get away without changing that line, but running your script in CSCRIPT mode is the main thing you want to do.

(in reply to 4scriptmoni)
 
 
Post #: 7
 
 RE: objShell.Exec minimized - 5/21/2007 5:01:05 AM   
  4scriptmoni


Posts: 208
Score: 0
Joined: 5/3/2007
Status: offline
i forgot to mention it is in .HTA
:(
but I may try again the run mode...

_____________________________

Enterprise Microsoft Scripts
Exchange, Login/Logout Monitor,TS, Monitoring, Security, AD, etc...
http://www.felipeferreira.net

(in reply to Country73)
 
 
Post #: 8
 
 RE: objShell.Exec minimized - 5/21/2007 7:20:08 AM   
  DiGiTAL.SkReAM


Posts: 1194
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
what command are you trying to capture?

_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to 4scriptmoni)
 
 
Post #: 9
 
 RE: objShell.Exec minimized - 5/21/2007 8:49:56 PM   
  4scriptmoni


Posts: 208
Score: 0
Joined: 5/3/2007
Status: offline
  Set objExecObject = objShell.Exec("quser " & username & " /server:" & servername)
i then parse in many ways the output, in order to get: session id, time, date
like i said i will try the run mode although to do
Set objRuncObject = objShell.Run("quser " & username & " /server:" & servername>&file.txt)  will probably not work :(

cheers,

_____________________________

Enterprise Microsoft Scripts
Exchange, Login/Logout Monitor,TS, Monitoring, Security, AD, etc...
http://www.felipeferreira.net

(in reply to DiGiTAL.SkReAM)
 
 
Post #: 10
 
 RE: objShell.Exec minimized - 5/22/2007 1:10:48 AM   
  DiGiTAL.SkReAM


Posts: 1194
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
For stuff like that at the commandline, I find that I usually have to run it inside a full command environment:

Dim oShell, oFSO
Set oShell = CreateObject("Wscript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
oShell.Run "%comspec% /c quser " & username & " /server:" & servername & " > c:\tempfile.txt",0,True
WScript.Echo oFSO.OpenTextFile("c:\tempfile.txt").ReadAll

EDIT:
I just tried the quser command, and was able to get the output with the above code, so this works.

< Message edited by DiGiTAL.SkReAM -- 5/22/2007 1:16:05 AM >


_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to 4scriptmoni)
 
 
Post #: 11
 
 RE: objShell.Exec minimized - 5/23/2007 12:25:09 AM   
  4scriptmoni


Posts: 208
Score: 0
Joined: 5/3/2007
Status: offline
THANK YOU THANK YOUUUuuuuu


_____________________________

Enterprise Microsoft Scripts
Exchange, Login/Logout Monitor,TS, Monitoring, Security, AD, etc...
http://www.felipeferreira.net

(in reply to DiGiTAL.SkReAM)
 
 
Post #: 12
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> objShell.Exec minimized Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts