This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

PS Script Fails Randomly

We are having these issues where our PS script runs successfully but would fail every once in a while.  It will fail but when we look at the logs, it runs successfully.  Now the script is going out to multiple servers and is being ran from our PP and AP's. The PS script that runs on the pollers calls an executable on another server.  My question is the following

1.  is it good practice to run PS scripts from your pollers?

2.   Are there any issues with the PS script below that would cause the random failures? 

$port="4635"

#XXX Name is fully qualified

$XXXname = "xxxxx"

#App Name is the directory where it will be running from.

$appname = "xxxxx"

$cred=Get-Credential ${CREDENTIAL}

$start = Get-Date -f o

"Begin $start" | Out-file d:\Advent\Geneva\$appname\genevaapi.log

cmd /c "d:\Advent\Geneva\$appname\AppServerSoap.exe" $cred.Username $cred.GetNetworkCredential().password $aganame  $port >> d:\Advent\Geneva\$appname\genevaapi.log

$finish = Get-Date -f o

"End $finish" | Out-file -Append  d:\Advent\Geneva\$appname\genevaapi.log

# Add Sleep State

sleep 5

# Search string should be GenevaModel

$test = Select-String -Pattern "GenevaModel" -Path d:\Advent\Geneva\$appname\genevaapi.log

if($test.count -eq 0)

{

  Write-Host "Portfolio Not Found"

  exit(1)

}

else

{

  Write-Host "Statistic: 0"

}

Any help is appreciated.