Check registry for key value for remote servers/computers
I’ve had a couple of requests from customers this week to check for the presence of a specific registry key. One looking for 2008/2008R2 servers: Get-ADComputer -Filter {OperatingSystem -Like “Windows Server* 2008”} -Properties * or others against a security group : Get-ADComputer -filter * -Property * | where {$_.memberof -match ‘YOURGROUPNAMEHERE’}. Here’s a sample of it to check for all systems with .NET 4.6.2 installed and outputs it to a text file:
$PatchStatus=@{}
$RemoteSystems= Get-ADComputer -filter * -Property *
$RemoteHosts = $RemoteSystems.Name
foreach ($RemoteHost in $RemoteHosts){
$Hive = [Microsoft.Win32.RegistryHive]”LocalMachine”;
$RegKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey($Hive,$RemoteHost);
$Ref = $RegKey.OpenSubKey(“SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\”);
$RefValue = $Ref.GetValue(“Release”)
if ($RefValue -ge “394806”){$PatchStatus.Add($RemoteHost,”Patched”)}
else {$PatchStatus.Add($RemoteHost,”Needs .NET”)}
}
$PatchStatus | Out-File “C:\Temp\Needs-DotNET4.6.2.txt”
I beloved as much as you will obtain carried out right here. The comic strip is attractive, your authored subject matter stylish. nonetheless, you command get got an edginess over that you would like be handing over the following. unwell indisputably come further in the past once more since precisely the same nearly very regularly inside of case you defend this increase.