简体   繁体   中英

When running a powershell script via Jenkins getting this error : "NativeCommandError" not sure how to use invoke-command

Ignoring an errorlevel != 0 in Windows PowerShell (ISE)

I have read this link but not sure how to run "Invoke-Command" my $ErrorActionPreference is "continue".

This is the error I am getting :

06:06:55  + & powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command '& ''E: ...
06:06:55  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
06:06:55      + CategoryInfo          : NotSpecified: (root : 2020-10-...something:String) [], RemoteException
06:06:55      + FullyQualifiedErrorId : NativeCommandError

$errorActionPreference应该在$errorActionPreference中定义,如:

Invoke-Command {$ErrorActionPreference = 'SilentlyContinue'; REST OF THE CODE}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM