Change Static IPs
-
@turcotter if you follow the first article, they just created a csv of all the hosts and assigned the ip as another field. All the snapin does is look at that csv after getting the hostname.
So I’m not seeing how you would need 600 separate scripts.
If you’re willing to take the time to apply a “proper” ip through fog, why aren’t you willing to make a csv file containing the information? To me the csv is faster and simple. Doing through the GUI could be done, but you’d need to do edit each host individually. While it could be done through fog, functionally speaking fog does not have a feature such as requested. Yours and the other posting from 2013 you found are the only two cases I’ve seen needing this functionality. The snapin csv setting still sounds the easiesy method, even if fog did have this functionality.
-
@turcotter said in Change Static IPs:
Also for several security conferences the kiosks cannot be physically connected to the internet
If it’s a traveling laptop without internet access, how is the laptop going to get a snapin from FOG? If you plan on having a intranet at the conferences (offline network) that includes a FOG Server, why not have FOG do DHCP for you?
-
@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.
-
@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
-
@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.
-
@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.
-
@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.
-
@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?
-
@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.
-
@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.
-
@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.
-
@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.