1
votes

Hi can someone pls help me to run powershell from vbscript as a administrator

VB Script

MyPath = "c:\temp\folder1" Dim objShell Set objShell = CreateObject("Wscript.Shell") objShell.run("powershell.exe -noexit -file C:\temp\power.ps1 " & MyPath)

PowerShell power.ps1

C:\temp\psfile.exe $args[0] -c

1
Why are you trying to run a PowerShell script to run an external command instead of directly running the external command from VBScript?Ansgar Wiechers
Hi psfile command will make use of administrator user id and password and have to put in external file ...user1954762
I have to close all the connection in folder/sub-folders that are open in rempte share using psfile command. in psfile I have to use remote server administrator id and password to achieve thisuser1954762
Hi can someone pls help me to run powershell from vbscript as a administrator VB Script ----------- MyPath = "c:\temp\folder1" Dim objShell Set objShell = CreateObject("Wscript.Shell") objShell.run("powershell.exe -noexit -file C:\temp\power.ps1 " & MyPath) PowerShell power.ps1 --------------------- C:\temp\psfile.exe $args[0] -cuser1954762

1 Answers

0
votes

In VBScript Set is used for objects; so change

set input ="C:\temp\folder1\"

to

input = "C:\temp\folder1\"