Last active
March 31, 2020 04:09
-
-
Save belotn/5404601 to your computer and use it in GitHub Desktop.
Script to check the Citrix XML Services
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@(MyXMLServerList)| select @{N="Server";E={$_}},@{N="State";E={ | |
$url="http://${_}:8085/scripts/wpnbr.dll" | |
$data = '<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE NFuseProtocol SYSTEM "NFuse.dtd"> | |
<NFuseProtocol version="4.1"> | |
<RequestAddress> | |
<Flags>no-load-bias</Flags> | |
<Name> | |
<AppName>MyApp</AppName> | |
</Name> | |
</RequestAddress> | |
</NFuseProtocol>' | |
[System.Net.WebRequest]$webRequest = [System.Net.WebRequest]::Create($url) | |
$webRequest.ServicePoint.Expect100Continue = $false | |
$webRequest.ContentType ="text/xml" | |
$webRequest.Method = "POST" | |
$enc = [System.Text.Encoding]::GetEncoding($codePageName) | |
[byte[]]$bytes = $enc.GetBytes($data) | |
$webRequest.ContentLength = $bytes.Length | |
[System.IO.Stream]$reqStream = $webRequest.GetRequestStream() | |
$reqStream.Write($bytes, 0, $bytes.Length) | |
$reqStream.Flush() | |
$resp = $webRequest.GetResponse() | |
$rs = $resp.GetResponseStream() | |
[System.IO.StreamReader]$sr = New-Object System.IO.StreamReader -argumentList $rs | |
@{$true="Success";$false="Failed"}[ $sr.ReadToEnd() -match 'TicketTag'] | |
}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment