48 lines
1.5 KiB
PowerShell
48 lines
1.5 KiB
PowerShell
<#
|
|
.SYNOPSIS
|
|
A short one-line action-based description, e.g. 'Tests if a function is valid'
|
|
.DESCRIPTION
|
|
A longer description of the function, its purpose, common use cases, etc.
|
|
.NOTES
|
|
Information or caveats about the function e.g. 'This function is not supported in Linux'
|
|
.LINK
|
|
Specify a URI to a help page, this will show when Get-Help -Online is used.
|
|
.EXAMPLE
|
|
Test-MyTestFunction -Verbose
|
|
Explanation of the function or its result. You can include multiple examples with additional .EXAMPLE lines
|
|
#>
|
|
|
|
function Get-ITDServiceNowUserGroup {
|
|
[CmdletBinding()]
|
|
param (
|
|
[string]
|
|
$Name
|
|
)
|
|
|
|
begin {
|
|
|
|
}
|
|
|
|
process {
|
|
# Invoke-RestMethod -Method GET -Uri ($Url + "api/now/table/sys_user_group?name=NDIT-Computer Systems&sysparm_limit=1") -Credential $SNowVMCred -Headers $SnowSessionHeader -ContentType $Type -ov x
|
|
|
|
$Query = "?sysparm_query="
|
|
If ($Name) { $Query += "name=$Name" }
|
|
|
|
|
|
$InvokeRestMethodParams = @{
|
|
Method = 'Get';
|
|
Uri = ($Script:ServiceNowSession.Uri + "/api/now/table/sys_user_group" + $Query + "&sysparm_limit=10");
|
|
Headers = $Script:ServiceNowSession.Headers;
|
|
ContentType = $Script:ServiceNowSession.ContentType;
|
|
}
|
|
|
|
Write-Verbose $InvokeRestMethodParams.Uri
|
|
|
|
$Result = Invoke-RestMethod @InvokeRestMethodParams
|
|
}
|
|
|
|
end {
|
|
Write-Output $Result.result
|
|
}
|
|
} |