I have to execute the below script thru an Integration Tool Mulesoft. Unfortunately the switch parameter Confirm is throwing an error. The same script works from the powershell command line. Below is the command to execute:
Set-Location -Path 'C:\Windows\System32\WindowsPowerShell\v1.0\';powershell.exe -ExecutionPolicy RemoteSigned -noprofile -noninteractive ". 'C:\Program Files\Microsoft\Exchange Server\V15\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto; Disable-MailUser -Identity abc.com/PEOPLE/xyzpqr -Confirm:$false"
Operation in flow:
<powershell:execute-command-exception-handling-enabled doc:name="Execute command (exception handling enabled)" doc:id="79bd2451-9441-49e7-8517-3bbd6a151fae" config-ref="Powershell_Configuration" command="Set-Location -Path 'C:\Windows\System32\WindowsPowerShell\v1.0\';powershell.exe -ExecutionPolicy RemoteSigned -noprofile -noninteractive ". 'C:\Program Files\Microsoft\Exchange Server\V15\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto; Disable-MailUser -Identity abc.com/PEOPLE/xyzpqr -Confirm:$false""/>
The error is as below
Message : A positional parameter cannot be found that accepts argument '-Confirm:False'.
+ CategoryInfo : InvalidArgument: (:) [Disable-MailUser], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Disable-MailUser
Our PS version is 5.1 Any help would be greatly appreciated I tried