lbhans Posted September 3, 2008 Share Posted September 3, 2008 Greetings,I am new to WinPE and I am having some difficulty with the network settings.I have built the WinPE environment and have created CDs to boot a system and image it to a locally attached USB drive with no problem. My problem is when I try to image over a network connection. When I boot WinPE, it leases an IP address and connects to the network with no problem. However, when I start the image process from Ghost32, the speed is ridiculously slow. i am pretty sure that it is because the NIC is set to auto detect the speed and duplex whereas the swith is hard set to 100/Full. In our environment, this combination does not work. I need to find a way to force the NIC to 100/Full from withing the WinPE environment. Here is what I have tried already:1. Downloaded a utility called PENETCFG from a website called "The Truth" It work in an XP environment, but not on WinPE since version 2.0 uses a Vista Kernel. At the uggestion of "The Truth", I copied the TCPIPREG.SYS file to the WinPE image and imported the appropriate registry keys to make it work, but still nothing.Is there any other way to configure the NIC settings from within PE?Is there a way to build a PE Image using the XP OS?Any help would be mot appreciatedL Link to comment Share on other sites More sharing options...
Tripredacus Posted September 4, 2008 Share Posted September 4, 2008 The PE will use whatever network speed that the Vista drivers you injected into the WinPE is set for. You should know other things that will force slower network traffic. Also, make sure your NIC on the server is set for the speed you want, or if you are using 2008, check the WDS speed setting. I think the default setting is 100Mbps. Link to comment Share on other sites More sharing options...
lbhans Posted September 8, 2008 Author Share Posted September 8, 2008 I think I know why PENETCFG does not work. When I apply the registry settings to the Booted WinPE iamge, they do not activate and require a reboot, which of course brings the machine back up without the TCPIPREG.Sys working. I need to incorporate those Registry settings in the PE image before I commit it so they will become active as WinPE boots off of the CD. However, the instructions for making the registry changes do not seem to apply since the command lines do not work. I am going to build a separet environment and attempt to make the premanent registry changes before the image is prepped. Link to comment Share on other sites More sharing options...
Tripredacus Posted September 8, 2008 Share Posted September 8, 2008 I believe in order to make registry changes to the PE, you need to mount the image, then mount the offline registry hive and make changes that way. I haven't actually tried this yet but it is the only thing I can think of. Link to comment Share on other sites More sharing options...
Jazkal Posted September 8, 2008 Share Posted September 8, 2008 yes, you would need to mount the reg hive before you finish the winpe wim image. Link to comment Share on other sites More sharing options...
lbhans Posted September 9, 2008 Author Share Posted September 9, 2008 Yep, I did load the System and Software hives and made the changed prior tp prepping the image and committing it. Still no go. I am getting ready to go with BartPE. It has the networkig configurator built in and the documentation is much more intuitive and comprehensive. Link to comment Share on other sites More sharing options...
TheReasonIFail Posted September 9, 2008 Share Posted September 9, 2008 I think I may have a VB script that will set your NIC to 100/Full.Let me see if I can dig it up... Link to comment Share on other sites More sharing options...
TheReasonIFail Posted September 9, 2008 Share Posted September 9, 2008 On Error Resume Next'---- ParameterDirectionEnum Values ----Const adParamInput = &H0001rem Const adParamOutput = &H0002'---- CommandTypeEnum Values ----Const adCmdStoredProc = &H0004rem 3 tasksrem 1. Store in Database - In Progressrem 2. If 100 Full, say 100/ Full - Donerem 3. If not, say Not Set - Donerem 4. Fix it - Donerem 6. Stop & Start the service to make it up-to-date - In ProgressSet StdOut = WScript.StdOutconst HKEY_LOCAL_MACHINE = &H80000002const IDEAL_SPEED = "100"const IDEAL_DUPLEX = "FULL"Class NICInfo Dim MACAddress Dim Name Dim IPAddress Dim MachineName Dim Result Dim NotesEnd ClassDim oNICInfo Set oNICInfo = new NICInfoDim strKeyCurrentPathstrKeyCurrentPath = "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}"Dim strCurrentControlNetworkstrCurrentControlNetwork = "SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002bE10318}"Dim strCurrentVersionstrCurrentVersion = "Software\Microsoft\Windows NT\CurrentVersion"Dim oArrayPropertyTyperem if there are two properties, first property is for 100/10 & second property is for Full/HalfoArrayPropertyType = Array("ConnectionType", "", _ "Duplex", "MediaSpeed", _ "media", "", _ "Media_type", "", _ "MediaSelect", "Duplexmode", _ "MediaSpeed", "", _ "NetworkMedia", "", _ "RequestedMediaType", "", _ "SpeedDuplex", "" )Dim oRegDim oSvcDim WshSHellset WshShell = CreateObject("WScript.Shell")Dim strComputer 'set strComputer = "."Set oDictionary = CreateObject("Scripting.Dictionary")Dim bShowUsagebShowUsage = TrueDim oArgs'If RetrieveArguments() = bShowUsage Then 'Call ShowUsage'Else Call setnicInfo'End Ifrem Get the NIC InfoSub setnicInfo StdOut.Write vbNewLine & _ "----------------------------------------------------------" & vbNewLine & _ "Computer Name" & vbTab & "Result" & vbTab & "Details" & vbNewLine & _ "----------------------------------------------------------" & vbNewLine & _ vbNewLine 'for each oComputer in oDictionary strComputer = "." ' oDictionary.Item(oComputer) err.Clear rem Get WMI object for registry 'Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv") On Error Resume Next Set oReg = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv") If Err.Number <> 0 Then StdOut.WriteLine "Error: (Unavailable Registry at " & strComputer & ") " & Err.Description Else If (GetOSVersion() < 5) Then StdOut.WriteLine "Error: (Computer at " & strComputer & ") Version Less than 5" Else rem Get WMI object for registry On Error Resume Next Set oSvc = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") If Err.Number <> 0 Then StdOut.WriteLine "Error: " & Err.Description Else Dim oArrayPNPDeviceID rem for each oInstNWAC in oSvc.execquery("select * from win32_networkadapterConfiguration where IPEnabled = 'True'") for each oInstNWA in oSvc.execquery("select * from win32_networkadapter where MACAddress <> null") rem where MACAddress = " & Str(oInstNWAC.MACAddress) & "") If (oInstNWA.PNPDeviceID <> empty) Then oArrayPNPDeviceID = Split(oInstNWA.PNPDeviceID, "\", -1, 1) If (oArrayPNPDeviceID(0) <> "ROOT") Then For each oInstNWAC in oSvc.execquery("select * from win32_networkadapterConfiguration where IPEnabled = 'True'") If (oInstNWAC.Caption = oInstNWA.Caption) Then rem Get the Caption for the Network Adapter strCaption = GetRealCaptionStr(oInstNWAC.Caption) rem Continue, only if Connection is Open rem Dim sPnpInstanceIDValue rem sPnpInstanceIDValue = empty rem oReg.GetStringValue HKEY_LOCAL_MACHINE, strCurrentControlNetwork & "\" & oInstNWAC.SettingID & "\Connection", "PnpInstanceID", sPnpInstanceIDValue Dim sNetworkName sNetworkName = empty oReg.GetStringValue HKEY_LOCAL_MACHINE, strCurrentControlNetwork & "\" & oInstNWAC.SettingID & "\Connection", "Name", sNetworkName rem Continue, if there is no error & PnpInstanceID is non-empty If (err.number = 0) Then rem Dim strPropertyDesc rem strPropertyDesc = "" rem strPropertyDesc = rem Print the computer name StdOut.Write strComputer & vbTab oNICInfo.MachineName = oInstNWA.SystemName rem Get the NIC Name oNICInfo.Name = oInstNWA.Caption stop rem Print the MAC Address for the Network Adapter rem StdOut.Write oInstNWA.MACAddress & vbTab oNICInfo.MACAddress = oInstNWA.MACAddress oNICInfo.IPAddress = oInstNWAC.IPAddress(0) GetAllPropertiesDesc(GetLast4Digit(oInstNWA.Caption)) rem StdOut.Write " (" & strPropertyDesc & ")" & vbTab If (True = bStoringToDB) Then StoreToDatabase If (0 <> err.number) Then StdOut.WriteLine "Cant Save to Database. Error: " & Err.Description End If End If StdOut.WriteLine End If End If Next End If End If next End If End If End If 'nextEnd Subrem End Ifrem Get last 4 digits from Caption StringFunction GetLast4Digit(oString) rem split the sting with ] Dim oArray oArray = Split(oString, "]", -1, 1) rem get the last 4 digits from Caption GetLast4Digit = Right(oArray(0), 4)End Functionrem Get Real Caption String from a String received from Registry ValueFunction GetRealCaptionStr(oString) rem split the sting with ] Dim oArray oArray = Split(oString, "]", -1, 1) rem remove the first space too GetRealCaptionStr = LTrim(oArray(1))End Functionrem Get the Properties Description & if found, keep the IndexFunction GetAllPropertiesDesc(str4Digits) Dim Result Result = "FAIL2" Dim strPropertyDesc strPropertyDesc = "" Dim ArrayCount 'Get the Array Count of the Properties stop ArrayCount = UBound(oArrayPropertyType, 1) - LBound(oArrayPropertyType, 1) 'Go through all the Property Array Elements For iCounter = 0 to ArrayCount step 2 strPropertyDesc = GetPropertyDesc(str4Digits, oArrayPropertyType(iCounter)) If (strPropertyDesc <> "") Then If (oArrayPropertyType(iCounter+1) <> "")Then strPropertyDesc = strPropertyDesc & "***" & GetPropertyDesc(str4Digits, oArrayPropertyType(iCounter+1)) End If Exit For End If Next If (strPropertyDesc <> "") Then rem if strPropertyType1ValuDesc contains 100 & Full string, the result is PASS, otherwise its FAIL If ((InStr(1, strPropertyDesc, IDEAL_SPEED, 0)>0) and (InStr(1, UCase(strPropertyDesc), IDEAL_DUPLEX, 0)>0) ) Then StdOut.Write "100/FULL" oNICInfo.Result = "PASS" oNICInfo.Notes = "Speed/Duplex is alreay set to 100FULL" Else StdOut.Write "Not 100 Full" oNICInfo.Result = "FAIL" oNICInfo.Notes = "Speed/Duplex is NOT set to 100FULL" rem Fix It SetPropertyDesc str4Digits, iCounter End If Else StdOut.Write "ERROR" oNICInfo.Result = "FAIL" oNICInfo.Notes = "Couldnt Find the Registery Value for NIC Properties" End IfEnd FunctionFunction GetPropertyDesc(str4Digits, strPropertyType) Dim strPropertyDesc strPropertyDesc = "" rem get the registry value for the specific type of adapter oReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyCurrentPath & "\" & str4Digits, strPropertyType, strTempValue rem get the real string value for the registry value oReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyCurrentPath & "\" & str4Digits & "\Ndi\params\" & strPropertyType & "\enum", strTempValue, strPropertyDesc GetPropertyDesc = strPropertyDescEnd FunctionSub SetPropertyDesc(str4Digits, iCoutner) rem get the real string value for the registry value oReg.EnumValues HKEY_LOCAL_MACHINE, strKeyCurrentPath & "\" & str4Digits & "\Ndi\params\" & oArrayPropertyType(iCoutner) & "\enum", arrValueNames1, arrValueTypes1 rem Clear all the previous errors Err.Clear rem Go through all the sub keys For i=0 To UBound(arrValueNames1) If ("" = oArrayPropertyType(iCoutner+1)) Then oReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyCurrentPath & "\" & str4Digits & "\Ndi\params\" & oArrayPropertyType(iCoutner) & "\enum", arrValueNames1(i), arrValue If ((InStr(1, arrValue, IDEAL_SPEED, 0)>0) and (InStr(1, UCase(arrValue), IDEAL_DUPLEX, 0)>0)) Then oReg.SetStringValue HKEY_LOCAL_MACHINE, strKeyCurrentPath & "\" & str4Digits, oArrayPropertyType(iCoutner), arrValueNames1(i) rem if any eror print & exit If Err.Number <> 0 Then StdOut.WriteLine "FAIL2: Couldnt Fix it for Value of " & oArrayPropertyType(iCoutner) & "Error:" & Err.Description oNICInfo.Result = "FAIL" oNICInfo.Notes = "Can NOT fix Speed/Duplex=100FULL; Error:" & Err.Description Else StdOut.WriteLine "PASS2" oNICInfo.Result = "PASS" oNICInfo.Notes = "Fixed Speed/Duplex=100FULL" End If Exit For End If Else oReg.EnumValues HKEY_LOCAL_MACHINE, strKeyCurrentPath & "\" & str4Digits & "\Ndi\params\" & oArrayPropertyType(iCoutner+1) & "\enum", arrValueNames2, arrValueTypes2 rem Go through all the sub keys For j=0 To UBound(arrValueNames2) oReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyCurrentPath & "\" & str4Digits & "\Ndi\params\" & oArrayPropertyType(iCoutner) & "\enum", arrValueNames2(j), arrValue If (InStr(1, UCase(arrValue), IDEAL_DUPLEX, 0)>0) Then oReg.SetStringValue HKEY_LOCAL_MACHINE, strKeyCurrentPath & "\" & str4Digits, oArrayPropertyType(iCoutner), arrValueNames2(j) rem if any eror print & exit If Err.Number <> 0 Then StdOut.WriteLine "FAIL2: Couldnt Enter Value of " & oArrayPropertyType(iCoutner+1) & Err.Description oNICInfo.Result = 0 oNICInfo.Notes = "Can NOT fix Speed/Duplex=100FULL; Error:" & Err.Description Else StdOut.WriteLine "PASS2: Could Fix it" oNICInfo.Result = 1 oNICInfo.Notes = "Fixed Speed/Duplex=100FULL" End If Exit For End if Next End If Next rem get the registry value for the specific type of adapter rem oReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyCurrentPath & "\" & str4Digits, strPropertyType, strTempValueEnd SubFunction GetOSVersion() rem Get OS Version from the Current Version Registry Key oReg.GetStringValue HKEY_LOCAL_MACHINE, strCurrentVersion, "CurrentVersion", strTempValue GetOSVersion = strTempValueEnd FunctionSub ShowUsage StdOut.WriteLine "---------------------------" StdOut.Write "setnic.vbs - Sets the NIC's Speed & Duplex to 100 FULL & displays WINS Name, Result, Details" & vbNewLine StdOut.WriteLine "---------------------------" StdOut.Write vbNewLine & _ "Help Information: " & vbNewLine & _ "Set NIC's Speed & Duplex to 100 FULL & displays WINS Name, Result, Details(PASS1, if no need to change, FAIL1PASS2 if could fix it, FAIL1FAIL2 if couldnt fix it)" & vbNewLine & _ "setnic.vbs -m/-Machine WINSName1 [WINSName2] [WINSName3] [...]" & vbNewLine & _ "or setnic.vbs -m . for the localmachine" & vbNewLine & _ vbNewLine & _ "Parameters:" & vbNewLine & _ "WINSName1,2,...Use Machine Name(WINS Name) as the argument to get NIC info. " & vbNewLine & _ vbNewLine & _ "WINSFileName Use .dat FileName as the argument to get NIC info. " & vbNewLine & _ vbNewLine & _ "Example:" & vbNewLine & _ "setnic.vbs -m Computername1 Computername2" & vbNewLine & _ "or setnic.vbs -m . " & vbNewLine & _ "or setnic.vbs -h" & vbNewLine & _ vbNewLine & _ "Error:" & vbNewLine & _ "If the computer doesnt exist or user running the script doesnt have permission to access, it will print an error" & vbNewLine StdOut.WriteLine "---------------------------"End SubFunction RetrieveArguments() Set oArgs = WScript.Arguments ArgsCount = oArgs.Count Dim iCounter iCounter = 0 bGotFile = False bGotMachine = False oComputerCount = 0 rem Get all the Arguments in the Computer Name Array While (iCounter < ArgsCount) LowerArg = LCase(oArgs(iCounter)) Select Case LowerArg Case "/?", _ "/help", _ "/h", _ "-h", _ "--help" RetrieveArguments = True Exit Function 'Case "-Machine", _ ' "-m" ' If (bGotFile = True) or (bGotMachine = True) Then ' RetrieveArguments = True ' Exit Function ' End If 'bGotMachine = True Case Else If (bGotMachine = True) Then oDictionary.Add oComputerCount, oArgs(iCounter) oComputerCount = oComputerCount + 1 set strComputer = "." Else RetrieveArguments = True Exit Function End If End Select iCounter = iCounter + 1 WEndEnd Function Link to comment Share on other sites More sharing options...
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