Need exit code from running remote PowerShell script

Need exit code from running remote PowerShell script it bellow is my script

Param(
   [Parameter(Position=1)]
   [string]$IPaddress,

   [Parameter(Position=2)]
   [string]$Clustername

)

$creds=import-clixml -Path /tmp/tent.xml
Invoke-Command -ComputerName $IPaddress -Authentication Negotiate -Credential $creds -FilePath \tmp\check_cluster_node.ps1 -ArgumentList $Clustername

Parents
  • What is the output when you run the commands interactively? does \tmp\check_cluster_node.ps1 produce any output? That script should NOT be using Write-Host as that does not get written to the output stream.

Reply
  • What is the output when you run the commands interactively? does \tmp\check_cluster_node.ps1 produce any output? That script should NOT be using Write-Host as that does not get written to the output stream.

Children
No Data