Changing Registry keys remotely - New to powershell

This topic contains 1 reply, has 2 voices, and was last updated by  Shell{&}co 11 months, 1 week ago.

  • Author
    Posts
  • #6132

    by russelljspicer at 2013-04-26 07:48:21

    Ok, I have successfully been able to change WMI objects and ADSI objects on remote computers without a problem. I am having trouble changing registry keys. I know the trouble is that the target computers powershell execution policy is set to "Restricted" but i want to know if there is another way to connect to registrys and change values without actually having to 1. change the execution policy and 2. even have powershell installed on the PC. Here is what my script looks like (i realize it is very rudimentary)

    $computerlist = "c:\mycomputer"

    $arrComputers = get-Content -Path $computerlist
    foreach ($strComputer in $arrComputers) {

    set-itemproperty -name WUServer -path "hklm:\software\policies\microsoft\windows\windowsupdate" -value "http://UpdateServer"

    }

    The problem for me is that the "set-itemproperty" cmdlet does not have a place to insert "$strcomputer"

    I assume there is a better cmdlet of function that can modify registry values, i guess i am just asking for a shove in the right direction...

    by DonJ at 2013-04-26 07:57:18

    Set-ItemProperty does not support connections to remote computers. You're intended to ship the entire command, via Remoting (Invoke-Command), to the remote computer. The command runs locally on the remote computer. This does require that the remote computer have Remoting enabled (Enable-PSRemoting). This does require PowerShell to be installed.

    Alternately, you can NOT use Remoting, and use WMI instead. However, note that this particular forum is about Remoting – a specific PowerShell technology, and not merely "doing stuff remotely." Not sure which you're after.

    by russelljspicer at 2013-04-26 08:06:21

    I should have mentioned that i tried Remoting (Invoke-Command) and that is where i ran into an issue with Exectuion policy and not having powershell installed. I apologize for not understanding what this particular forum is for, is there a moderator that could move it to the correct forum? Or should i just delete and re-post?

    by DonJ at 2013-04-26 08:19:41

    A re-post would be fine, but you don't need to delete. WMI is, at this point, your only real option, so you might re-state your question in that forum. Set-ItemProperty won't be on the table, so just kinda describe the environment you're in and what you're trying to do.

  • #54109

    Shell{&}co
    Participant

    Hello,

    The script available here can be useful to understand how to change registry on remote computers : link

    Cheers
    Shell{&}co

You must be logged in to reply to this topic.