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:skriptssqltest.txt
$originalfile = "\serverShared FoldersITDBA 2 ScriptsWinServerAdminODBCsourcesRegKey_UTV9.reg"
$newfile = "c:installregistryutv9.reg"
foreach ($server in $targetservers)
{
Copy-Item $originalfile -Destination $newfile
Invoke-Command -ComputerName $server -ScriptBlock {
Start-Process -filepath "C:windowsregedit.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….