I don't want to control my Computers Windows update with Powershell, I want to query all the Servers in my text file list and return,
The values for how each servers windows update settings. I have this script below which works just fine.
$SCRIPT:AutoUpdateNotificationLevels= @{
0="Not configured";
1="Disabled";
2="Notify before download";
3="Notify before installation";
4="Scheduled installation" }
$SCRIPT:AutoUpdateDays=@{
0="Every Day";
1="Every Sunday";
2="Every Monday";
3="Every Tuesday";
4="Every Wednesday";
5="Every Thursday";
6="Every Friday";
7="Every Saturday"
}
Function Get-WindowsUpdateConfig
{
$AUSettings = (New-Object -com "Microsoft.Update.AutoUpdate").Settings
$AUObj = New-Object -TypeName System.Object
Add-Member -inputObject $AuObj -MemberType NoteProperty -Name "NotificationLevel" `
-Value $AutoUpdateNotificationLevels[$AUSettings.NotificationLevel]
Add-Member -inputObject $AuObj -MemberType NoteProperty -Name "UpdateDays" `
-Value $AutoUpdateDays[$AUSettings.ScheduledInstallationDay]
Add-Member -inputObject $AuObj -MemberType NoteProperty -Name "UpdateHour" `
-Value $AUSettings.ScheduledInstallationTime
Add-Member -inputObject $AuObj -MemberType NoteProperty -Name "Recommended updates" `
-Value $(IF ($AUSettings.IncludeRecommendedUpdates) {"Included"} else {"Excluded"})
$AuObj
}
Function Set-WindowsUpdateConfig
{
Param (
[Parameter()]
[ValidateRange(0,4)]
[int]
$NotificationLevel ,
[Parameter()]
[ValidateRange(0,7)]
[int]
$Day,
[Parameter()]
[ValidateRange(0,24)]
[int]
$hour,
[Parameter()]
[bool]
$IncludeRecommended
)
$AUSettings = (New-Object -com "Microsoft.Update.AutoUpdate").Settings
if ($NotificationLevel) {$AUSettings.NotificationLevel =$NotificationLevel}
if ($Day) {$AUSettings.ScheduledInstallationDay =$Day}
if ($hour) {$AUSettings.ScheduledInstallationTime=$hour}
if ($IncludeRecommended) {$AUSettings.IncludeRecommendedUpdates=$IncludeRecommended}
$AUSettings.Save()
}
Get-WindowsUpdateConfigI found this at ( http://www.assemblein.info/powershell-cmd/how-to-find-windows-update-settings-by-powershell/
What I want to do is have it now list the PC Name in the out put but I'm not sure what to add to make it do this? Also it doesn't seem to run against my list of computers, only my local machine.
Here is what I am running
Get-Content .\Computerlist.txt | .\settings
here is the output:
PS C:\computerList>>> Get-Content .\Computerlist.txt | .\settings -Computername
NotificationLevel UpdateteDays UpdateHour Recommended
updates
Scheduled installation Every Wednesday 3 Included
But it only returns the value of my computers settings.
Charles Behm