Running Powershell from vbs with command as parameter
powershell, vbscript
Solution
1) store your powershell command as powershell script. 2) Use the vbs to run the powershell
Set objShell = CreateObject("Wscript.Shell")
objShell.Run("powershell.exe -noexit c:\scripts\test.ps1")
Problem
Hey i want to run from an vbs script a powershell commando. Something like start powershell.exe and enter a specific command like Restart-Service. I thought something similar to this could work: ``` strCommand = "C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe -command Restart-Service [service name]" Set WshShell = WScript.CreateObject("WScript.Shell") Set objExec = WshShell.Exec(strCommand) ``` Has someone an idea how can i manage this?