Intune Initial Scripts Backup
This commit is contained in:
35
dump/WSUS_Scripts/Old-Scripts/WSUSComputerCheck.ps1
Normal file
35
dump/WSUS_Scripts/Old-Scripts/WSUSComputerCheck.ps1
Normal file
@@ -0,0 +1,35 @@
|
||||
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
|
||||
Reference in New Issue
Block a user