Running VBS wscript.shell command in PowerShell
hello all,
i have encountered vbs script calls homemade executable (which did not write , have no documentation on) that has parameters executable reads. i'm trying migrate vbs script powershell, , have run bit of trouble following 2 lines of vbs code (i've left variable references in here accuracy):
set wshshell=wscript.createobject("wscript.shell") wshshell.run("createticket.exe ;3;"&string&" account "&stringarray(0)&" has been removed following group(s);resolved ad;resolved;"&strsubmitter&";"&strsamaccountname&"",0,true) in powershell, can create similar com object, having trouble executing second line above (i've replaced variables above strings be):
$wshell = new-object -comobject wscript.shell -erroraction stop $wshell.run("createticket.exe ;3;account testuser has been removed following group(s);resolved ad;resolved;teststring;testuser",0,$true) i receive error cannot find file specified, it's having trouble separating parameters semicolons. there hope executing in powershell?
if you're migrating powershell, use powershell, don't use powershell run vb commands. try instead:
$exe = "c:\path\to\createticket.exe" start-process $exe -argumentlist ";3;account testuser has been removed following group(s);resolved ad;resolved;teststring;testuser" -waitedit: too slow!
i hope post has helped!
Windows Server > Windows PowerShell
Comments
Post a Comment