26 lines
1.6 KiB
PowerShell
26 lines
1.6 KiB
PowerShell
[CmdletBinding()]
|
|
param (
|
|
[string]
|
|
$SCTaskNum
|
|
)
|
|
#RitmSearch ('variables.208bd5b31b0d0dd04d8943b1b24bcb69%3DInfra.ActiveDirectory.Object')
|
|
#$RitmSearch = Get-ITDServiceNowRecord -ItemType 'Request Item' -Filter ('active%3Dtrue^variables.208bd5b31b0d0dd04d8943b1b24bcb69%3DInfra-ActiveDirectory.Object') -Verbose
|
|
|
|
New-ITDServiceNowSession -Environment Production -Credential $Secret:SNowVMCred
|
|
|
|
# search Generic Active Directory Service Account tasks
|
|
$SCTaskSearch = Get-ITDServiceNowRecord -ItemType 'Catalog Task' -Filter ('active=true^variables.208bd5b31b0d0dd04d8943b1b24bcb69=Infra-ActiveDirectory.Object') -Verbose
|
|
Write-Verbose -Message ("SCTaskSearch found: " + @($SCTaskSearch).count) -Verbose
|
|
|
|
ForEach ($SCTask in $SCTaskSearch) {
|
|
# get ritm and look for addl comments about AD
|
|
$RitmToReview = Get-ITDServiceNowRecord -ItemType 'Request Item' -SysId $SCTask.request_item.value -IncludeCustomVariable
|
|
$task_short_description_search = 'Admin task to gather Server Information'
|
|
$StringSearchStart = "Please create a new nd.gov Active Directory service account with the following details, following guidelines found in KB0016867.*"
|
|
If ($RitmToReview.customvariable.additional_comments.value -like $StringSearchStart -and $SCTask.short_description -eq $task_short_description_search ){
|
|
Write-Verbose -Message ($SCTask.Number + " match, update short_description")
|
|
Update-ITDServiceNowRecord -ItemType "Catalog Task" -Number $SCTask.number -Values @{
|
|
short_description = 'Active Directory Service Account Provisioning'
|
|
}
|
|
}
|
|
} |