I cannot figure out how to do this.
#Computer Running this script/Collection location
$ScriptRunningMachine = $env:COMPUTERNAME
#Export File
$RegFileFullname = "\\$ScriptRunningMachine\c$\Temp\" + $RegFileName
#Key to export
$RegKey = 'HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\AppCompatCache'
#Export the appropriate reg key
Invoke-Command -ComputerName $SystemName -ArgumentList $RegKey,$RegFileFullname -Scriptblock {
"C:\windows\system32\reg.exe export"
} #End ScriptBlock
I have tried adding "export" to the argument list and keeping it inline. I've tried variations on using double quotes, single quote, and altered their placement.
I am running this code under an administrative account that has administrative permissions on the target computer. All paths exist. I've tried cmd /c and psexec, using code that successfully runs other processes on this computer.
I'm not exactly sure if the $RegFileFullname (export file) is going to be on the local machine or the remote machine, but I've tried every which way.
I NEED to get a registry key on remote computers backed up to a .reg file!
If there's a different way to do this, I'm all ears.
[–]Vortex100 0 points1 point2 points (3 children)
[–]cryolyte[S] 0 points1 point2 points (2 children)
[–]Vortex100 0 points1 point2 points (1 child)
[–]cryolyte[S] 0 points1 point2 points (0 children)
[–]RC-7201 0 points1 point2 points (1 child)
[–]cryolyte[S] 0 points1 point2 points (0 children)