NIM Posted August 6, 2006 Posted August 6, 2006 'Changes Windows NT clients from using static IP address's to use DHCP. Could be called from the logon script. Combined with the use of the SU utility this could be added to a logon script to perform a hands off migration.'All variables declaredOption ExplicitDim oWSHShellDim sNIC, sManDim iCountSet oWSHShell = Wscript.CreateObject("Wscript.Shell")' Set the DCHP service to autostartoWSHShell.RegWrite "HKLM\SYSTEM\CurrentControlSet\Services\DHCP\Start", 2' Get Network cardOn Error Resume NextiCount = 1Do sNIC = oWSHShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\" & iCount & "\ServiceName") sMan = oWSHShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\" & iCount & "\Manufacturer") ' Skip the Async and NDIS services If sMan <> "Microsoft" And Err.Number = 0 Then Call SetNIC End If iCount = iCount + 1Loop Until Err.Number <> 0' Clear the errorErr.Clear' End of ScriptSub SetNIC Dim iTest ' Set the NIC service to use DHCP sNIC = "HKLM\SYSTEM\CurrentControlSet\Services\" & sNIC &"\Parameters\TCPIP\" iTest = oWSHShell.RegRead(sNIC & "EnableDHCP") If iTest = 0 Then oWSHShell.RegWrite sNIC & "EnableDHCP", 1, "REG_DWORD" oWSHShell.RegWrite sNIC & "IPAddress", "0.0.0.0", "REG_MULTI_SZ" oWSHShell.RegWrite sNIC & "SubnetMask", "0.0.0.0", "REG_MULTI_SZ" End IfEnd Sub Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.