Modifying .ini files with a group policy

Discussion in 'OT Technology' started by 127.0.0.1, May 31, 2007.

  1. 127.0.0.1

    127.0.0.1 New Member

    Joined:
    Sep 7, 2003
    Messages:
    9,310
    Likes Received:
    0
    Location:
    Fort Worth, Texas
    So i need to modify existing .ini files on about 200 machines (only one file, and really only one line of code in the file) The entire network is run with no local users on any of the machines, and the majority of options are set up through group policies already. This is something that I have never done before.

    So in the .ini file, it is split up into sections.
    Code:
     [section1]
    attribute1=value1
    attribute2=value2
    I'm sure it has to be set up to search through the file, find the section name, then find the attribute name..and so on. But how does one go about doing this? would a vbs script be easiest..or some other option.

    Thanks

    by the way.

    What the change that has to be done is as simple as this
    Code:
    location=\\server1\folder\username
    to
    Code:
    location=\\server2\folder\username
    Here's the deal. Since there aren't any local users (besides admins), I'm not sure if this .ini file is stored locally on a per user basis, or if they are stored server side as part of the user's personal settings (that is loaded when they log into any machine on the network that they have access to).

    Making a .vbs script seems easiest. Since you can easily grab the windows username with a few lines of code, and pass the username to the line of code...but yeah. thanks for the help.
     
  2. deusexaethera

    deusexaethera OT Supporter

    Joined:
    Jan 27, 2005
    Messages:
    19,712
    Likes Received:
    0
    Hmm. All I've got is a partial solution: Make .VBS script, and insert a command into each user's "RunOnce" registry folder that will (surprise!) run that .VBS file once the next time they log in on each machine.
     
  3. 5Gen_Prelude

    5Gen_Prelude There might not be an "I" in the word "Team", but

    Joined:
    Mar 14, 2000
    Messages:
    14,519
    Likes Received:
    1
    Location:
    Vancouver, BC, CANADA
    Is the .ini actually different for every person?
     
  4. 127.0.0.1

    127.0.0.1 New Member

    Joined:
    Sep 7, 2003
    Messages:
    9,310
    Likes Received:
    0
    Location:
    Fort Worth, Texas
    All of them will be different.

    The username part of the line of code will be the only difference between all the computers. That's why it needs to pull the username when it loads the script.

    We don't know how to put it on every computer without doing it individually.
     
  5. peerk

    peerk New Member

    Joined:
    Mar 14, 2005
    Messages:
    984
    Likes Received:
    0
    Just make it a logon script in group policy(with the script on the server). It doesn't matter if the script is run multiple times. In a week after all the users are updated remove it.
     
  6. deusexaethera

    deusexaethera OT Supporter

    Joined:
    Jan 27, 2005
    Messages:
    19,712
    Likes Received:
    0
    Storing the script on a server is a good idea, but I wouldn't delete the script. Just come up with a way to push a registry setting into the RunOnce registry folder in each user account on each computer (including ".DEFAULT"), so each time a user logs into a computer (even months after the script is first used) the setting will be changed accordingly. Repeat this process each time you need to make a change to a file in each user's account, and then if a new user logs in years from now their account will automatically update itself using the scripts you wrote.
     
  7. 127.0.0.1

    127.0.0.1 New Member

    Joined:
    Sep 7, 2003
    Messages:
    9,310
    Likes Received:
    0
    Location:
    Fort Worth, Texas
    My question I guess isn't how to write the script...but how do I implement that into a group policy. I'd rather not just add it into startup scripts. I guess I can. But there are a ton of them already.
     
  8. 5Gen_Prelude

    5Gen_Prelude There might not be an "I" in the word "Team", but

    Joined:
    Mar 14, 2000
    Messages:
    14,519
    Likes Received:
    1
    Location:
    Vancouver, BC, CANADA
    If ini file is identical, except for that one line just recreate it:

    type section1.txt > actualfilebeingreplaced.txt
    echo location=\\server2\folder\%username% >> actualfilebeingreplaced.txt
    type section2.txt >> actualfilebeingreplaced.txt

    I don't understand how you don't know where this ini file is stored though...

    And yes, login scripts are the easiest way to deploy this - no reason not to do it that way. You can create registry items via GP quite easily (it's under the windows settings->security settings->registry), but login scripts are far easier to do.
     

Share This Page