PS: Easy checking to see if a key exists
Friday, October 25, 2013 in
Powershell (Views:
1848)
This is a quick and easy way to check if a registry key exists in PowerShell. Kind of inspired by my last blog, which identifies the registry key to see if a reboot is required post Windows Update.
Here is how you can do this:
$a=test-path "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired"
if ($a -eq "True"){write-host "Exists, insert your actions here."}
else {write-host "Doesn't exist, nothing to do..."}
Happy rebooting...
|