Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Sharepoint 2013 Powershell run from .bat file via CA ESP

$
0
0

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




Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>