How can I run a PowerShell script from within the %ProgramFiles% folder?
I have tried the variable %ProgramFiles% without any progress, also "Program Files" but can't get ut to work.
My current code
Set shell = WScript.CreateObject("WScript.shell")
shell.Run("powershell C:\Program Files\Temp\test.ps1"), 0 , True
It's working if I use a network share without any spaces
Set shell = WScript.CreateObject("WScript.shell")
shell.Run("powershell \\domain\SYSVOL\script\test.ps1"), 0 , True
I have also tried using """ but can't get PowerShell to work.
Anyone know how to solve this? I need to use VBScript in order to start the PowerShell script in the background at logon via a GPO. Otherwise it will show a PowerShell window.