by Sam-Martin

This PowerShell module provides a series of cmdlets for interacting with the ServiceNow REST API

227 Stars 131 Forks Last release: about 1 year ago (v1.8.0) Apache License 2.0 265 Commits 19 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:


GitHub release GitHub license Test Coverage

This PowerShell module provides a series of cmdlets for interacting with the ServiceNow REST API, performed by wrapping

for the API calls.

IMPORTANT: Neither this module nor its creator are in any way affiliated with ServiceNow.

Version 1

The module has been renamed from PSServiceNow to ServiceNow for version 1. This change moves us away from the reserved "PS" prefix. Since the name change is a major change for the user base and the project was never incremented to v1 we've taken the opportunity to label it such.

In addition to the name change the following high level changes have been made:

Back End:

  • The module structure has been updated to individual files for each function.
  • The build process has been migrated from MAKE to psake with support of the BuildHelpers module.
  • Pester testing has been expanded to cover more scenarios.
  • Improved code formatting, removed aliases, fixed file encoding.

The gains are marginal in some aspects, but intended to allow for better management in the future.

Front End:

  • The following fields are now returned in the DateTime format instead of string: 'closedat','expectedstart','followup','openedat','syscreatedon','sysupdatedon','workend','workstart' [v1.0.1 Update: This process now attempts to format the property as DateTime based off your local culture settings, a universal
    yyyy-MM-dd HH:mm:ss
    format, and finally leaves the property as a string if those two convert attempts fail].
  • The formatting of returned data has been updated across all the
    functions except
    . This means you'll see a handful of default properties returned and can use
    to view all other properties associated with the object.

These changes should improve your ability to filter on the right, especially by DateTime, as well as return more information in general.


Requires PowerShell 3.0 or above as this is when

was introduced.

Requires authorization in your ServiceNow tenant. Due to the custom nature of ServiceNow your organization may have REST access restricted. The following are some tips to ask for if you're having to go to your admin for access:

  • Out of the box tables should be accessible by granting the
  • Custom tables may require adjustments to the ACL.
  • The
    role may also be an option.


Download the latest release and extract the .psm1 and .psd1 files to your PowerShell profile directory (i.e. the

directory under wherever
points to in your PS console) and run:
Import-Module ServiceNow
Once you've done this, all the cmdlets will be at your disposal, you can see a full list using
Get-Command -Module ServiceNow

Example - Using Set-ServiceNowAuth

Set-ServiceNowAuth -url -Credentials (Get-Credential)

The URL should be the instance name portion of the FQDN for your instance. If you browse to
the URL required for the module is

Example - Retrieving an Incident Containing the Word 'PowerShell'

Import-Module ServiceNow
Get-ServiceNowIncident -MatchContains @{short_description='PowerShell'}

Example - Retrieving an Incident Containing the Word 'PowerShell' While Passing Authentication

Import-Module ServiceNow
Get-ServiceNowIncident -MatchContains @{short_description='PowerShell'} -ServiceNowCredential $PSCredential -ServiceNowURL $ServiceNowURL

Example - Update a Ticket

$Incident = Get-ServiceNowIncident -Limit 1 -MatchContains @{short_description='PowerShell'}
Update-ServiceNowIncident -SysID $Incident.Sys_ID -Values @{comments='Updated via PowerShell'}

Example - Creating a Incident with custom table entries

$IncidentParams = @{Caller = "UserName" 
            ShortDescription = "New PS Incident" 
            Description = "This incident was created from Powershell" 
            CustomFields = @{u_service = "MyService"
                            u_incident_type = "Request"}
New-ServiceNowIncident @Params

Azure Connection Object (Automation Integration Module Support)

The module can use the

parameter in conjunction with the included
file for use as an Azure automation integration module. Details of the process is available at Authoring Integration Modules for Azure Automation.


parameter accepts a hashtable object that requires a username, password, and ServiceNowURL.


  • Add-ServiceNowAttachment
  • Get-ServiceNowAttachment
  • Get-ServiceNowAttachmentDetail
  • Get-ServiceNowChangeRequest
  • Get-ServiceNowConfigurationItem
  • Get-ServiceNowIncident
  • Get-ServiceNowRequest
  • Get-ServiceNowRequestItem
  • Get-ServiceNowTable
  • Get-ServiceNowTableEntry
  • Get-ServiceNowUser
  • Get-ServiceNowUserGroup
  • New-ServiceNowChangeRequest
  • New-ServiceNowIncident
  • New-ServiceNowQuery
  • New-ServiceNowTableEntry
  • Remove-ServiceNowAttachment
  • Remove-ServiceNowAuth
  • Remove-ServiceNowTableEntry
  • Set-ServiceNowAuth
  • Test-ServiceNowAuthIsSet
  • Update-ServiceNowChangeRequest
  • Update-ServiceNowIncident
  • Update-ServiceNowNumber
  • Update-ServiceNowRequestItem
  • Update-ServiceNowTableEntry


This module comes with Pester tests for unit testing.

Scope & Contributing

This module has been created as an abstraction layer to suit my immediate requirements. Contributions are gratefully received however, so please feel free to submit a pull request with additional features or amendments.


Author:: Sam Martin

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.