Forum Discussion

AngryCat_52750's avatar
AngryCat_52750
Icon for Nimbostratus rankNimbostratus
Nov 27, 2013

Powershell Error

We have a automated job to enable and disable a nodes in a pool.. i am using the ps1 from here - LINK

 

Passing the following params -

 

powershell.exe -noexit C:\Temp\icontrol\test.ps1 10.10.10.11 admin password pool_server 10.10.10.13:80 disable

 

powershell.exe -noexit C:\Temp\icontrol\test.ps1 10.10.10.11 admin password pool_server 10.10.10.13:80 enable

 

when running through the disabled, i get the following weird error,

 

Disabling Session Enabled State...
Waiting for current connections to drop to zero...
Current Connections: 0
Disabling Monitor State...
Exception calling "set_monitor_state" with "2" argument(s): "Client found respo
nse content type of 'text/html; charset=iso-8859-1', but expected 'text/xml'.
The request failed with the error message:
--


500 Internal Server Error

Internal Server Error
The server encountered an internal error or
misconfiguration and was unable to complete
your request.
Please contact the server administrator,
 support@f5.com and inform them of the time the error occurred,
and anything you might have done that may have
caused the error.
More information about this error may be available
in the server error log.

--."
At E:\icontrol\test.ps1:212 char:56
+   (Get-F5.iControl).LocalLBPoolMember.set_monitor_state <<<< ( (, $pool_name)
, $MemberMonitorStateAofA);
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

Write-Host : The OS handle's position is not what FileStream expected. Do not u
se a handle simultaneously in one FileStream and in Win32 code or another FileS
tream. This may cause data loss.
At E:\icontrol\test.ps1:100 char:17
+       Write-Host <<<<  "Pool $pool_name, Member ${member_addr}:${member_port}
 status:"
    + CategoryInfo          : NotSpecified: (:) [Write-Host], IOException
    + FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Comma 
   nds.WriteHostCommand

Write-Host : The OS handle's position is not what FileStream expected. Do not u
se a handle simultaneously in one FileStream and in Win32 code or another FileS
tream. This may cause data loss.
At E:\icontrol\test.ps1:101 char:17
+       Write-Host <<<<  "  Availability : $Availability"
    + CategoryInfo          : NotSpecified: (:) [Write-Host], IOException
    + FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Comma 
   nds.WriteHostCommand

Write-Host : The OS handle's position is not what FileStream expected. Do not u
se a handle simultaneously in one FileStream and in Win32 code or another FileS
tream. This may cause data loss.
At E:\icontrol\test.ps1:102 char:17
+       Write-Host <<<<  "  Enabled      : $Enabled"
    + CategoryInfo          : NotSpecified: (:) [Write-Host], IOException
    + FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Comma 
   nds.WriteHostCommand

Write-Host : The OS handle's position is not what FileStream expected. Do not u
se a handle simultaneously in one FileStream and in Win32 code or another FileS
tream. This may cause data loss.
At E:\icontrol\test.ps1:103 char:17
+       Write-Host <<<<  "  Description  : $Description"
    + CategoryInfo          : NotSpecified: (:) [Write-Host], IOException
    + FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Comma 
   nds.WriteHostCommand

the enable portion works just fine -

 

Setting Montior State to Enabled
Setting Session Enabled State to Enabled
Pool pool_server, Member 10.10.10.13:80 status:
  Availability : AVAILABILITY_STATUS_BLUE
  Enabled      : ENABLED_STATUS_ENABLED
  Description  : Pool member does not have service checking enabled

Any ideas or clues anyone???

 

  • Not sure what would cause that. It couldn't be the sample code - since I wrote it B-)... I see several odd things. 1. the output goes directly from "Disabling Monitor State..." to the exception. There were some other textual outputs before the set_monitor_state() method is called. Did you just truncate the output? 2. The PowerShell "OS handle" errors seem odd as I haven't seen that before. Are you running this from a 3rd party tool that doesn't allow Write-Host?
  • Joe, We have our automation tool run it from a Win2003 server where we run all our enterprise automation.. the failure is so random. last night it error with the following - Echo Off Initialize-F5.iControl : Client found response content type of 'text/html; char set=iso-8859-1', but expected 'text/xml'. The request failed with the error message: -- 500 Internal Server Error Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

     

    Please contact the server administrator, support@f5.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

     

    More information about this error may be available in the server error log.

     

    --. At E:\icontrol\qatest.ps1:226 char:36 + $success = Initialize-F5.iControl <<<< -HostName $g_bigip -Username $g_uid -Password $g_pwd; + CategoryInfo : OpenError: (error:String) [Initialize-F5.iContro l], InvalidOperationException + FullyQualifiedErrorId : 2,iControlSnapIn.CmdLet.Global.InitializeiContro l E:\icontrol\qatest.ps1 : ERROR: iControl subsystem not initialized At line:1 char:24 + E:\icontrol\qatest.ps1 <<<< 10.10.10.1 operations test123 Pool_server_Switch 10.10.100.5:80 enable + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorExcep tion + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorExceptio n,qatest.ps1 and when we re-run the job, it works fine...
  • we want to be able to automated a couple of other jobs but we need to figure out this error first.. for some, the "just re-run the job" isnt good enough..

     

    We have run this job 100 times in Dev and QA without ONE error but when it runs during its normal times, it fails about once a week...