Search code examples
windowspowershellregistry

PowerShell script to ask registry for exists key and true/false output


How can I write script to asking registry if RebootRequired exits in next path? HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired and if RebootRequired exists output> true and if RebootRequired not exists output> false

I tried several attempts without success

thanks


Solution

  • Invoke-Command -ScriptBlock {Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired"}