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?


Dim objShell Set objShell = WScript.CreateObject ("WScript.shell") objShell.run "C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe & Restart-Service BranchCache" Set objShell = NothingBut is doesn't work.Dim objShell Set objShell = WScript.CreateObject ("WScript.shell") objShell.run "PowerShell -Command {Start-Service PeerDistSvc}"When i run the vbs it runs through and the cmd window pops up and close and that was it, but the service didn't start what do i wrong? I am administrator on the computer.