Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Need assitance in getting value from registry

$
0
0
Hi All, Could anyone help me in assiting this code Req: I have text file with hotfix kb id and i would like to use to search in registry hive to get installed status by checking the value of "InstallClient" for "WindowsUpdateAgent". i would able to get registry value however couldn't able to search for kb and also set the pattern for searching Registry hive i am looking for is "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Package_1_for_KB2770660~31bf3856ad364e35~x86~~6.1.1.0" my code: $kbvalue = get-childitem -path c:\temp\hotfix.txt | foreach ($idvalue in $kbvalue) { $value = Get-ChildItem -path "hklm:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\" | Select-String "^[package]_\d{1}_[for]_$idvalue~[A-Za-z0-9]~[X86]~~(.\d[0-9]){4}" -input $CurrentKey -AllMatches } if($value.InstallClient -eq "WindowsUpdateAgent") { write-host"installed" } else write-host"not installed" } Please let me know if anyone requireed more information. Thanks in advance

Viewing all articles
Browse latest Browse all 6937

Trending Articles