Hi,
I have a Powershell script running from a batch file.
I can run it in a command window or via Windows Task Scheduler.
d:> MyScript.bat
Inside the script I can execute powershell either of these ways:
powershell -file "D:\MyCode\MyPSscript.ps1" %1 %2
PowerShell.exe -NoProfile -Command "& {Start-Process PowerShell.exe -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File "D:\MyCode\MyPSscript.ps1" %1 %2' -Verb RunAs}"
However, when I run MyScript.bat triggered remotely from the MainFrame via Computer Associates ESP, the script fails with
New-Object: A constructor was not found. Microsoft.Sharepoint.SPSite etc.....
It seems as if the batch file can't address or find any of the environment where all the objects are.
The ID is the same as the runs which work locally so it's not access.
Any thoughts?
Thanks.
Tom