Hi all, new to PS and i have a challenge at work.. i have a .reg file that i need to apply to alot of our servers (but not all!)
i have a list of them, but how do i do it?
what i tried so far is this:
$targetservers = Get-Content C:\skripts\sqltest.txt
$originalfile = "\\server\Shared Folders\IT\DBA\02 Scripts\WinServerAdmin\ODBCsources\RegKey_UTV9.reg"
$newfile = "c:\install\registry\utv9.reg"
foreach ($server in $targetservers)
{
Copy-Item $originalfile -Destination $newfile
Invoke-Command -ComputerName $server -ScriptBlock {
Start-Process -filepath "C:\windows\regedit.exe" -argumentlist "/s $newfile"
}
}
it creates the new file on MY pc (and i would be fine with that if it worked) and thats it! no error message at all, and the .reg file has not been applied!
i need some help here, i am clearly missing something....