0
votes

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
1

1 Answers

0
votes

The $errorActionPreference should be defined inside the scriptblock like:

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