I'm a VBScript and PowerShell newbie. I have a PowerShell script that runs correctly when I call it from the command line. However when I try and call it from VBScript, it runs but does nothing.
The command I use on the CLI that works is
powershell.exe -nop -exec bypass -noni -command "& { . C:\<censored path>\testscript1.ps1; Get-Test }"
This works. When I run the following vbscript code, I get no results
Set objShell = CreateObject("Wscript.shell")
objShell.run("powershell.exe -nop -exec bypass -noni -command &""& { . C:\<censored path>\testscript1.ps1; Get-Test }" &"")
What am I doing wrong?
PS: After trimming down my command to:
objShell.run("powershell.exe -nop -exec bypass -noni -command "& { . C:\<censored path>\testscript1.ps1; Get-Test }" ")
I get a Code 800A0408 - Invalid Character error for the opening brace bracket. I have tried escaping both brackets, but I still get the same error.