Jump to content

Network configuration


Recommended Posts

Sorry folks if this is not the right place...please direct me there.

I am imaging a bunch of PC's. I am looking for a way to prompt the admin for static ip and to add a local user when the box wakes up; either before or after sysprep.

Thanks for your consideration

Link to comment
Share on other sites


Perhaps you can use a modification of the following vbs script. The scipt asks, if configure network with DHCP or set a static IP. when DHCP or an IP with 10. is entered, a proxy is automatically added to Mozillas defualt profile and to IE default profile:

Set wshshell = CreateObject("WScript.Shell")

Set fs = CreateObject("Scripting.FileSystemObject")

ip = "134.76.210.86"

mozpref ="\mozilla\defaults\pref\browser-prefs.js"

msg = "Should be used a static IP "& VbCr &"(if not, DHCP is enabled)?"

antwort = MsgBox(msg, vbYesNo + vbQuestion)

if antwort = vbNo then

befehl ="netsh interface ip set address source=dhcp name= "&"""Local Area Connection"""

kommando = "%COMSPEC% /C " & befehl

resultat = wshshell.Run ( kommando, 1, True )

befehl ="netsh interface ip delete dns name="&"""Local Area Connection""" & " addr=all"

kommando = "%COMSPEC% /C " & befehl

resultat = wshshell.Run ( kommando, 1, True )

befehl ="netsh interface ip delete wins name="&"""Local Area Connection""" & " addr=all"

kommando = "%COMSPEC% /C " & befehl

resultat = wshshell.Run ( kommando, 1, True )

proxy_eintragen(mozpref)

WScript.Quit

end if

Do

ip_neu = InputBox("Please enter the new IP:","Change IP", ip )

pos=InStrRev(ip_neu,".")

gateway = Left(ip_neu,pos) &"254"

If Left(ip_neu, 3) ="10." Then

subnet ="255.255.255.0"

Proxy_eintragen(mozpref)

Else

subnet="255.255.0.0"

End If

befehl ="netsh interface ip set address source=static name= "&"""Local Area Connection"""&" addr="& ip_neu &" mask="& subnet &" gateway="& gateway & " 1"

kommando = "%COMSPEC% /C " & befehl

resultat = wshshell.Run ( kommando, 1, True )

If Not resultat = 0 Then

Msg ="Changing failed" & vbCR & "the IP was:" & ip_neu & vbCR

Msg = Msg & vbCr & "Continue anyway?"

antwort = MsgBox(Msg, vbYesNo + vbQuestion)

End If

Loop While ((Not resultat = 0) And (antwort = vbNo))

Sub Proxy_eintragen(preffile)

programdir = wshshell.ExpandEnvironmentStrings("%programfiles%")

preffile = programdir & preffile

Set file = fs.Getfile(preffile)

file.Attributes = file.Attributes And Not (8+16+64+128+256+1024+2048) And Not 1

Set textstream = fs.OpenTextFile(preffile, 8, True )

textstream.WriteLine "pref(""network.proxy.autoconfig_url"", ""http://www.mpibpc.gwdg.de/cgi-bin/proxy.pl""'>http://www.mpibpc.gwdg.de/cgi-bin/proxy.pl"" );"

textstream.WriteLine "pref(""network.proxy.type"", 2);"

textstream.close

'---------------------------------------------------------------------------------

Set wmireg = GetObject("winmgmts:root\default:StdRegProv")

Const HKCU = &H80000001

key1 = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections"

key2 = "Software\Microsoft\Windows\CurrentVersion\Internet Settings"

result = wmireg.CreateKey(HKCU, key1)

result = wmireg.SetBinaryValue(HKCU, key1,"DefaultConnectionSettings", Array(60,00,00,00,04,00,00,00,05,00,00,00,00,00,00,00,00,00,00,00,42,00,00,00,104,116,116,112,58,47,

47,119,119,119,46,109,112,105,98,112,99,46,103,119,100,103,46,100,101,47,99,103,105,45,98,105,110,47

,112,114,111,120,121,46,112,108,00,00,00,00,00,00,00,00,96,148,157,150,203,30,197,01,01,00,00,00,10,

76,210,86,00,00,00,00,00,00,00,00))

result = wmireg.SetBinaryValue(HKCU, key1,"SavedLegacySettings", Array(60,00,00,00,06,00,00,00,05,00,00,00,00,00,00,00,00,00,00,00,42,00,00,00,104,116,116,112,58,47,

47,119,119,119,46,109,112,105,98,112,99,46,103,119,100,103,46,100,101,47,99,103,105,45,98,105,110,47

,112,114,111,120,121,46,112,108,00,00,00,00,00,00,00,00,96,148,157,150,203,30,197,01,01,00,00,00,10,

76,210,86,00,00,00,00,00,00,00,00))

result = wmireg.CreateKey(HKCU, key2)

result = wmireg.SetDWORDValue(HKCU, key2,"EnableAutodial",0)

result = wmireg.SetStringValue(HKCU, key2,"AutoConfigURL","http://www.mpibpc.gwdg.de/cgi-bin/proxy.pl")

'Proxy im IE eintragen für den Default User

Const HKU = &H80000003

key1 = ".Default\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections"

key2 = ".Default\Software\Microsoft\Windows\CurrentVersion\Internet Settings"

result = wmireg.CreateKey(HKU, key1)

result = wmireg.SetBinaryValue(HKU, key1,"DefaultConnectionSettings", Array(60,00,00,00,04,00,00,00,05,00,00,00,00,00,00,00,00,00,00,00,42,00,00,00,104,116,116,112,58,47,

47,119,119,119,46,109,112,105,98,112,99,46,103,119,100,103,46,100,101,47,99,103,105,45,98,105,110,47

,112,114,111,120,121,46,112,108,00,00,00,00,00,00,00,00,96,148,157,150,203,30,197,01,01,00,00,00,10,

76,210,86,00,00,00,00,00,00,00,00))

result = wmireg.SetBinaryValue(HKU, key1,"SavedLegacySettings", Array(60,00,00,00,06,00,00,00,05,00,00,00,00,00,00,00,00,00,00,00,42,00,00,00,104,116,116,112,58,47,

47,119,119,119,46,109,112,105,98,112,99,46,103,119,100,103,46,100,101,47,99,103,105,45,98,105,110,47

,112,114,111,120,121,46,112,108,00,00,00,00,00,00,00,00,96,148,157,150,203,30,197,01,01,00,00,00,10,

76,210,86,00,00,00,00,00,00,00,00))

result = wmireg.CreateKey(HKU, key2)

result = wmireg.SetDWORDValue(HKU, key2,"EnableAutodial",0)

result = wmireg.SetStringValue(HKU, key2,"AutoConfigURL","http://www.mpibpc.gwdg.de/cgi-bin/proxy.pl")

End Sub

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.


×
×
  • Create New...