File tree Expand file tree Collapse file tree 9 files changed +58
-35
lines changed
Expand file tree Collapse file tree 9 files changed +58
-35
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,8 @@ function Get-ServiceNowChangeRequest {
1717
1818 # Fields to return
1919 [Parameter (Mandatory = $false )]
20- [string []]$Fields ,
20+ [Alias (' Fields' )]
21+ [string []]$Properties ,
2122
2223 # Hashtable containing machine field names and values returned must match exactly (will be combined with AND)
2324 [Parameter (Mandatory = $false )]
@@ -58,11 +59,11 @@ function Get-ServiceNowChangeRequest {
5859
5960 # Table Splat
6061 $getServiceNowTableSplat = @ {
61- Table = ' change_request'
62- Query = $Query
63- Limit = $Limit
64- Fields = $Fields
65- DisplayValues = $DisplayValues
62+ Table = ' change_request'
63+ Query = $Query
64+ Limit = $Limit
65+ Fields = $Properties
66+ DisplayValues = $DisplayValues
6667 }
6768
6869 # Update the Table Splat if the parameters have values
@@ -76,6 +77,8 @@ function Get-ServiceNowChangeRequest {
7677
7778 # Perform query and return each object in the format.ps1xml format
7879 $Result = Get-ServiceNowTable @getServiceNowTableSplat
79- $Result | ForEach-Object {$_.PSObject.TypeNames.Insert (0 , " ServiceNow.ChangeRequest" )}
80+ If (-not $Properties ) {
81+ $Result | ForEach-Object {$_.PSObject.TypeNames.Insert (0 , " ServiceNow.ChangeRequest" )}
82+ }
8083 $Result
8184}
Original file line number Diff line number Diff line change @@ -17,7 +17,8 @@ function Get-ServiceNowConfigurationItem {
1717
1818 # Fields to return
1919 [Parameter (Mandatory = $false )]
20- [string []]$Fields ,
20+ [Alias (' Fields' )]
21+ [string []]$Properties ,
2122
2223 # Hashtable containing machine field names and values returned must match exactly (will be combined with AND)
2324 [Parameter (Mandatory = $false )]
@@ -58,11 +59,11 @@ function Get-ServiceNowConfigurationItem {
5859
5960 # Table Splat
6061 $getServiceNowTableSplat = @ {
61- Table = ' cmdb_ci'
62- Query = $Query
63- Limit = $Limit
64- Fields = $Fields
65- DisplayValues = $DisplayValues
62+ Table = ' cmdb_ci'
63+ Query = $Query
64+ Limit = $Limit
65+ Fields = $Properties
66+ DisplayValues = $DisplayValues
6667 }
6768
6869 # Update the Table Splat if the parameters have values
@@ -76,6 +77,8 @@ function Get-ServiceNowConfigurationItem {
7677
7778 # Perform query and return each object in the format.ps1xml format
7879 $Result = Get-ServiceNowTable @getServiceNowTableSplat
79- $Result | ForEach-Object {$_.PSObject.TypeNames.Insert (0 , " ServiceNow.ConfigurationItem" )}
80+ If (-not $Properties ) {
81+ $Result | ForEach-Object {$_.PSObject.TypeNames.Insert (0 , " ServiceNow.ConfigurationItem" )}
82+ }
8083 $Result
8184}
Original file line number Diff line number Diff line change @@ -17,7 +17,8 @@ function Get-ServiceNowIncident{
1717
1818 # Fields to return
1919 [Parameter (Mandatory = $false )]
20- [string []]$Fields ,
20+ [Alias (' Fields' )]
21+ [string []]$Properties ,
2122
2223 # Hashtable containing machine field names and values returned must match exactly (will be combined with AND)
2324 [Parameter (Mandatory = $false )]
@@ -61,7 +62,7 @@ function Get-ServiceNowIncident{
6162 Table = ' incident'
6263 Query = $Query
6364 Limit = $Limit
64- Fields = $Fields
65+ Fields = $Properties
6566 DisplayValues = $DisplayValues
6667 }
6768
@@ -76,6 +77,8 @@ function Get-ServiceNowIncident{
7677
7778 # Perform query and return each object in the format.ps1xml format
7879 $Result = Get-ServiceNowTable @getServiceNowTableSplat
79- $Result | ForEach-Object {$_.PSObject.TypeNames.Insert (0 , " ServiceNow.Incident" )}
80+ If (-not $Properties ) {
81+ $Result | ForEach-Object {$_.PSObject.TypeNames.Insert (0 , " ServiceNow.Incident" )}
82+ }
8083 $Result
8184}
Original file line number Diff line number Diff line change @@ -17,7 +17,8 @@ function Get-ServiceNowRequest {
1717
1818 # Fields to return
1919 [Parameter (Mandatory = $false )]
20- [string []]$Fields ,
20+ [Alias (' Fields' )]
21+ [string []]$Properties ,
2122
2223 # Hashtable containing machine field names and values returned must match exactly (will be combined with AND)
2324 [Parameter (Mandatory = $false )]
@@ -61,7 +62,7 @@ function Get-ServiceNowRequest {
6162 Table = ' sc_request'
6263 Query = $Query
6364 Limit = $Limit
64- Fields = $Fields
65+ Fields = $Properties
6566 DisplayValues = $DisplayValues
6667 }
6768
@@ -76,6 +77,8 @@ function Get-ServiceNowRequest {
7677
7778 # Perform query and return each object in the format.ps1xml format
7879 $Result = Get-ServiceNowTable @getServiceNowTableSplat
79- $Result | ForEach-Object {$_.PSObject.TypeNames.Insert (0 , " ServiceNow.Request" )}
80+ If (-not $Properties ) {
81+ $Result | ForEach-Object {$_.PSObject.TypeNames.Insert (0 , " ServiceNow.Request" )}
82+ }
8083 $Result
8184}
Original file line number Diff line number Diff line change @@ -33,7 +33,8 @@ function Get-ServiceNowRequestItem {
3333
3434 # Fields to return
3535 [Parameter (Mandatory = $false )]
36- [string []]$Fields ,
36+ [Alias (' Fields' )]
37+ [string []]$Properties ,
3738
3839 # Hashtable containing machine field names and values returned must match exactly (will be combined with AND)
3940 [parameter (Mandatory = $false )]
@@ -76,7 +77,7 @@ function Get-ServiceNowRequestItem {
7677 Table = ' sc_req_item'
7778 Query = $Query
7879 Limit = $Limit
79- Fields = $Fields
80+ Fields = $Properties
8081 DisplayValues = $DisplayValues
8182 }
8283
@@ -91,6 +92,8 @@ function Get-ServiceNowRequestItem {
9192
9293 # Perform query and return each object in the format.ps1xml format
9394 $Result = Get-ServiceNowTable @getServiceNowTableSplat
94- $Result | ForEach-Object {$_.PSObject.TypeNames.Insert (0 , ' ServiceNow.Request' )}
95+ If (-not $Properties ) {
96+ $Result | ForEach-Object {$_.PSObject.TypeNames.Insert (0 , ' ServiceNow.Request' )}
97+ }
9598 $Result
9699}
Original file line number Diff line number Diff line change @@ -31,7 +31,8 @@ function Get-ServiceNowTable {
3131
3232 # Fields to return
3333 [Parameter (Mandatory = $false )]
34- [string []]$Fields ,
34+ [Alias (' Fields' )]
35+ [string []]$Properties ,
3536
3637 # Whether or not to show human readable display values instead of machine values
3738 [Parameter (Mandatory = $false )]
@@ -77,8 +78,8 @@ function Get-ServiceNowTable {
7778 $Body.sysparm_query = $Query
7879 }
7980
80- if ($Fields ) {
81- $Body.sysparm_fields = ($Fields -join ' ,' ).ToLower()
81+ if ($Properties ) {
82+ $Body.sysparm_fields = ($Properties -join ' ,' ).ToLower()
8283 }
8384
8485 # Perform table query and capture results
Original file line number Diff line number Diff line change @@ -40,7 +40,8 @@ function Get-ServiceNowTableEntry {
4040
4141 # Fields to return
4242 [Parameter (Mandatory = $false )]
43- [string []]$Fields ,
43+ [Alias (' Fields' )]
44+ [string []]$Properties ,
4445
4546 # Hashtable containing machine field names and values returned must match exactly (will be combined with AND)
4647 [parameter (Mandatory = $false )]
@@ -86,7 +87,7 @@ function Get-ServiceNowTableEntry {
8687 Table = $Table
8788 Query = $Query
8889 Limit = $Limit
89- Fields = $Fields
90+ Fields = $Properties
9091 DisplayValues = $DisplayValues
9192 ErrorAction = ' Stop'
9293 }
Original file line number Diff line number Diff line change @@ -16,8 +16,9 @@ function Get-ServiceNowUser{
1616 [int ]$Limit = 10 ,
1717
1818 # Fields to return
19- [parameter (mandatory = $false )]
20- [string []]$Fields ,
19+ [Parameter (Mandatory = $false )]
20+ [Alias (' Fields' )]
21+ [string []]$Properties ,
2122
2223 # Hashtable containing machine field names and values returned must match exactly (will be combined with AND)
2324 [Parameter (Mandatory = $false )]
@@ -61,7 +62,7 @@ function Get-ServiceNowUser{
6162 Table = ' sys_user'
6263 Query = $Query
6364 Limit = $Limit
64- Fields = $Fields
65+ Fields = $Properties
6566 DisplayValues = $DisplayValues
6667 }
6768
@@ -76,6 +77,8 @@ function Get-ServiceNowUser{
7677
7778 # Perform query and return each object in the format.ps1xml format
7879 $Result = Get-ServiceNowTable @getServiceNowTableSplat
79- $Result | ForEach-Object {$_.PSObject.TypeNames.Insert (0 , " ServiceNow.UserAndUserGroup" )}
80+ If (-not $Properties ) {
81+ $Result | ForEach-Object {$_.PSObject.TypeNames.Insert (0 , " ServiceNow.UserAndUserGroup" )}
82+ }
8083 $Result
8184}
Original file line number Diff line number Diff line change @@ -17,7 +17,8 @@ function Get-ServiceNowUserGroup{
1717
1818 # Fields to return
1919 [Parameter (Mandatory = $false )]
20- [string []]$Fields ,
20+ [Alias (' Fields' )]
21+ [string []]$Properties ,
2122
2223 # Hashtable containing machine field names and values returned must match exactly (will be combined with AND)
2324 [Parameter (Mandatory = $false )]
@@ -61,7 +62,7 @@ function Get-ServiceNowUserGroup{
6162 Table = ' sys_user_group'
6263 Query = $Query
6364 Limit = $Limit
64- Fields = $Fields
65+ Fields = $Properties
6566 DisplayValues = $DisplayValues
6667 }
6768
@@ -76,6 +77,8 @@ function Get-ServiceNowUserGroup{
7677
7778 # Perform query and return each object in the format.ps1xml format
7879 $Result = Get-ServiceNowTable @getServiceNowTableSplat
79- $Result | ForEach-Object {$_.PSObject.TypeNames.Insert (0 , " ServiceNow.UserAndUserGroup" )}
80+ If (-not $Properties ) {
81+ $Result | ForEach-Object {$_.PSObject.TypeNames.Insert (0 , " ServiceNow.UserAndUserGroup" )}
82+ }
8083 $Result
8184}
You can’t perform that action at this time.
0 commit comments