+ Post New Thread
Results 1 to 8 of 8
Scripts Thread, adding a registry entry via a script in Coding and Web Development; Whats the best way to add a registry entry i.e. via a .reg file to computers on the network via ...
  1. #1
    TechSupp's Avatar
    Join Date
    Mar 2007
    Location
    South Yorkshire
    Posts
    1,876
    Thank Post
    295
    Thanked 120 Times in 101 Posts
    Rep Power
    40

    adding a registry entry via a script

    Whats the best way to add a registry entry i.e. via a .reg file to computers on the network via a script? Must be simple to do but all the answers I seem to find onthe net seem to involve complex scripts. Sure I've done this before but age prevents me remembering howor where!

  2. #2
    meastaugh1's Avatar
    Join Date
    Jul 2006
    Location
    London/Hertfordshire
    Posts
    890
    Thank Post
    69
    Thanked 85 Times in 70 Posts
    Rep Power
    32
    I'd set the GP startup script executable to %windir%\system32\reg.exe and the parameter as IMPORT regfilename.reg. Then just drop regfilename.reg into the group policy startup script files folder.

  3. #3
    jsnetman's Avatar
    Join Date
    Oct 2007
    Posts
    887
    Thank Post
    23
    Thanked 134 Times in 126 Posts
    Rep Power
    39
    Or simply "regedit.exe /s myregfile.reg" in a startup batch file. The reg file being in the startup scripts folder.

  4. #4

    SimpleSi's Avatar
    Join Date
    Jun 2005
    Location
    Lancashire
    Posts
    5,808
    Thank Post
    1,476
    Thanked 592 Times in 444 Posts
    Rep Power
    168
    I do it like jsnetman for fixed registry entries.

    I use this type syntax for variable ones
    Code:
    set WPKGROOT=\\server2\icttech\wpkg
    set PACKAGES=\\server2\icttech\wpkg\packages
    set WPKGBASEIP=10.81.63
    
    c:\windows\system32\Reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v WPKGROOT /t REG_SZ /d "%WPKGROOT%" /f
    c:\windows\system32\Reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v PACKAGES /t REG_SZ /d "%PACKAGES%" /f
    c:\windows\system32\Reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v WPKGBASEIP /t REG_SZ /d "%WPKGBASEIP%" /f
    regards

    Simon

  5. Thanks to SimpleSi from:

    TechSupp (27th November 2009)

  6. #5

    ZeroHour's Avatar
    Join Date
    Dec 2005
    Location
    Edinburgh, Scotland
    Posts
    5,641
    Thank Post
    894
    Thanked 1,314 Times in 798 Posts
    Blog Entries
    1
    Rep Power
    444
    If I were you I would just use group policy preferences. Simple to deploy/manage as its just a GP and its free.

  7. Thanks to ZeroHour from:

    TechSupp (27th November 2009)

  8. #6
    TechSupp's Avatar
    Join Date
    Mar 2007
    Location
    South Yorkshire
    Posts
    1,876
    Thank Post
    295
    Thanked 120 Times in 101 Posts
    Rep Power
    40
    Any deatils of how you go about that via GPO? otherwise I'll just go with the quick and easy script option, Thanks

  9. #7
    ChrisH's Avatar
    Join Date
    Jun 2005
    Location
    East Lancs
    Posts
    4,999
    Thank Post
    120
    Thanked 280 Times in 258 Posts
    Rep Power
    106
    Computer Configuration > Windows Settings > Security Settings > Registry.
    Right click context menu for options

  10. Thanks to ChrisH from:

    TechSupp (27th November 2009)

  11. #8
    TechSupp's Avatar
    Join Date
    Mar 2007
    Location
    South Yorkshire
    Posts
    1,876
    Thank Post
    295
    Thanked 120 Times in 101 Posts
    Rep Power
    40
    This may be resurecting an old topic but just looking at that GPO setting mine has a lock symbol on it and prevents editing, how do I remiove the lock? I presume its in another GPO setting thats overriding the policy I want to change as if I run the reg entry manually it tells me I'm not allowed to edit the registry. Where in the policy would this be set so I can unset it?


    Its OK, Think I've found it.
    Last edited by TechSupp; 29th January 2010 at 10:21 AM.

SHARE:
+ Post New Thread

Similar Threads

  1. logoff script to delete registry key
    By ICMC in forum Scripts
    Replies: 3
    Last Post: 26th January 2009, 10:37 PM
  2. Adding a dns entry to a secondary domain?
    By reggiep in forum Windows
    Replies: 2
    Last Post: 6th August 2008, 09:27 AM
  3. Script not deleting/adding printer correctly
    By dave.81 in forum Scripts
    Replies: 2
    Last Post: 5th June 2008, 01:17 PM
  4. Adding DNS Entry
    By thegrassisgreener in forum Windows
    Replies: 13
    Last Post: 2nd October 2007, 10:17 AM
  5. Script To Change A Registry Key
    By DaveP in forum Windows
    Replies: 6
    Last Post: 7th March 2007, 12:57 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •