Make Servicenow Soap Calls With Powershell

under Programming PowerShell ServiceNow


The following PS script shows how to query ServiceNow via SOAP calls, using the WebServiceProxy object. View their Wiki for more examples of service methods

$username = "XXXXXXXXXX"
$password = "YYYYYYYYYY"
$instance = "ZZZZZZZZZZ"
$cred = New-Object System.Management.Automation.PSCredential -ArgumentList @($username,(ConvertTo-SecureString -String $password -AsPlainText -Force))
$sn = New-WebServiceProxy -Uri "https://$" Credential $cred
#get autogenerated namespace
$type = $sn.GetType().Namespace
# Get a single record by sys_id
#$get = new-object ($type + '.get')
#Get records that match values
#$getRecords = new-object ($type + '.getRecords')