Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $REGKEY="HKEY_LOCAL_MACHINESOFTWAREPoliciesMicrosoftWindowsWindowsUpdate"
- $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_MACHINESOFTWAREPoliciesMicrosoftWindowsWindowsUpdate" `
- -RegistryItem DoNotConnectToWindowsUpdateInternetLocations `
- -Value 0 `
- -Type DWord
- Set-RegistryItem `
- -RegistryKey HKEY_LOCAL_MACHINESOFTWAREPoliciesMicrosoftWindowsStore `
- -RegistryItem AutoDownload `
- -Value 4 `
- -Type DWord
- Set-RegistryItem `
- -RegistryKey HKEY_LOCAL_MACHINESOFTWAREPoliciesMicrosoftWindowsStore `
- -RegistryItem RemoveWindowsStore `
- -Value 0 `
- -Type DWord
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement