This commit is contained in:
Zack Meier
2026-04-15 15:45:50 -05:00
commit 1d304511b8
613 changed files with 140998 additions and 0 deletions
@@ -0,0 +1,95 @@
<#
.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
state values
-5 New
-4 Access
-2 Scheduled
-1 Implement
0 Review
3 Close
Close code
Close notes
.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 Complete-ITDServiceNowChangeRequest {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string]
$Number,
[string]
$CloseCode,
[string]
$CloseNotes
)
begin {
}
process {
try {
Write-Verbose -Message ($Number + " If state is Assess, do nothing")
$CHG = Get-ITDServiceNowRecord -ItemType 'Change Request' -Number $Number
If ($CHG.State.display_value -eq "Assess") {
Write-Error -Message ($Number + " is currently in Assess state. Unable to continue until the CHG is Approved.")
}
Else {
Write-Verbose -Message ($Number + " If state is New and Type is Standard, set to Schedule")
$CHG = Get-ITDServiceNowRecord -ItemType 'Change Request' -Number $Number
If ($CHG.State.display_value -eq "New" -and $CHG.type.display_value -eq 'Standard') {
Update-ITDServiceNowRecord -ItemType 'Change Request' -Number $Number -Values @{
state = 'Scheduled'
} | Out-Null
}
Write-Verbose -Message ($Number + " If state is Schedule, set to Implement")
$CHG = Get-ITDServiceNowRecord -ItemType 'Change Request' -Number $Number
If ($CHG.State.display_value -eq "Scheduled") {
Update-ITDServiceNowRecord -ItemType 'Change Request' -Number $Number -Values @{
state = 'Implement'
} | Out-Null
}
Write-Verbose -Message ($Number + " If state is Implement, set to Review")
$CHG = Get-ITDServiceNowRecord -ItemType 'Change Request' -Number $Number
If ($CHG.State.display_value -eq "Implement") {
Update-ITDServiceNowRecord -ItemType 'Change Request' -Number $Number -Values @{
state = 'Review';
} | Out-Null
}
Write-Verbose -Message ($Number + " If state is Review, set to Close")
$CHG = Get-ITDServiceNowRecord -ItemType 'Change Request' -Number $Number
If ($CHG.State.display_value -eq "Review") {
Update-ITDServiceNowRecord -ItemType 'Change Request' -Number $Number -Values @{
state = 'Closed';
close_code = $CloseCode;
close_notes = $CloseNotes;
} | Out-Null
}#>
}
}
catch {
Write-Error -Message $error[0]
}
}
end {
}
}