troubleshooting Question

Passing switches to executables thru VB Script

Avatar of Ray Drummond
Ray DrummondFlag for United States of America asked on
Visual Basic ClassicVB Script
5 Comments1 Solution592 ViewsLast Modified:
I'm really new to VB Script and am trying to figure out how to pass a switch to an executable thru VB Script.  What I'm doing is connection to a target machine, going to a specific directory, copying a group of files to the directory and then trying to execute a program using PSExec.  The whole process works, but the program requires a password.  There is a switch that I can pass with the password to do it, but I can't figure out the correct syntax in VB Script to do it.  The command line would look like....

c:\%systemroot%\propatches\agtinstallerx.exe /PW password

Here is the code....

For Each sLine In aComp
      'WScript.Echo sLine
      If FileSystem.FolderExists ("\\" & sLine & "\c$\winnt") Then
            sDest = "\\" & sLine & "\c$\winnt\ProPatches\"
            sRexe = """C:\winnt\ProPatches\AgtInstallerX.exe /PW password"""
      Else
            sDest = "\\" & sLine & "\c$\windows\ProPatches\"
            sRexe = """C:\windows\ProPatches\AgtInstallerX.exe /PW password!"""
      End If

Would greatly appreciate the help.
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros