locked
Need to Modify a regitry value for a list of computers on my Network RRS feed

  • Question

  • Hey guys, first off I don't have any formal scripting experience, I just try to figure stuff out as needed. Anyway we use Citrix XenApp, and currently all of our computers point to a URL to fetch the assets they need.

    I need to switch the URL they are all pointing at.

    The registry entry is location here: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Citrix\PNAgent\ and there is a string in there called ServerURL and the data value is: http://theOLDurl

    At first I was thinking about exporting that key, which works, but I don't know how to execute a .reg file on a list of remote computers, so I thought I would try a powershell script.

    I tried the following:

    PS C:\> Set-Location HKLM:\Software\Wow6432Node\Citrix\PNAgent
    PS HKLM:\Software\Wow6432Node\Citrix\PNAgent> Set-ItemProperty . ServerURL "http://theNEWurl"

    I get Set-ItemProperty : Requested registry access is not allowed.
    At line:1 char:17 (which is the . )
    + Set-ItemProperty <<<< . ServerURL "http://theNEWurl"
      + CatagoryInfo                 : PermissionDenied: <HKEY_LOCAL_MACH...\Citrix\PNAgent:String) [Set-ItemProperty], SecurityException
         + FullyQualifiedErrorId : System.Security.SecurityException,Microsoft.PowerShell.Commands.SetItemPropertyCommand

    I tried it this way as well, with pretty much the same result:

    PS C:\> Set-ItemProperty -Path HKLM:\Software\Wow6432Node\Citrix\PNAgent -Name ServerURL -Value http://theNEWurl

    I am an administrator, I tried getting creds with my domain admin account, I still get similar errors, what I am doing wrong or am I missing something really easy to make this change happen?

    Oh once i figured it out I was planning on using a list of remote computer names like this to put to a list:

    Invoke-Command -cn (gc c:\theNEWurlList.txt)





    • Edited by MMAniac911 Wednesday, April 1, 2015 6:43 PM
    • Moved by Bill_Stewart Monday, May 18, 2015 7:10 PM OP doesn't understand scope of question/problem
    Wednesday, April 1, 2015 6:39 PM

Answers

  • Use group policy.

    -- Bill Stewart [Bill_Stewart]

    • Proposed as answer by Bill_Stewart Saturday, April 18, 2015 7:55 PM
    • Marked as answer by Bill_Stewart Monday, May 18, 2015 7:10 PM
    Wednesday, April 1, 2015 7:05 PM

All replies

  • So I right Clicked on Windows Powershell and tried Run as Administrator, and it worked.

    So... next step is trying to get it to work for a list of computers

    Wednesday, April 1, 2015 6:49 PM
  • I think this is the part that is going to be hard to figure out, I tried:

    PS C:\> Invoke-Command -cn (gc c:\newURLlist\list.txt) -cred $cred {pushd;sl HKLM:\Software\Wow6432Node\Citrix\PNAgent;
    Set-ItemProperty . ServerURL "http://theNewurl" ; popd}

    Right now the c:\newURLlist\list.txt only has one computer in it called remote-computer

    Then I get the following error:

    [remote-computer] Connecting to remote server failed with the following error message : The client cannot connect to the des tination specified in the request. Verify that the service on the destination is running and is accepting requests. Con sult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig".

    For more information, see the about_Remote_Troubleshooting Help topic.
        + CategoryInfo          : OpenError: (:) [], PSRemotingTransportException
        + FullyQualifiedErrorId : PSSessionStateBroken

    I'm totally lost now and if I cant do computers remotely then the script really doesn't help me much. Ah! Any ideas?



    • Edited by MMAniac911 Wednesday, April 1, 2015 7:03 PM
    Wednesday, April 1, 2015 7:01 PM
  • Use group policy.

    -- Bill Stewart [Bill_Stewart]

    • Proposed as answer by Bill_Stewart Saturday, April 18, 2015 7:55 PM
    • Marked as answer by Bill_Stewart Monday, May 18, 2015 7:10 PM
    Wednesday, April 1, 2015 7:05 PM
  • The issue with that is when the users go to the new server they will need to setup about 4 different pieces of software each, so we wanted to go it with small controlled groups first, and not ever everyone in a OU if we cna help is, for example we don't want everyone in the call center to have to do it on the same day.
    Wednesday, April 1, 2015 7:53 PM
  • I don't understand what that has to do with the stated problem.


    -- Bill Stewart [Bill_Stewart]

    Wednesday, April 1, 2015 8:11 PM
  • The issue with that is when the users go to the new server they will need to setup about 4 different pieces of software each, so we wanted to go it with small controlled groups first, and not ever everyone in a OU if we cna help is, for example we don't want everyone in the call center to have to do it on the same day.

    That is exactly what Group Policy is for.  Add a filter to apply it to only a few users.  When they are tested then add more users to the filter.  This is not something we would script in a domain.

    Remember that you key will change everything on the server that it is changed on.  You cannot change an HKLM on a oer user basis.  It can only be changed for all uysers of the system.


    ¯\_(ツ)_/¯


    • Edited by jrv Wednesday, April 1, 2015 9:01 PM
    Wednesday, April 1, 2015 9:00 PM