launch a vbs script as admin with visua basic .net
Posted on 2014-04-14
I have a .net application that i would like to use to launch some vbs scripts as an admin. Normally I launch a command window within Windows 7 as administrator and can run the vbs scripts. I have tried to use the below code, but it's not working. Any ideas?
Dim starthttpWatch As New System.Diagnostics.Process
starthttpWatch.StartInfo.WorkingDirectory = "c:\"
starthttpWatch.StartInfo.RedirectStandardOutput = True
starthttpWatch.StartInfo.FileName = "cmd.exe"
starthttpWatch.StartInfo.Arguments = "\c C:\Temp\WorkstationMonitor\Enable-httpwatch-v2.0.vbs"
starthttpWatch.StartInfo.UseShellExecute = False
starthttpWatch.StartInfo.CreateNoWindow = True
starthttpWatch.StartInfo.UserName = strPPAccount
starthttpWatch.StartInfo.Password = pwd