$servers = Get-Content 'C:\Lab\servers.txt' # Path to list of servers
$keyPath = 'SOFTWARE\Example'#Software means HKEY_LOCAL_MACHINE\SOFTWARE\
$valueName = 'ExampleValue' #DWORD Name
$valueData = 12 # Dword Value
foreach ($server in $servers) {
$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $server)
$key = $reg.OpenSubKey($keyPath, $true)
if ($key -eq $null) {
Write-Host "Registry key not found, adding." + $keyPath
$key = $reg.CreateSubKey($keyPath, $true)
}
$key = $reg.CreateSubKey($keyPath, $true)
$key.SetValue($valueName, $valueData, [Microsoft.Win32.RegistryValueKind]::DWord)
}