35 lines
1.2 KiB
PowerShell
35 lines
1.2 KiB
PowerShell
Import-Module ActiveDirectory
|
|
Import-Module WindowsUpdate
|
|
|
|
|
|
$ServerList = Import-Csv 'C:\Users\abamaso-ccxadmin\Desktop\CompletedProd_WindowsServers - Classifications.csv'
|
|
|
|
$AllServers = @()
|
|
|
|
foreach ($Server in $ServerList) {
|
|
$patchingtier = $Server.Classification
|
|
$ServerObject = New-Object psobject
|
|
|
|
$ComputerValidation = $null
|
|
|
|
$WSUSComputerObject = Get-WsusServer -Name psus002 -PortNumber 8530|Get-WsusComputer -NameIncludes $server.'Server Name'
|
|
|
|
$ComputerValidation = $wsuscomputerobject.FullDomainName
|
|
|
|
$ServerObject | Add-Member -MemberType NoteProperty -Name "Server Name" -Value $server.'Server Name'
|
|
$ServerObject | Add-Member -MemberType NoteProperty -Name "Operating System" -Value $server.'Operating System'
|
|
$ServerObject | Add-Member -MemberType NoteProperty -Name "Application" -Value $server.Application
|
|
|
|
if ($ComputerValidation -eq $null) {
|
|
$ServerObject | Add-Member -MemberType NoteProperty -Name "WSUS Status" -Value "Server is not in WSUS"
|
|
}
|
|
else {
|
|
$ServerObject | Add-Member -MemberType NoteProperty -Name "WSUS Status" -Value "Server is in WSUS"
|
|
}
|
|
|
|
$AllServers +=$ServerObject
|
|
|
|
Write-host $Server.'Server Name'" checked in WSUS"
|
|
}
|
|
|
|
$AllServers | export-csv C:\Users\abamaso-ccxadmin\Desktop\WSUSComputers.csv |