• Recent
    • Unsolved
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Change Static IPs

    Scheduled Pinned Locked Moved
    General
    4
    19
    2.2k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      Turcotter @Tom Elliott
      last edited by

      @tom-elliott I agree that the CSV file would be ideal and the fastest method however I was unsure how to setup the file and was trying to find an example to better understand. Should I just leave all headers blank and just list column A=Hostname Column B = IP Column C= Sunbet and so on? Thanks for your help again.

      Tom ElliottT 1 Reply Last reply Reply Quote 0
      • Tom ElliottT
        Tom Elliott @Turcotter
        last edited by

        @turcotter I think, if you make a csv and the snapin uses power shell, having headers would make you life a lot easier. Ultimately the csv could be something like:

        hostname,ip
        Foghostname1,192.168.1.1
        Foghostname2,192.168.1.2
        

        Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

        Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

        Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

        1 Reply Last reply Reply Quote 1
        • T
          Turcotter @Wayne Workman
          last edited by

          @wayne-workman I don’t want to get too off topic but all imaging and management is done in our office and then they are shipped to these conferences and are on their own LAN.

          Wayne WorkmanW 1 Reply Last reply Reply Quote 1
          • george1421G
            george1421 Moderator @Turcotter
            last edited by george1421

            @turcotter TBH, I did not look at the first script. I just did take a peek and this should work for you. I just got rid of the intents.

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

            Now for the csv file. It looks like it takes on this form from the script

            computer_name, ip_addr, subnet_mask, gateway,dns_server1, dns_server2, dns_server3
            computer1, 192.168.1.20,255.255.255.0,192.168.1.1,192.168.1.50,192.168.1.52,192.168.1.55
            

            No need for headers unless a human needs to read it. The script will look for a line that matches the current computer name in the .csv file and then set the parameters accordingly.

            Just be aware you will have the same issue as the OP of the thread I linked, the snapin runs as the SYSTEM user, which is a local admin user that has no domain rights. You will need to map a drive to the remove CSV file, or just include it with the snapin then not need to worry about connecting to an external share.

            Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

            T 1 Reply Last reply Reply Quote 0
            • Wayne WorkmanW
              Wayne Workman @Turcotter
              last edited by Wayne Workman

              @turcotter said in Change Static IPs:

              they are shipped to these conferences and are on their own LAN.

              You could send a small desktop/raspberry pi with them to serve as a DHCP server. If you’re sending the switch, you could send a managed switch that does DHCP. If it’s not your LAN, you could request that the LAN have DHCP available. Just ideas.

              Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!
              Daily Clean Installation Results:
              https://fogtesting.fogproject.us/
              FOG Reporting:
              https://fog-external-reporting-results.fogproject.us/

              1 Reply Last reply Reply Quote 0
              • T
                Turcotter @george1421
                last edited by

                @george1421 Thanks for the reply I took what you said and did some test to try and get it to run and I thought I had solved it but it still doesnt change the IP. It was always my understanding that the SYSTEM had higher access than a normal admin account. I saw in the post you linked me that I could specify the user within the batch file? It runs fine when I just run it as admin without launching as a snapin. Any advice?

                george1421G 2 Replies Last reply Reply Quote 0
                • george1421G
                  george1421 Moderator @Turcotter
                  last edited by

                  @turcotter The issue in the link is that SYSTEM does have local admin rights, but it can’t reach outside of the box to pickup the csv file. If you connect to the remote share as a domain user then you can access the central csv file.

                  The other method is to deliver the csv file with the batch file.

                  Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

                  1 Reply Last reply Reply Quote 0
                  • george1421G
                    george1421 Moderator @Turcotter
                    last edited by george1421

                    @turcotter So if you were to take my script and change it this way.

                    net use w: \\Server\Share /user:domain\user password
                    Set csv=w:\pcsetup\ipchanger\ComputerList.csv
                    if not exist %csv% echo "Unable to access csv file" >c:\windows\temp\ipset_error.txt
                    
                    for /f “skip=1 delims=, tokens=1-7” %%a in (%csv%) do (
                    

                    and then at the end remove the mapping to the w: drive

                    net use w: /delete
                    

                    Warning: I did not test or debug this but just wrote off the top of my head. But the idea is that if the script can’t reach the csv file it will create a flag file ip_set_error in c:\windows\temp directory.

                    Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

                    T 1 Reply Last reply Reply Quote 0
                    • T
                      Turcotter @george1421
                      last edited by

                      @george1421 Alright thanks for your help but I have to take a few steps back i guess I am trying to just run a simple batch file to confirm that at least my snapin configuration is correct and even that isn’t wokring properly. I am trying to run this batch file:

                      ECHO BATCH > C:\Users\REG\Desktop\BATCH_LOG.txt

                      and even this isn’t working and is just failing at “MIddleware:: Authentication Waiting for authentication timeout to pass”

                      Thanks for your help again I know this is starting to drag on. Is there any in depth literature on this sort of thing I can’t really seem to find any.

                      george1421G 1 Reply Last reply Reply Quote 0
                      • george1421G
                        george1421 Moderator @Turcotter
                        last edited by

                        @turcotter Here is 3 different ways you could do this with powershell and a fog snapin. Reply #2 is interesting since it embeds the csv file right into the powershell script.

                        We can only offer ideas based on how the snapin system works since we have not / do not assign static IP addresses this way to hosts. I’m not saying its wrong, only we don’t have the experience doing this.

                        Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

                        1 Reply Last reply Reply Quote 0
                        • 1 / 1
                        • First post
                          Last post

                        155

                        Online

                        12.0k

                        Users

                        17.3k

                        Topics

                        155.2k

                        Posts
                        Copyright © 2012-2024 FOG Project