Skip to content

Commit 5d1ec67

Browse files
authored
Merge pull request #4 from Rick-2CA/master
v0.1.5 Release Candidate
2 parents df743bc + ae80e18 commit 5d1ec67

File tree

5 files changed

+10
-63
lines changed

5 files changed

+10
-63
lines changed

MAKE.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ $PackageFilePatternExclusions = @(
6666

6767
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
6868

69-
$Version = "0.1.2"
69+
$Version = "0.1.5"
7070
$ModuleName = "PSServiceNow"
7171
$PackageName = "$ModuleName-v$($version).zip";
7272

PSServiceNow-Tables.psm1

Lines changed: 5 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ function New-ServiceNowTableEntry{
156156
Untested
157157
#>
158158
function Remove-ServiceNowTableEntry{
159-
[CmdletBinding(ConfirmImpact='High')]
159+
[CmdletBinding(ConfirmImpact='High')]
160160
Param(
161161
# sys_id of the entry we're deleting
162162
[parameter(mandatory=$true)]
@@ -191,58 +191,7 @@ function Remove-ServiceNowTableEntry{
191191
$Connection
192192
)
193193

194-
#Get credential and ServiceNow REST URL
195-
if ($Connection -ne $null)
196-
{
197-
$ConnectionInfo = Get-ConnectionInfo -Connection $Connection
198-
}
199-
elseif ($ServiceNowCredential -ne $null -and $ServiceNowURL -ne $null)
200-
{
201-
$ConnectionInfo = Get-ConnectionInfo -ServiceNowCredential $ServiceNowCredential -ServiceNowURL $ServiceNowURL
202-
}
203-
else
204-
{
205-
$ConnectionInfo = Get-ConnectionInfo -UseGlobalAuth $true
206-
}
207-
208-
209-
# Fire and return
210-
$Uri = $ConnectionInfo["URL"] + "/table/$Table/$SysID"
211-
return (Invoke-RestMethod -Uri $uri -Method Delete -Credential $ConnectionInfo["Credential"] -Body $Body -ContentType "application/json" -UseBasicParsing).result
212-
}
213-
214-
215-
function Get-ConnectionInfo
216-
{
217-
[OutputType([HashTable])]
218-
param (
219-
# Credential used to authenticate to ServiceNow
220-
[Parameter(ParameterSetName='SpecifyConnectionFields', Mandatory=$True)]
221-
[ValidateNotNullOrEmpty()]
222-
[PSCredential]
223-
$ServiceNowCredential,
224-
225-
# The URL for the ServiceNow instance being used
226-
[Parameter(ParameterSetName='SpecifyConnectionFields', Mandatory=$True)]
227-
[ValidateNotNullOrEmpty()]
228-
[string]
229-
$ServiceNowURL,
230-
231-
#Azure Automation Connection object containing username, password, and URL for the ServiceNow instance
232-
[Parameter(ParameterSetName='UseConnectionObject', Mandatory=$True)]
233-
[ValidateNotNullOrEmpty()]
234-
[Hashtable]
235-
$Connection,
236-
237-
[Parameter(ParameterSetName='SetGlobalAuth', Mandatory=$True)]
238-
[ValidateNotNullOrEmpty()]
239-
[Bool]
240-
$UseGlobalAuth
241-
242-
)
243-
244-
245-
#Get credential and ServiceNow REST URL
194+
#Get credential and ServiceNow REST URL
246195
if ($Connection -ne $null)
247196
{
248197
$SecurePassword = ConvertTo-SecureString $Connection.Password -AsPlainText -Force
@@ -264,9 +213,7 @@ function Get-ConnectionInfo
264213
throw "Exception: You must do one of the following to authenticate: `n 1. Call the Set-ServiceNowAuth cmdlet `n 2. Pass in an Azure Automation connection object `n 3. Pass in an endpoint and credential"
265214
}
266215

267-
$Connectioninfo = @{}
268-
$ConnectionInfo.Add("Credential", $ServiceNowCredential)
269-
$Connectioninfo.Add("URL", $ServiceNowURL)
270-
271-
return $Connectioninfo
216+
# Fire and return
217+
$Uri = $ServiceNowURL + "/table/$Table/$SysID"
218+
return (Invoke-RestMethod -Uri $uri -Method Delete -Credential $ServiceNowCredential -Body $Body -ContentType "application/json").result
272219
}

PSServiceNow-Users.psm1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function Get-ServiceNowUserGroup{
8989

9090
# Set the default property set for the table view
9191
$DefaultProperties = @('name', 'email', 'sys_id')
92-
$DefaultDisplayPropertySet = New-Object System.Management.Automation.PSPropertySet(DefaultDisplayPropertySet,[string[]]$DefaultProperties)
92+
$DefaultDisplayPropertySet = New-Object System.Management.Automation.PSPropertySet('DefaultDisplayPropertySet',[string[]]$DefaultProperties)
9393
$PSStandardMembers = [System.Management.Automation.PSMemberInfo[]]@($DefaultDisplayPropertySet)
9494
$Result | Add-Member MemberSet PSStandardMembers $PSStandardMembers
9595
return $result
@@ -181,7 +181,7 @@ function Get-ServiceNowUser{
181181

182182
# Set the default property set for the table view
183183
$DefaultProperties = @('name', 'email', 'sys_id')
184-
$DefaultDisplayPropertySet = New-Object System.Management.Automation.PSPropertySet(DefaultDisplayPropertySet,[string[]]$DefaultProperties)
184+
$DefaultDisplayPropertySet = New-Object System.Management.Automation.PSPropertySet('DefaultDisplayPropertySet',[string[]]$DefaultProperties)
185185
$PSStandardMembers = [System.Management.Automation.PSMemberInfo[]]@($DefaultDisplayPropertySet)
186186
$Result | Add-Member MemberSet PSStandardMembers $PSStandardMembers
187187
return $result

PSServiceNow.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
RootModule = 'PSServiceNow.psm1'
1313

1414
# Version number of this module.
15-
ModuleVersion = '0.1.4'
15+
ModuleVersion = '0.1.5'
1616

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

Readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# PSServiceNow
2-
[![GitHub release](https://img.shields.io/github/release/Sam-Martin/servicenow-powershell.svg)](https://github.com/Sam-Martin/servicenow-powershell/releases/latest) [![GitHub license](https://img.shields.io/github/license/Sam-Martin/servicenow-powershell.svg)](LICENSE) ![Test Coverage](https://img.shields.io/badge/coverage-87%25-yellowgreen.svg)
2+
[![GitHub release](https://img.shields.io/github/release/Sam-Martin/servicenow-powershell.svg)](https://github.com/Sam-Martin/servicenow-powershell/releases/latest) [![GitHub license](https://img.shields.io/github/license/Sam-Martin/servicenow-powershell.svg)](LICENSE) ![Test Coverage](https://img.shields.io/badge/coverage-70%25-yellowgreen.svg)
33
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.
44
**IMPORTANT:** Neither this module, nor its creator are in any way affiliated with ServiceNow.
55

0 commit comments

Comments
 (0)