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,31 @@
Param(
[Parameter(Mandatory = $true)]
[string[]]
$ComputerName = $null,
[ValidateSet('All Day Every Day',
'Weekdays 700 to 1800',
'All Week 500 to 2300'
)]
[string]
$SupportHours
)
$Func = {
param($C, $SwSupportHours)
Write-Verbose -Message "Add to Solarwinds" -Verbose
Import-SWDiscovery -ComputerName $C -Integration ServiceNow
Start-Sleep -Seconds 10
Write-Verbose -Message "Set Solarwinds node custom properties if parameter exists" -Verbose
If($PSBoundParameters.ContainsKey('SupportHours')){
Write-Verbose -Message "SupportHours $SwSupportHours." -Verbose
Set-SWNodeCustomProperty -ComputerName $C -Property SupportHours -Value $SwSupportHours
}
}
$ComputerName | ForEach-Object {
Invoke-Command -ComputerName itdslrwnds.nd.gov -ScriptBlock $Func -ArgumentList $_,$SupportHours -Credential $Secret:ndgov_svcitdiaasauto
}
@@ -0,0 +1,10 @@
Param(
[Parameter(Mandatory = $true)]
[string[]]
$ComputerName = $null
)
ForEach ($cn in $ComputerName) {
Write-Verbose -Message "Attempt Solarwinds removal for $cn" -Verbose
Remove-ITDSolarwindsNode -ComputerName $cn -Credential $Secret:ndgov_svcitdiaasauto -Verbose
}
@@ -0,0 +1,38 @@
Write-Verbose -Message "Prepare variables based on PSU server" -Verbose
switch($UAJob.ComputerName){
"ITDWINAUTOT1" {
$ServiceNowEnvironment = "Test"
}
"ITDWINAUTOP1" {
$ServiceNowEnvironment = "Production"
}
}
New-ITDServiceNowSession -Environment $ServiceNowEnvironment -Credential $Secret:snow_vmcred
<#
Write-Verbose -Message "Retrieve List of all Server Build Request request items from ServiceNow where closed_at is Yesterday and request_type is Change" -Verbose
$Filter = 'cat_item=c64e27af47244610b7853238436d435d^variables.3bf9fc3b47240a10b7853238436d430b=Change^closed_atONYesterday@javascript:gs.beginningOfYesterday()@javascript:gs.endOfYesterday()'
####### 'cat_item=c64e27af47244610b7853238436d435d^variables.3bf9fc3b47240a10b7853238436d430b=Change^closed_atONYesterday@javascript:gs.beginningOfYesterday()@javascript:gs.endOfYesterday()'
$CompletedRitms = Get-ITDServiceNowRecord -ItemType 'Request Item' -Filter $Filter
Write-Verbose -Message ("Found " + @($CompletedRitms).count + " completed Ritms.")
#>
$CompletedRitms = Get-ITDServiceNowRecord -ItemType 'Request Item' -Number RITM0269022
ForEach($Ritm in $CompletedRITMs){
$Ritm = Get-ITDServiceNowRecord -ItemType 'Request Item' -Number ($Ritm.number.value) -IncludeCustomVariable -IncludeVariableSet
# loop each VM row
ForEach($row in $Ritm.VariableSet){
# resolve sys_id to host name
$CmdbCi = Get-ITDServiceNowRecord -Table cmdb_ci -SysId $row.host_name_ref
Write-Verbose -Message ("Start " + $Ritm.number.value + " server " + $row.host_name_ref + ', ' + $CmdbCi.fqdn.display_value) -Verbose
# run solarwinds import
$Func = {
param ($c)
Write-Verbose -Message "Attempting to import $c to Solarwinds"
Import-SWDiscovery -ComputerName $c
}
Invoke-Command -ComputerName itdslrwnds.nd.gov -ScriptBlock $Func -ArgumentList $CmdbCi.fqdn.display_value -Credential $Secret:ndgov_svcitdiaasauto
}
}