Skip to content

Commit 6969427

Browse files
authored
Merge pull request #142 from Snow-Shell/fix-141
add UseBasicParsing
2 parents ef18db7 + 84db07d commit 6969427

File tree

6 files changed

+17
-7
lines changed

6 files changed

+17
-7
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 2.4.2
2+
- 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
3+
14
## 2.4.1
25
- 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)
36

ServiceNow/Private/Invoke-ServiceNowRestMethod.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ function Invoke-ServiceNowRestMethod {
8484

8585
$params.Method = $Method
8686
$params.ContentType = 'application/json'
87+
$params.UseBasicParsing = $true
8788

8889
if ( $Table ) {
8990
# table can either be the actual table name or class name

ServiceNow/Public/Add-ServiceNowAttachment.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ Function Add-ServiceNowAttachment {
130130
$invokeRestMethodSplat = $auth
131131
$invokeRestMethodSplat.Uri += '/attachment/file?table_name={0}&table_sys_id={1}&file_name={2}' -f $Table, $sysId, $FileData.Name
132132
$invokeRestMethodSplat.Headers += @{'Content-Type' = $ContentType }
133+
$invokeRestMethodSplat.UseBasicParsing = $true
133134
$invokeRestMethodSplat += @{
134135
Method = 'POST'
135136
InFile = $FileData.FullName

ServiceNow/Public/Get-ServiceNowAttachment.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ Function Get-ServiceNowAttachment {
107107

108108
# URI format: https://tenant.service-now.com/api/now/attachment/{sys_id}/file
109109
$params.Uri += '/attachment/' + $SysID + '/file'
110+
$params.UseBasicParsing = $true
110111

111112
If ($AppendNameWithSysID.IsPresent) {
112113
$FileName = "{0}_{1}{2}" -f [io.path]::GetFileNameWithoutExtension($FileName),

ServiceNow/Public/New-ServiceNowSession.ps1

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ function New-ServiceNowSession {
108108

109109
if ( $ApiVersion -le 0 ) {
110110
$version = ''
111-
} else {
111+
}
112+
else {
112113
$version = ('/v{0}' -f $ApiVersion)
113114
}
114115

@@ -127,23 +128,25 @@ function New-ServiceNowSession {
127128
switch -Wildcard ($PSCmdLet.ParameterSetName) {
128129
'OAuth*' {
129130
$params = @{
130-
Uri = 'https://{0}/oauth_token.do' -f $Url
131-
Body = @{
131+
Uri = 'https://{0}/oauth_token.do' -f $Url
132+
Body = @{
132133
'grant_type' = 'password'
133134
'client_id' = $ClientCredential.UserName
134135
'client_secret' = $ClientCredential.GetNetworkCredential().Password
135136
'username' = $Credential.UserName
136137
'password' = $Credential.GetNetworkCredential().Password
137138
}
138-
Method = 'Post'
139+
Method = 'Post'
140+
UseBasicParsing = $true
139141
}
140142

141143
# need to add this manually here, in addition to above, since we're making a rest call before our session is created
142144
if ( $PSBoundParameters.ContainsKey('Proxy') ) {
143145
$params.Add('Proxy', $Proxy)
144146
if ( $PSBoundParameters.ContainsKey('ProxyCredential') ) {
145147
$params.Add('ProxyCredential', $ProxyCredential)
146-
} else {
148+
}
149+
else {
147150
$params.Add('ProxyUseDefaultCredentials', $true)
148151
}
149152
}
@@ -196,7 +199,8 @@ function New-ServiceNowSession {
196199

197200
if ( $PassThru ) {
198201
$newSession
199-
} else {
202+
}
203+
else {
200204
$Script:ServiceNowSession = $newSession
201205
}
202206
}

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 = '2.4.1'
8+
ModuleVersion = '2.4.2'
99

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

0 commit comments

Comments
 (0)