32 lines
964 B
PowerShell
32 lines
964 B
PowerShell
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
|
|
}
|