Skip to content

Commit fdb79a1

Browse files
committed
prep for release, help updates
1 parent cbe034c commit fdb79a1

File tree

6 files changed

+59
-16
lines changed

6 files changed

+59
-16
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## v2.0
2+
- 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`.
3+
- 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`.
4+
- `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.
5+
- `-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.
6+
- Pipeline support added to many functions
7+
- Standardizing on coding between all functions
8+
19
## v1.8.1
210
- Update links to reference the new GitHub organization this project will be moved to. Module functionality unchanged.
311

Readme.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ This PowerShell module provides a series of cmdlets for interacting with the [Se
66

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

9+
## Version 2
10+
11+
Building on the great work the community has done thus far, a lot of new updates with this release.
12+
- 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`.
13+
- 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`.
14+
- `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.
15+
- `-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.
16+
- Pipeline support added to many functions
17+
- Standardizing on coding between all functions
18+
919
## Version 1
1020

1121
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.
@@ -108,12 +118,11 @@ The `Connection` parameter accepts a hashtable object that requires a username,
108118
* Get-ServiceNowUserGroup
109119
* New-ServiceNowChangeRequest
110120
* New-ServiceNowIncident
121+
* New-ServiceNowSession
111122
* New-ServiceNowQuery
112123
* New-ServiceNowTableEntry
113124
* Remove-ServiceNowAttachment
114-
* Remove-ServiceNowAuth
115125
* Remove-ServiceNowTableEntry
116-
* Set-ServiceNowAuth
117126
* Test-ServiceNowAuthIsSet
118127
* Update-ServiceNowChangeRequest
119128
* Update-ServiceNowIncident

ServiceNow/Public/Get-ServiceNowChangeRequest.ps1

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,48 +4,48 @@ function Get-ServiceNowChangeRequest {
44
Param(
55
# Machine name of the field to order by
66
[Parameter()]
7-
[string]$OrderBy = 'opened_at',
7+
[string] $OrderBy = 'opened_at',
88

99
# Direction of ordering (Desc/Asc)
1010
[Parameter()]
1111
[ValidateSet('Desc', 'Asc')]
12-
[string]$OrderDirection = 'Desc',
12+
[string] $OrderDirection = 'Desc',
1313

1414
# Maximum number of records to return
1515
[Parameter()]
16-
[int]$Limit,
16+
[int] $Limit,
1717

1818
# Fields to return
1919
[Parameter()]
2020
[Alias('Fields')]
21-
[string[]]$Properties,
21+
[string[]] $Properties,
2222

2323
# Hashtable containing machine field names and values returned must match exactly (will be combined with AND)
2424
[Parameter()]
25-
[hashtable]$MatchExact = @{},
25+
[hashtable] $MatchExact = @{},
2626

2727
# Hashtable containing machine field names and values returned rows must contain (will be combined with AND)
2828
[Parameter()]
29-
[hashtable]$MatchContains = @{},
29+
[hashtable] $MatchContains = @{},
3030

3131
# Whether or not to show human readable display values instead of machine values
3232
[Parameter()]
3333
[ValidateSet('true', 'false', 'all')]
34-
[string]$DisplayValues = 'true',
34+
[string] $DisplayValues = 'true',
3535

3636
[Parameter(ParameterSetName = 'SpecifyConnectionFields', Mandatory)]
3737
[ValidateNotNullOrEmpty()]
3838
[Alias('ServiceNowCredential')]
39-
[PSCredential]$Credential,
39+
[PSCredential] $Credential,
4040

4141
[Parameter(ParameterSetName = 'SpecifyConnectionFields', Mandatory)]
4242
[ValidateScript( { $_ | Test-ServiceNowURL })]
4343
[Alias('Url')]
44-
[string]$ServiceNowURL,
44+
[string] $ServiceNowURL,
4545

4646
[Parameter(ParameterSetName = 'UseConnectionObject', Mandatory)]
4747
[ValidateNotNullOrEmpty()]
48-
[hashtable]$Connection,
48+
[hashtable] $Connection,
4949

5050
[Parameter(ParameterSetName = 'Session')]
5151
[ValidateNotNullOrEmpty()]

ServiceNow/Public/New-ServiceNowSession.ps1

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Create a new ServiceNow session
66
Create a new ServiceNow session via credentials, OAuth, or access token.
77
This session will be used by default for all future calls.
88
Optionally, you can specify the api version you'd like to use; the default is the latest.
9+
To use OAuth, ensure you've set it up, https://docs.servicenow.com/bundle/quebec-platform-administration/page/administer/security/task/t_SettingUpOAuth.html.
910
1011
.PARAMETER Url
1112
Base domain for your ServiceNow instance, eg. tenant.domain.com
@@ -25,6 +26,31 @@ Specific API version to use. The default is the latest.
2526
.PARAMETER PassThru
2627
Provide the resulting session object to the pipeline as opposed to setting as a script scoped variable to be used by default for other calls.
2728
This is useful if you want to have multiple sessions with different api versions, credentials, etc.
29+
30+
.EXAMPLE
31+
New-ServiceNowSession -Url tenant.domain.com -Credential $mycred
32+
Create a session using basic authentication and save it to a script-scoped variable
33+
34+
.EXAMPLE
35+
New-ServiceNowSession -Url tenant.domain.com -Credential $mycred -ClientCredential $myClientCred
36+
Create a session using OAuth and save it to a script-scoped variable
37+
38+
.EXAMPLE
39+
New-ServiceNowSession -Url tenant.domain.com -AccessToken 'asdfasd9f87adsfkksk3nsnd87g6s'
40+
Create a session with an existing access token and save it to a script-scoped variable
41+
42+
.EXAMPLE
43+
$session = New-ServiceNowSession -Url tenant.domain.com -Credential $mycred -ClientCredential $myClientCred -PassThru
44+
Create a session using OAuth and save it as a local variable to be provided to functions directly
45+
46+
.INPUTS
47+
None
48+
49+
.OUTPUTS
50+
Hashtable if -PassThru provided
51+
52+
.LINK
53+
https://docs.servicenow.com/bundle/quebec-platform-administration/page/administer/security/reference/r_OAuthAPIRequestParameters.html
2854
#>
2955
function New-ServiceNowSession {
3056

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
function Test-ServiceNowAuthIsSet{
2-
if($script:ServiceNowSession.Credential){
3-
return $true;
2+
if ( $ServiceNowSession.Credential -or $ServiceNowSession.AccessToken ){
3+
return $true
44
}else{
5-
return $false;
5+
return $false
66
}
77
}

ServiceNow/ServiceNow.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
RootModule = 'ServiceNow.psm1'
66

77
# Version number of this module.
8-
ModuleVersion = '1.8.1'
8+
ModuleVersion = '2.0.0'
99

1010
# ID used to uniquely identify this module
1111
GUID = 'b90d67da-f8d0-4406-ad74-89d169cd0633'

0 commit comments

Comments
 (0)