Import Reg Key To Remote Computer

Import Reg Key To Remote Computer

Challenge : Import reg key settings to a remote compute

Requires WinRM to be running

Execute as Administrator

**This script worked when tested on a Window 2021 server to a Windows7 Client

#####

$regFile = @”
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Example]
“1”=”tygfaldsjnfjdfnl”
“2”=”dsakbfjnd”
“3”=”dhjfbasjdhba”
“@

Invoke-Command -ComputerName ComputerName -ScriptBlock {param($regFile) $regFile | out-file $env:temp\a.reg;
reg.exe import $env:temp\a.reg } -ArgumentList $regFile

##############

Example executed

PowerShell run on Server, Win7 client then populated with Reg Key

Original post Run Registry File Remotely with PowerShell – Stack Overflow

Comments are closed.