Created
January 20, 2020 18:28
-
-
Save nexocentric/2b532b16ffa9d6e1a0072cee9553dd9e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$REGKEY="HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" | |
$REGITEM = "DoNotConnectToWindowsUpdateInternetLocations" | |
function Set-RegistryItem { | |
param ( | |
# Registry key to set | |
[Parameter(Mandatory=$true)] | |
[string] | |
$RegistryKey, | |
# Registry item to set | |
[Parameter(Mandatory=$true)] | |
[string] | |
$RegistryItem, | |
# Value to Set | |
[Parameter(Mandatory=$true)] | |
[string] | |
$Value, | |
# Value type to Set | |
[Parameter(Mandatory=$true)] | |
[string] | |
$Type | |
) | |
if ($(Get-ItemProperty -Path Registry::$RegistryKey -Name $RegistryItem)) { | |
New-ItemProperty -Path Registry::$RegistryKey -Name $RegistryItem -PropertyType $Type -Value $Value -Confirm -Force | |
} | |
} | |
Set-RegistryItem ` | |
-RegistryKey "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" ` | |
-RegistryItem DoNotConnectToWindowsUpdateInternetLocations ` | |
-Value 0 ` | |
-Type DWord | |
Set-RegistryItem ` | |
-RegistryKey HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\WindowsStore ` | |
-RegistryItem AutoDownload ` | |
-Value 4 ` | |
-Type DWord | |
Set-RegistryItem ` | |
-RegistryKey HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\WindowsStore ` | |
-RegistryItem RemoveWindowsStore ` | |
-Value 0 ` | |
-Type DWord |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment