Function to quickly see if MarkLogic is up and running
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
function PingMarkLogic($server) { $uri = "http://$($server):8001/cluster-status.xqy" $adminCredential = new-object -typename System.Management.Automation.PSCredential -argumentlist "admin", $(ConvertTo-SecureString "admin" -Force -AsPlainText) try { $resp1 = Invoke-WebRequest -Uri $Uri -Method "GET" -Credential $adminCredential -ContentType "application/x-www-form-urlencoded" -ErrorAction SilentlyContinue return $resp1.StatusCode } catch [System.Net.WebException] { return $resp1.StatusCode } } |
Taken from my unsuccessful StackOverflow answer 🙂