Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Run command in vbscript

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Run command in vbscript
  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 >>
 Run command in vbscript - 7/25/2006 5:33:42 AM   
  dhborchardt

 

Posts: 3
Score: 0
Joined: 7/25/2006
Status: offline
This command works fine from the command line:  vnci mxhc-hxt-04 /remove   It runs an uninstall program on computer mxhc-hxt-04.
I would like to automate this for a login script. The problem I am having is how to enter the computer name "strInfo" into the shell.run
I have tried playing with it and below is one example that failed.

Dim objNet, objShell
Set objNet = CreateObject("WScript.NetWork")
                     
Dim strInfo
strInfo =  objNet.ComputerName
wscript.echo strinfo                      
set objShell = wscript.createObject("wscript.shell")
                     
objShell.Run("VNCI" & strInfo & " /Remove ", 1, TRUE)
Set objNet = Nothing        

Dale           
 
 
Post #: 1
 
 RE: Run command in vbscript - 7/25/2006 5:46:22 AM   
  ebgreen


Posts: 5246
Score: 31
Joined: 7/12/2005
Status: online
What about this:


Dim objNet, objShell
Set objNet = CreateObject("WScript.NetWork")
                     
Dim strInfo
strInfo =  objNet.ComputerName
wscript.echo strinfo                      
set objShell = wscript.createObject("wscript.shell")
                     
objShell.Run("VNCI " & strInfo & " /Remove ", 1, TRUE)
Set objNet = Nothing        


_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to dhborchardt)
 
 
Post #: 2
 
 RE: Run command in vbscript - 7/25/2006 6:16:08 AM   
  dhborchardt

 

Posts: 3
Score: 0
Joined: 7/25/2006
Status: offline
Thanks
When I try that I get the error "VBScript Compilation error: Cannoit use parentheses when calling a sub.

I also tried:

Dim objNet, objShell
'
Set objNet = CreateObject("WScript.NetWork") 
                     
Dim strComputerName
strComputerName =  objNet.ComputerName
wscript.echo strComputerName                    
set objShell = wscript.createObject("wscript.shell")

strTmp = "VNC1 " & strComputerName & " /Remove, 1, TRUE"

objShell.Run strTmp
'
Set objNet = Nothing   

Gives error: "The system cannot find the file specified"

(in reply to dhborchardt)
 
 
Post #: 3
 
 RE: Run command in vbscript - 7/25/2006 6:48:35 AM   
  dhborchardt

 

Posts: 3
Score: 0
Joined: 7/25/2006
Status: offline
OK,, I had a type-O the whole time. The following works. I had a number 1 in NVC1. It is supposed to be VNCI

Dim objNet, objShell 

Set objNet = CreateObject("WScript.NetWork") 
                    
Dim strComputerName
strComputerName =  objNet.ComputerName
wscript.echo strComputerName                    
set objShell = wscript.createObject("wscript.shell")

strTmp = "VNCI " & strComputerName & " /Remove, 1, TRUE"

objShell.Run strTmp 

Set objNet = Nothing   

Thanks
Dale

(in reply to dhborchardt)
 
 
Post #: 4
 
 
 
  

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 >> Run command in vbscript 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