Daorge Posted August 29, 2008 Posted August 29, 2008 Hey guys, i wasnt sure where to post this so please let me know if this is the wrong spot. I am trying to find a way to locate and add a key to the registry for NIC settings. However they have GUIDs and am unsure of how to add the key to all GUIDs in that section. This is the vbscript i am calling when I enter my registry file. The problem is it only adds the values to the main network connection "Local Area Connection" Some of our servers have more than one NIC and id rather see if I can find a way to modify all GUIDs in "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\" rather than searching for the Local Area Connection. Any one better with vbscript that can help out?Option ExplicitMain( )function Main() DIM objShare DIM objEveryColl Dim oWSHShell Dim sNIC, sMan Dim iCount Set oWSHShell = WScript.CreateObject("WScript.Shell") set objShare = Wscript.CreateObject("HNetCfg.HNetShare.1") if(IsObject(objShare) = FALSE ) then exit function end if set objEveryColl = objShare.EnumEveryConnection if (IsObject(objEveryColl) = TRUE) then DIM objNetConn dim guid for each objNetConn in objEveryColl DIM objShareCfg set objShareCfg = objShare.INetSharingConfigurationForINetConnection(objNetConn) if (IsObject(objShareCfg) = TRUE) then DIM objNCProps set objNCProps = objShare.NetConnectionProps(objNetConn) if (IsObject(objNCProps) = TRUE) then if objNCProps.Name="Local Area Connection" then 'Change to represent the connection to change Guid=objNCProps.Guid oWSHShell.RegWrite "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\" & guid & "\MTU", 00000546,"REG_DWORD" oWSHShell.RegWrite "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\" & guid & "\TcpWindowSize",65535,"REG_DWORD" end if end if end if next end ifend function
Daorge Posted August 29, 2008 Author Posted August 29, 2008 Well I think i figured it out. by removing "if objNCProps.Name="Local Area Connection" then 'Change to represent the connection to change"and one of the End If statements I believe it is working. I need to test it on a few other servers to know for sure, but ill let you know how it goes if anyone else is interested.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now