Add IP Address changer - Snap-in scripts included



  • Hi guys, My feature request is already 50% done!

    I’ve hashed out the following script/s that can change the IP address on freshly imaged clients from data contained in a .csv file.

    I was hoping you could update the “IP ADDRESS” field on the Host info list to work with it by updating\modifying the csv file. Feel free to hijack the scripts for full Integration if you like.

    Attached are both .bat and .vbs versions of the script to run on the client pc, [B]the Batch script is a lot cleaner and simpler to use[/B].
    You will need to modify the Path information in either script to point at the .CSV file.
    The path is indicated as \server\share\folder

    The .vbs script requires you to run the included batch file to launch the script on x64 machines or it will crash (sorry). You will need to modify the path in this .bat to point at the .VBS

    I’ve included a sample .CSV to demonstrate formatting.

    [url="/_imported_xf_attachments/0/414_Scripts.zip?:"]Scripts.zip[/url]



  • Updated:

    The following will now ignore the case of the Computer name by adding the /I argument to the If statement.

    [INDENT=2]@Echo Off[/INDENT]
    [INDENT=2] [/INDENT]
    [INDENT=2]Set csv=\Server\Share\pcsetup\ipchanger\ComputerList.csv[/INDENT]
    [INDENT=2] [/INDENT]
    [INDENT=2]for /f “skip=1 delims=, tokens=1-7” %%a in (%csv%) do ([/INDENT]
    [INDENT=2] if /I “%computername%”=="%%a" ([/INDENT]
    [INDENT=2] [/INDENT]
    [INDENT=2] netsh int ipv4 set address “Local Area Connection” static %%b %%c %%d[/INDENT]
    [INDENT=2] netsh int ipv4 set dnsserver “Local Area Connection” static %%e[/INDENT]
    [INDENT=2] netsh int ipv4 add dnsserver “Local Area Connection” %%f[/INDENT]
    [INDENT=2] netsh int ipv4 add dnsserver “Local Area Connection” %%g[/INDENT]
    [INDENT=2] [/INDENT]
    [INDENT=2] )[/INDENT]
    [INDENT=2])[/INDENT]
    [INDENT=2]REM Pause[/INDENT]
    [INDENT=2]Echo On[/INDENT]



  • I was hoping for an interface element to make modifying the .csv a little less confusing. A tool does make perfect sense for those IT departments whose managers rely heavily on Static IP’s like ours.

    In my industry, reliability is paramount and we don’t take chances. If a branch server goes down and can’t assign an IP that’s a problem and we avoid potential problems like the plague.

    Yes, i know you can set a static IP from DHCP, Try convincing the paranoid CTO of a bank that it will work just fine lmfao. he keeps giving me this deep dark glare like i’m insane for even considering it.

    (it took me 8 years to convince him that we can reliably use Print servers to manage our printers instead of setting every single one by hand on every PC we installed *i ended up having to make scripts for that too finally until a month or 2 ago XD * and I only managed that miracle after i demonstrated how to use GPO to re-direct them all to another print server in under 10 minutes)


  • Senior Developer

    Okay,

    I think this is more appropriate, then, as a tool as you’ve already done here. Not everybody is going to want to set hosts statically, so maintaining as a snap-in is appropriate.

    Thank you and awesome work btw.



  • The script automatically sets a static IP address on any PC from a listing in the .csv file based on the Host name of the PC it’s executed on. Currently I have it running via Snapin. If no listing is found then it stays as it was.

    I use it regularly. I thought it would be nice to be able to edit the CSV file from the host listing.

    EDIT: Yea, the boss is s stickler for Static IP’s


  • Senior Developer

    Is this feature request/ suggestion something you’re constantly using. My understanding is the IP field is not really needed that much anymore and was slowly being worked out and isn’t really used at all in 0.33b

    I’ll take a look at it this weekend to see what it’s actually trying to do.

    EDIT: I looked a little bit into this, are you making this as a static IP Changer for all hosts in your system?


Log in to reply
 

381
Online

39.3k
Users

11.0k
Topics

104.4k
Posts

Looks like your connection to FOG Project was lost, please wait while we try to reconnect.