SHARE
TWEET

Untitled

a guest Jun 15th, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $REGKEY="HKEY_LOCAL_MACHINESOFTWAREPoliciesMicrosoftWindowsWindowsUpdate"
  2. $REGITEM = "DoNotConnectToWindowsUpdateInternetLocations"
  3.  
  4. function Set-RegistryItem {
  5.     param (
  6.         # Registry key to set
  7.         [Parameter(Mandatory=$true)]
  8.         [string]
  9.         $RegistryKey,
  10.  
  11.         # Registry item to set
  12.         [Parameter(Mandatory=$true)]
  13.         [string]
  14.         $RegistryItem,
  15.  
  16.         # Value to Set
  17.         [Parameter(Mandatory=$true)]
  18.         [string]
  19.         $Value,
  20.  
  21.         # Value type to Set
  22.         [Parameter(Mandatory=$true)]
  23.         [string]
  24.         $Type
  25.     )
  26.  
  27.     if ($(Get-ItemProperty -Path Registry::$RegistryKey -Name $RegistryItem)) {
  28.         New-ItemProperty -Path Registry::$RegistryKey -Name $RegistryItem -PropertyType $Type -Value $Value -Confirm -Force
  29.     }
  30. }
  31.  
  32. Set-RegistryItem `
  33.     -RegistryKey "HKEY_LOCAL_MACHINESOFTWAREPoliciesMicrosoftWindowsWindowsUpdate" `
  34.     -RegistryItem DoNotConnectToWindowsUpdateInternetLocations `
  35.     -Value 0 `
  36.     -Type DWord
  37.  
  38. Set-RegistryItem `
  39.     -RegistryKey HKEY_LOCAL_MACHINESOFTWAREPoliciesMicrosoftWindowsStore `
  40.     -RegistryItem AutoDownload `
  41.     -Value 4 `
  42.     -Type DWord
  43.  
  44. Set-RegistryItem `
  45.     -RegistryKey HKEY_LOCAL_MACHINESOFTWAREPoliciesMicrosoftWindowsStore `
  46.     -RegistryItem RemoveWindowsStore `
  47.     -Value 0 `
  48.     -Type DWord
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top