Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Unhandled Exception: System.FormatException->Powershell calling remote batch file

$
0
0

I have a powershell command in a SQL job to call a remote batch file.

$sess=New-PSSession -ComputerName 'STVANFSS02.fnha.local' ;
invoke-command -scriptblock {C:\Scripts\FNPST\StartAppBat_Server_PST2.bat} -Session $sess ;
Remove-PSSession $sess;

When run it gives the following:

Executed as user: FNHA\SVC_PSInstall. The job script encountered the following errors. These errors did not stop the script:   Unhandled Exception: System.FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.     at System.Text.StringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args)     at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)     at System.String.Format(IFormatProvider provider, String format, Object[] args)     at Microsoft.SqlServer.Management.PowerShell.SqlPowerShell.GetErrorRecordMessage(ErrorRecord errorRecord)     at Microsoft.SqlServer.Management.PowerShell.SqlPowerShell.HandleAgentJob(RunspaceConfiguration config)     at Microsoft.SqlServer.Management.PowerShell.SqlPowerShell.Main(String[] args).  Process Exit Code -532462766.  The step failed.

Appreciate insight.


Viewing all articles
Browse latest Browse all 21975

Latest Images

Trending Articles



Latest Images

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