sync
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
$func = {
|
||||
Import-Module "D:\Program Files\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1"
|
||||
Set-Location ITD:\
|
||||
|
||||
switch ((Get-Date).Day) {
|
||||
{ $_ -ge 10 -and $_ -le 19 } {
|
||||
$CollectionName = 'All-MW-Monthly, 1st Thursday After 2nd Tuesday'
|
||||
$Platform = 'Test'
|
||||
}
|
||||
{ $_ -ge 20 -and $_ -le 31 } {
|
||||
$CollectionName = 'All-MW-Monthly, 2nd Sunday After 2nd Tuesday'
|
||||
$Platform = 'Production'
|
||||
}
|
||||
Default {
|
||||
$CollectionName = $null
|
||||
Exit
|
||||
}
|
||||
}
|
||||
|
||||
$PlatformStr = "SCCM-MicrosoftUpdates-" + $Platform + "Servers"
|
||||
|
||||
Get-CMDevice -CollectionName $CollectionName | Select-Object Name, @{n = 'DashboardPlatform'; e = { $PlatformStr } }
|
||||
}
|
||||
|
||||
$servers = (Invoke-Command -ScriptBlock $func -ComputerName itdsccmp2.nd.gov -Credential $PrvCred)
|
||||
|
||||
$postParams = [PSCustomObject]@{
|
||||
AutomationName = "Infra-Servers-SCCM";
|
||||
Action = "Patching";
|
||||
Units = [int][math]::round($servers.count * 7, 0);
|
||||
Platform = ($servers | Select-Object -First 1).DashboardPlatform;
|
||||
}
|
||||
|
||||
Invoke-RestMethod -Uri http://itdnettools.nd.gov/services/automation-tracking.py -Method POST -Body ($postParams | ConvertTo-Json)
|
||||
Reference in New Issue
Block a user