19 lines
1.1 KiB
PowerShell
19 lines
1.1 KiB
PowerShell
Import-Module ActiveDirectory
|
|
Import-Module WindowsUpdate
|
|
|
|
|
|
$ServerList = Import-Csv 'C:\Users\abamaso-ccxadmin\Desktop\CompletedProd_WindowsServers - Classifications.csv'
|
|
|
|
|
|
foreach ($Server in $ServerList) {
|
|
$patchingtier = $Server.Classification
|
|
|
|
switch ($patchingtier){
|
|
|
|
"Tier0 - Infrastructure" {Get-WsusServer -Name psus002 -PortNumber 8530|Get-WsusComputer -NameIncludes $server.'Server Name'| Add-WsusComputer -TargetGroupName "Tier0 - Infrastructure"}
|
|
"Tier1 - Critical Infrastructure" {Get-WsusServer -Name psus002 -PortNumber 8530|Get-WsusComputer -NameIncludes $server.'Server Name'| Add-WsusComputer -TargetGroupName "Tier1 - Critical Infrastructure"}
|
|
"Tier2 - File Servers" {Get-WsusServer -Name psus002 -PortNumber 8530|Get-WsusComputer -NameIncludes $server.'Server Name'| Add-WsusComputer -TargetGroupName "Tier2 - File Servers"}
|
|
"Tier2 - Application Servers" {Get-WsusServer -Name psus002 -PortNumber 8530|Get-WsusComputer -NameIncludes $server.'Server Name'| Add-WsusComputer -TargetGroupName "Tier2 - Application Servers"}
|
|
}
|
|
Write-host $Server.'Server Name'" Sorted into Group"
|
|
} |