49 lines
1.6 KiB
PowerShell
49 lines
1.6 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-ITDServiceNowChangeTemplateStandard {
|
|
[CmdletBinding()]
|
|
param (
|
|
[string]
|
|
$Name
|
|
)
|
|
|
|
begin {
|
|
|
|
}
|
|
|
|
process {
|
|
If($PSBoundParameters.ContainsKey('Name')){
|
|
$InvokeRestMethodParams = @{
|
|
Method = 'Get';
|
|
Uri = ($Script:ServiceNowSession.Uri + "/api/sn_chg_rest/change/standard/template?sysparm_query=active=true^name=$Name");
|
|
Headers = $Script:ServiceNowSession.Headers;
|
|
ContentType = $Script:ServiceNowSession.ContentType;
|
|
}
|
|
|
|
} Else {
|
|
$InvokeRestMethodParams = @{
|
|
Method = 'Get';
|
|
Uri = ($Script:ServiceNowSession.Uri + "/api/sn_chg_rest/change/standard/template?sysparm_query=active=true");
|
|
Headers = $Script:ServiceNowSession.Headers;
|
|
ContentType = $Script:ServiceNowSession.ContentType;
|
|
}
|
|
}
|
|
$InvokeResult = (Invoke-RestMethod @InvokeRestMethodParams).result
|
|
}
|
|
|
|
end {
|
|
Write-Output $InvokeResult
|
|
}
|
|
} |