You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Add `Id` property to easily retrieve a record by either number or sysid.
4
+
- Add `ParentId` property to easily retrieve records based on the parent number or sysid. For example, to retrieve catalog tasks associated with a requested item execute `Get-ServiceNowRecord -Table 'Catalog Task' -ParentId RITM01234567`.
5
+
- Add `Description` property to retrieve records based on a table specific description field. For many tables this field will be short_description, but will be different for others. For example, when performing this against the 'User' table, the description field is 'Name'.
6
+
- Add ability to provide a known prefixed `Id` without providing `Table`, `Get-ServiceNowRecord -Id inc0010001`. To see the list of known prefixes, execute `$ServiceNowTable.NumberPrefix` after importing the module.
7
+
- Add alias `gsnr`. With the above change, a Get can be as simple as `gsnr inc0010001`.
8
+
- Add autocomplete for `Table` parameter in `Add-ServiceNowAttachment` and `Get-ServiceNowAttachment`.
9
+
- Add `Id` parameter to `Add-ServiceNowAttachment` and `Update-ServiceNowRecord` which accepts either number or sysid. Just as with `Get-ServiceNowRecord` you can now provide just `Id` if it has a known prefix.
10
+
- Add ability to `Get-ServiceNowAttachment` to get attachments either via associated record or directly from the attachments table when you want to search all attachments.
11
+
- Add advanced filtering and sorting functionality to `Get-ServiceNowAttachment` which can be really useful when searching across the attachments table.
12
+
- Convert access and refresh tokens in $ServiceNowSession from plain text to a credential for added security.
13
+
- Pipeline enhancements added in many places.
14
+
- Add Change Task and Attachments to formats.
15
+
-`Update-ServiceNowNumber` has been deprecated and the functionality has been added to `Update-ServiceNowRecord`. An alias has also been added so existing scripts do not break.
16
+
- Prep for removal of all `Get-` functions except for `Get-ServiceNowRecord` and `Get-ServiceNowAttachment`. Table specific Get functions have been deprecated. `Get-ServiceNowRecordInterim` has been created and all table specific Get functions have been aliased so existing scripts do not break. Please start to migrate to `Get-ServiceNowRecord` as these functions will all be deprecated in the near future.
17
+
- As communicated in v2.0, authentication cleanup has occurred. This involves removal of Credential/Url authentication in each function in favor of `ServiceNowSession`. You can still authenticate with Credential/Url, but must use `New-ServiceNowSession`. `Set-ServiceNowAuth`, `Remove-ServiceNowAuth`, and `Test-ServiceNowAuthIsSet` have been deprecated.
18
+
-***Breaking change:*** rename `Get-ServiceNowAttachmentDetail` to `Get-ServiceNowAttachment`.
19
+
-***Breaking change:*** rename `Get-ServiceNowAttachment` to `Export-ServiceNowAttachment`.
20
+
-***Breaking change:***`Get-ServiceNowTable` and `Get-ServiceNowTableEntry` have been deprecated. Use `Get-ServiceNowRecord`.
21
+
22
+
## 2.4.2
23
+
- Fix [#141](https://github.com/Snow-Shell/servicenow-powershell/issues/141), add `UseBasicParsing` to all API calls to keep AA from failing when IE hasn't been initialized
24
+
25
+
## 2.4.1
26
+
- Add `-IncludeCustomVariable` to `Get-ServiceNowRecord` to retrieve custom variables, eg. ritm form values, in addition to the standard fields. [#138](https://github.com/Snow-Shell/servicenow-powershell/discussions/138)
- Add grouping operators -and and -group as well as comparison operators -startwith and -endswith to `Get-ServiceNowRecord -Filter` to keep with the -operator standard
31
+
- Add tab ahead/completion for the `-Table` property in `Get-ServiceNowRecord`. This will allow you to cycle through the different tables the module is aware of. The values are the 'common' names, not table names so it's easier to understand for beginners. You can also provide any other table name ad hoc.
32
+
- Add Change Task to formatter and tab ahead
33
+
- Fix null index error when executing `New-ServiceNowQuery` without providing a value for `-Sort`
34
+
- Fix [#136](https://github.com/Snow-Shell/servicenow-powershell/issues/136) to account for PS v7.x Invoke-WebRequest response headers all being arrays
35
+
36
+
## 2.3.2
37
+
- Added ability to pipe to `Add-ServiceNowAttachment` and `Get-ServiceNowAttachmentDetail`. For example, `New-ServiceNowIncident @params -PassThru | Add-ServiceNowAttachment -File MyFile.txt`. This will create an incident and add an attachment in one step.
38
+
39
+
## 2.3.1
40
+
- Fix query operator -notin and -notlike which had a missing space
41
+
- Move verbose logging message in `Invoke-ServiceNowRestMethod` for number of records so it always shows. This is helpful when you change a filter and can see how many records would be returned without actually returning them.
42
+
43
+
## v2.3
44
+
- Add paging support to all `Get-` functions. Use `-First`, `-Skip`, and `-IncludeTotalCount` parameters. In support of this, api calls have been changed from Invoke-RestMethod to Invoke-WebRequest.
45
+
- Additional pipline support added for Table and SysId parameters to pipe `Get-` functions to `Update-` and `Remove-`.
46
+
-***Breaking change:*** deprecate `-Limit` parameter. The warning regarding deprecation went out over 2 years ago and now that paging has been implemented, it's a good time for this cleanup. Use `-First` instead.
47
+
- 'TableEntry' renamed to 'Record' for `New-`, `Update-`, and `Remove-` functions. Aliases added.
48
+
49
+
## v2.2
50
+
- Add advanced filtering and sorting. Initially implemented with `New-ServiceNowQuery` and `Get-ServiceNowRecord`. Filter with many different comparison operators as well as 'and', 'or', and 'group'ing. Sort ascending or descending against multiple fields. Comparison operators are the same as PowerShell for ease of use. Please use the GitHub Discussions section to provide feedback, thoughts, etc.
51
+
- Add `Get-ServiceNowRecord`. This function implements the new advanced filtering and sorting. As long as you know your table name, this can replace all other Get functions.
52
+
- Enumerate implemented tables and advanced filtering operators in a json config to easily manage going forward; make available via script scoped variables.
53
+
Be able to reference types from this config per table, removing the need to have separate Get functions for every table.
54
+
- Add type for catalog task
55
+
- Fix error when getting an empty result from the api and performing a type lookup
56
+
- Rename `RequestItem` to `RequestedItem` which is the actual name. Function aliases created.
57
+
58
+
## v2.1
59
+
- Add proxy support to `New-ServiceNowSession`, [#97](https://github.com/Snow-Shell/servicenow-powershell/issues/97).
60
+
61
+
## v2.0
62
+
- Although still in the module for backward compatibility, `Set-ServiceNowAuth` is being replaced with `New-ServiceNowSession`. With this comes OAuth support, removal of global variables, and much more folks have asked for. The ability to provide credentials directly to functions has been retained for this release, but will be deprecated in a future release in favor of using `New-ServiceNowSession`.
63
+
- Support for different api versions. `Set-ServiceNowAuth` will continue to use v1 of the api, but `New-ServiceNowSession` defaults to the latest. Check out the `-ApiVersion` parameter of `New-ServiceNowSession`.
64
+
-`Remove-ServiceNowAuth` has been retained for this release, but as global variables have been removed, there is no longer a need for it; it will always return `$true`. It will be removed in a future release.
65
+
-`-PassThru` added to remaining `Update-` and `New-` functions. Depending on your code, this may be a ***breaking change*** if you expected the result to be returned.
66
+
- Pipeline support added to many functions
67
+
- Standardizing on coding between all functions
68
+
69
+
## v1.8.1
70
+
- Update links to reference the new GitHub organization this project will be moved to. Module functionality unchanged.
71
+
72
+
## v1.8.0
73
+
- Add Update-ServiceNowRequestItem
74
+
- Fix switch statements by adding breaks to each condition
This PowerShell module provides a series of cmdlets for interacting with the [ServiceNow REST API](http://wiki.servicenow.com/index.php?title=REST_API), performed by wrapping `Invoke-RestMethod` for the API calls.
7
+
This PowerShell module provides a series of cmdlets for interacting with the [ServiceNow REST API](https://docs.servicenow.com/bundle/quebec-application-development/page/integrate/inbound-rest/concept/c_RESTAPI.html).
6
8
7
9
**IMPORTANT:** Neither this module nor its creator are in any way affiliated with ServiceNow.
8
10
9
-
## Version 1
11
+
## Version 2
10
12
11
-
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.
13
+
Building on the great work the community has done thus far, a lot of new updates with this release.
14
+
- Although still in the module for backward compatibility, `Set-ServiceNowAuth` is being replaced with `New-ServiceNowSession`. With this comes OAuth support, removal of global variables, and much more folks have asked for. The ability to provide credentials directly to functions has been retained for this release, but will be deprecated in a future release in favor of using `New-ServiceNowSession`.
15
+
- Support for different api versions. `Set-ServiceNowAuth` will continue to use v1 of the api, but `New-ServiceNowSession` defaults to the latest. Check out the `-ApiVersion` parameter of `New-ServiceNowSession`.
16
+
-`Remove-ServiceNowAuth` has been retained for this release, but as global variables have been removed, there is no longer a need for it; it will always return `$true`. It will be removed in a future release.
17
+
-`-PassThru` added to remaining `Update-` and `New-` functions. Depending on your code, this may be a ***breaking change*** if you expected the result to be returned.
18
+
- Pipeline support added to many functions
19
+
- Standardizing on coding between all functions
12
20
13
-
In addition to the name change the following high level changes have been made:
14
-
15
-
Back End:
16
-
17
-
* The module structure has been updated to individual files for each function.
18
-
* The build process has been migrated from MAKE to psake with support of the BuildHelpers module.
19
-
* Pester testing has been expanded to cover more scenarios.
The gains are marginal in some aspects, but intended to allow for better management in the future.
23
-
24
-
Front End:
25
-
26
-
* The following fields are now returned in the DateTime format instead of string: 'closed_at','expected_start','follow_up','opened_at','sys_created_on','sys_updated_on','work_end','work_start' [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].
27
-
* The formatting of returned data has been updated across all the `Get` functions except `Get-ServiceNowTable`. This means you'll see a handful of default properties returned and can use `Format-List` or `Select-Object` to view all other properties associated with the object.
28
-
29
-
These changes should improve your ability to filter on the right, especially by DateTime, as well as return more information in general.
21
+
***It is recommended to use `Get-ServiceNowRecord` instead of the other 'Get' functions.***
30
22
31
23
## Requirements
32
24
33
-
Requires PowerShell 3.0 or above as this is when `Invoke-RestMethod` was introduced.
25
+
Requires PowerShell 5.1 or above.
34
26
35
27
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:
36
28
@@ -40,46 +32,57 @@ Requires authorization in your ServiceNow tenant. Due to the custom nature of S
40
32
41
33
## Usage
42
34
43
-
Download the [latest release](https://github.com/Sam-Martin/servicenow-powershell/releases/latest) and extract the .psm1 and .psd1 files to your PowerShell profile directory (i.e. the `Modules` directory under wherever `$profile` points to in your PS console) and run:
44
-
`Import-Module ServiceNow`
45
-
Once you've done this, all the cmdlets will be at your disposal, you can see a full list using `Get-Command -Module ServiceNow`.
35
+
The ServiceNow module should be installed from the PowerShell Gallery with `install-module ServiceNow`.
36
+
37
+
### Creating a new session
46
38
47
-
### Example - Using Set-ServiceNowAuth
39
+
Creating a new session will create a script scoped variable `$ServiceNowSession` which will be used by default in other functions.
The URL should be the instance name portion of the FQDN for your instance. If you browse to `https://yourinstance.service-now.com` the URL required for the module is `yourinstance.service-now.com`.
50
+
Oauth authentication with user credential as well as application/client credential. The application/client credential can be found in the System OAuth->Application Registry section of ServiceNow.
51
+
```PowerShell
52
+
$params @{
53
+
Url = 'instance.service-now.com'
54
+
Credential = $userCred
55
+
ClientCredential = $clientCred
56
+
}
57
+
New-ServiceNowSession @params
58
+
```
54
59
55
-
### Example - Retrieving an Incident Containing the Word 'PowerShell'
60
+
All examples below assume a new session has already been created.
### Example - Creating a Incident with custom table entries
80
+
### Creating an Incident with custom table entries
78
81
79
82
```PowerShell
80
-
$IncidentParams = @{Caller = "UserName"
81
-
ShortDescription = "New PS Incident"
82
-
Description = "This incident was created from Powershell"
83
+
$IncidentParams = @{Caller = "UserName"
84
+
ShortDescription = "New PS Incident"
85
+
Description = "This incident was created from Powershell"
83
86
CustomFields = @{u_service = "MyService"
84
87
u_incident_type = "Request"}
85
88
}
@@ -92,43 +95,16 @@ The module can use the `Connection` parameter in conjunction with the included `
92
95
93
96
The `Connection` parameter accepts a hashtable object that requires a username, password, and ServiceNowURL.
94
97
95
-
## Functions
96
-
97
-
* Add-ServiceNowAttachment
98
-
* Get-ServiceNowAttachment
99
-
* Get-ServiceNowAttachmentDetail
100
-
* Get-ServiceNowChangeRequest
101
-
* Get-ServiceNowConfigurationItem
102
-
* Get-ServiceNowIncident
103
-
* Get-ServiceNowRequest
104
-
* Get-ServiceNowRequestItem
105
-
* Get-ServiceNowTable
106
-
* Get-ServiceNowTableEntry
107
-
* Get-ServiceNowUser
108
-
* Get-ServiceNowUserGroup
109
-
* New-ServiceNowChangeRequest
110
-
* New-ServiceNowIncident
111
-
* New-ServiceNowQuery
112
-
* New-ServiceNowTableEntry
113
-
* Remove-ServiceNowAttachment
114
-
* Remove-ServiceNowAuth
115
-
* Remove-ServiceNowTableEntry
116
-
* Set-ServiceNowAuth
117
-
* Test-ServiceNowAuthIsSet
118
-
* Update-ServiceNowChangeRequest
119
-
* Update-ServiceNowIncident
120
-
* Update-ServiceNowNumber
121
-
* Update-ServiceNowRequestItem
122
-
* Update-ServiceNowTableEntry
123
-
124
98
## Tests
125
99
126
-
This module comes with [Pester](https://github.com/pester/Pester/) tests for unit testing.
100
+
This module comes with limited [Pester](https://github.com/pester/Pester/) tests for unit testing.
127
101
128
102
## Scope & Contributing
129
103
130
-
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.
104
+
Contributions are gratefully received, so please feel free to submit a pull request with additional features or amendments.
0 commit comments