puppetlabs / puppetlabs-wsus_client

puppetlabs - wsus_client module
Apache License 2.0
10 stars 32 forks source link

Enable locking to current Windows version #199

Open canihavethisone opened 1 year ago

canihavethisone commented 1 year ago

Use Case

System admins may want to prevent automatic upgrading to new versions with a Windows release. There are registry keys to do this.

Describe the Solution You Would Like

An optional method to set the target version to the current version, thereby preventing feature updates.

Describe Alternatives You've Considered

In a private module, I address this with the following, leveraging a custom fact that queries the current release from HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DisplayVersion.

  # Prevent Feature updates by locking the current version
  if $lock_current_version {
    registry_value { 'HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\TargetReleaseVersion':
      ensure => present,
      type   => 'dword',
      data   => '1',
    }
    registry_value { 'HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\TargetReleaseVersionInfo':
      ensure => present,
      type   => 'string',
      data   => $facts['windows']['display_version'],
    }
  } else {
    registry_value { 'HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\TargetReleaseVersion': ensure => absent }
  }

Additional Context

nil