none
Create Script to modify HOST IP in a single INI file RRS feed

  • Question

  • Good afternoon!

    I don't have enough experience with scripting to accomplish my goal, without assistance. We have a system INI file that is located on all devices at "C:\cpsi\" folder. The INI file is the only ini file in the "cpsi" folder. The 2nd line of that INI file has the HOST IP Address to the core server. Instead of having to go to all 235 devices, i wanted to create a login script or a batch file i could run on our domain that would go to that file, edit the host IP and save/close it.

    The 2nd line of that file says "HOST:10.2.8.40" and i just want it to say "HOST:10.4.12.12". Is this possible through a bat, cmd or vbs script or must i use powershell? Either way, i know the coding language is different on each. Anyone have an example i could edit to test this and accomplish this goal? Thanks in advance!
    Jeff

    Tuesday, March 3, 2020 9:17 PM

Answers

  • It is better not to "hard-code" IP addresses in an application configuration for precisely this reason.

    If your client configuration ini file is not machine-specific (same file for all clients), you can use a GPO to copy the ini file without needing a script.

    If the client configuration file is machine-specific, I would recommend setting up a CNAME (alias) record that points to the "real" server's host name and have the application use the alias. In this way, when you need to replace the server, just change the DNS alias and you don't have to touch the client machines.

    You will, though, need to touch the client machines to use the alias instead, but you will only need to do this once.


    -- Bill Stewart [Bill_Stewart]

    Wednesday, March 4, 2020 6:26 PM
    Moderator

All replies

  • Yes it is possible.  Unfortunately we don't write scripts on request.  You can contact someone in your company that can help you or you can hire a consultant to do this.

    What you are trying to do is unnecessary in Windows so you should find a trained person to help you.  What you are doing is how things get broken and how people die as a result of untrained and inexperienced people trying to do things they should not be doing.

    Please read teh following links:

    Please carefully review the following links to set your expectation for posting in technical forums.


    \_(ツ)_/

    Tuesday, March 3, 2020 9:25 PM
  • First two sentences would have sufficed. 

    Thanks anyways for the sarcastic direction.

    Tuesday, March 3, 2020 9:40 PM
  • It was intended as a warning.  Working in a hospital you should know that doing things incorrectly on a computer may have issues that effect the health of patients.


    \_(ツ)_/

    Tuesday, March 3, 2020 11:09 PM
  • It is better not to "hard-code" IP addresses in an application configuration for precisely this reason.

    If your client configuration ini file is not machine-specific (same file for all clients), you can use a GPO to copy the ini file without needing a script.

    If the client configuration file is machine-specific, I would recommend setting up a CNAME (alias) record that points to the "real" server's host name and have the application use the alias. In this way, when you need to replace the server, just change the DNS alias and you don't have to touch the client machines.

    You will, though, need to touch the client machines to use the alias instead, but you will only need to do this once.


    -- Bill Stewart [Bill_Stewart]

    Wednesday, March 4, 2020 6:26 PM
    Moderator