4 Replies Latest reply on Mar 17, 2015 12:18 PM by richard mcleod

    PowerShell command from BSA NshScript

    Mateusz Skrzynski

      hello,

      I try to execute PowerShell commands from BSA NshScript and for some reason I got error.

      I dont really understand how to "hide" power shell commands from beeing seen by NSH. I assume that NSH tryies to use Where-Object.

       

       

      PowerShell Command

       

      AgentFqdn=$4
      nexec $ScomServer cmd /c "Powershell.exe -InputFormat none -executionpolicy bypass (Get-Content \$env:windir\system32\drivers\etc\hosts) | (Where-Object {\$_ -notmatch "/ "$AgentFqdn"})"
      

       

      THX For help