Get-GhServerInfo.ps1
$GhServerUri = 'http://gh-srvcore-vm:443/json' $Random = (Get-Random).ToString() $Md5 = new-object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider $Utf8 = new-object -TypeName System.Text.UTF8Encoding $ClientID = ([System.BitConverter]::ToString($Md5.ComputeHash($Utf8.GetBytes($Random)))).Replace('-', '') $Username = 'admin' $Password = 'admin' $UsernameExt = $ClientID + '-' + $Username $Authorizatioin = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $UsernameExt,$Password))) $GhResult = Invoke-RestMethod -Method Post -UserAgent 'PowerShell' -ContentType 'application/json' -Uri $GhServerUri -Body '{"version":"1.1", "method": "RpcInfo.GetServerInfo", "params": [true]}' -Headers @{Authorization=($Authorizatioin)} $GhResult.Result |