buddy Posted December 5, 2004 Posted December 5, 2004 Hello all,how can i get the PCI BUSNUMBER X, Device X, Function X of networkcardsautomatic to write the unattend.txt dynamicly, if I have two or more network cards?Is there a way to do it with wmi (vbscript) or the devcon.exe utility or other reskit utility from microsoft?I only found it in registryHKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\PCI\VEN_1039&DEV_0900&SUBSYS_0A141019&REV_90\3&61aaa01&0&18in LocationInformation = PCI bus 0, device 3, function 0There must be a simple way to do it?I tried it with the following wmi class Win32_PnPSignedDriver.byeBuddy
ChrisBaksa Posted December 6, 2004 Posted December 6, 2004 I used to hard code it based on the servers I support. But that got ugly.Now we use a custom application that breaks out all that information and writes it to a reg key in PE. HKLM\SOFTWARE\MYDATEA\Adapter 1 - All the values I needHKLM\SOFTWARE\MYDATEA\Adapter 2 - All the values I needHKLM\SOFTWARE\MYDATEA\Adapter 3 - All the values I needI just read the key i need.Chris
captcalc Posted September 30, 2005 Posted September 30, 2005 I'd recommend getting the MAC Address using WMI and then using that value with the NetCardAddress Setting in the unattend.txt.To get the Mac Address use the MacAddress property from the Win32_NetworkAdapterConfiguration object)You can then insert this value directly into your unattend.txt like below: NetCardAddress=00:00:00:00:00And when you use the NetCardAddress Setting, you don't have to use the PCI Bus, Device, and Function Number settings to distinguish which card you are using. Good Luck!captcalc
George Sovetov Posted April 19, 2019 Posted April 19, 2019 In newer Windows versions (since Windows Vista, I guess) the same information is accessible through WMI: PS C:\Users\Administrator> (gwmi win32_pnpEntity -Filter 'manufacturer like "Red Hat%"')[5].getDeviceProperties().deviceproperties | ft keyName,data keyName data ------- ---- DEVPKEY_Device_DeviceDesc Red Hat VirtIO Ethernet Adapter DEVPKEY_Device_HardwareIds {PCI\VEN_1AF4&DEV_1000&SUBSYS_00011AF4&REV_00, PCI\VEN_1AF4&DEV_1000&SUBSYS_00011AF4, PCI\VEN_1AF4&DEV_1000&CC_020000, PCI\VEN_1AF4&DEV_1000&CC_0200} DEVPKEY_Device_CompatibleIds {PCI\VEN_1AF4&DEV_1000&REV_00, PCI\VEN_1AF4&DEV_1000, PCI\VEN_1AF4&CC_020000, PCI\VEN_1AF4&CC_0200...} DEVPKEY_Device_Service netkvm DEVPKEY_Device_Class Net DEVPKEY_Device_ClassGuid {4D36E972-E325-11CE-BFC1-08002BE10318} DEVPKEY_Device_Driver {4d36e972-e325-11ce-bfc1-08002be10318}\0006 DEVPKEY_Device_ConfigFlags 0 DEVPKEY_Device_Manufacturer Red Hat, Inc. DEVPKEY_Device_FriendlyName Red Hat VirtIO Ethernet Adapter #6 DEVPKEY_Device_LocationInfo PCI bus 0, device 17, function 0 DEVPKEY_Device_PDOName \Device\NTPNP_PCI0011 DEVPKEY_Device_Capabilities 0 DEVPKEY_Device_BusTypeGuid {C8EBDFB0-B510-11D0-80E5-00A0C92542E3} DEVPKEY_Device_LegacyBusType 5 DEVPKEY_Device_BusNumber 0 DEVPKEY_Device_EnumeratorName PCI DEVPKEY_Device_Address 1114112 DEVPKEY_Device_PowerData {56, 0, 0, 0...} DEVPKEY_Device_RemovalPolicy 1 DEVPKEY_Device_RemovalPolicyDefault 1 DEVPKEY_Device_InstallState 0 DEVPKEY_Device_BaseContainerId {00000000-0000-0000-FFFF-FFFFFFFFFFFF} DEVPKEY_NAME Red Hat VirtIO Ethernet Adapter #6 DEVPKEY_Device_InstanceId PCI\VEN_1AF4&DEV_1000&SUBSYS_00011AF4&REV_00\3&267A616A&0&88 DEVPKEY_Device_DevNodeStatus 25174026 DEVPKEY_Device_ProblemCode 0 DEVPKEY_Device_Parent ACPI\PNP0A03\0 DEVPKEY_Device_Siblings {PCI\VEN_8086&DEV_1237&SUBSYS_00000000&REV_02\3&267a616a&0&00, PCI\VEN_8086&DEV_7000&SUBSYS_00000000&REV_00\3&267a616a&0&08, PCI\VEN_80EE&DEV_BEEF&SUBSYS_00000000&REV_00\3&267a616a&0&10, PCI\VEN_1AF4&DEV_1000&SUBSYS_00011AF4&REV_00\3&267a616a&0&18...} DEVPKEY_Device_SafeRemovalRequired False DEVPKEY_Device_ContainerId {00000000-0000-0000-FFFF-FFFFFFFFFFFF} DEVPKEY_Device_IsPresent True DEVPKEY_Device_HasProblem False {83DA6326-97A6-4088-9453-A1923F573B29} 15 True DEVPKEY_Device_IsRebootRequired False DEVPKEY_Device_ReportedDeviceIdsHash 1342956424 DEVPKEY_Device_InLocalMachineContainer True DEVPKEY_Device_Stack {\Driver\netkvm, \Driver\pci} {A8B865DD-2E3D-4094-AD97-E593A70C75D6} 26 False {3464F7A4-2444-40B1-980A-E0903CB6D912} 10 2 DEVPKEY_PciDevice_DeviceType 0 DEVPKEY_PciDevice_CurrentSpeedAndMode 0 DEVPKEY_PciDevice_BaseClass 2 DEVPKEY_PciDevice_SubClass 0 DEVPKEY_PciDevice_ProgIf 0 DEVPKEY_PciDevice_InterruptSupport 1 DEVPKEY_PciDevice_BarTypes 1 DEVPKEY_PciDevice_S0WakeupSupported True DEVPKEY_PciDevice_RequiresReservedMemoryRegion False DEVPKEY_Device_BusReportedDeviceDesc Ethernet Controller DEVPKEY_Device_ConfigurationId oem2.inf:PCI\VEN_1AF4&DEV_1000&SUBSYS_00011AF4&REV_00,kvmnet6.ndi {80497100-8C73-48B9-AAD9-CE387E19C56E} 6 6 {83DA6326-97A6-4088-9453-A1923F573B29} 3 oem2.inf:664f42767dbc5606:kvmnet6.ndi:100.74.104.14100:PCI\VEN_1AF4&DEV_1000&SUBSYS_00011AF4&REV_00 {83DA6326-97A6-4088-9453-A1923F573B29} 10 ACPI\PNP0A03\0 {83DA6326-97A6-4088-9453-A1923F573B29} 18 0 DEVPKEY_Device_InstallDate 20190404180902.239000-420 DEVPKEY_Device_FirstInstallDate 20190404174841.372159-420 DEVPKEY_Device_LastArrivalDate 20190416120950.133039-420 DEVPKEY_Device_LocationPaths {PCIROOT(0)#PCI(1100), ACPI(_SB_)#ACPI(PCI0)#PCI(1100)} DEVPKEY_Device_DriverDate 20170718170000.000000-420 DEVPKEY_Device_DriverVersion 100.74.104.14100 DEVPKEY_Device_DriverDesc Red Hat VirtIO Ethernet Adapter DEVPKEY_Device_DriverInfPath oem2.inf DEVPKEY_Device_DriverInfSection kvmnet6.ndi DEVPKEY_Device_MatchingDeviceId PCI\VEN_1AF4&DEV_1000&SUBSYS_00011AF4&REV_00 DEVPKEY_Device_DriverProvider Red Hat, Inc. DEVPKEY_Device_DriverRank 16711680 {F0E20F09-D97A-49A9-8046-BB6E22E6BB2E} 2 {1, 0, 0, 0...} (This device is taken as an example.) Besides Location, device and function numbers are encoded in Address variable, it's a DWORD, the higher word of which is device number and the lower one is function: PS C:\Users\Administrator> (gwmi Win32_Bus -Filter 'DeviceID like "PCI%"').GetRelated('Win32_PnPEntity').GetDeviceProperties('DEVPKEY_Device_Address').deviceProperties | ft DeviceID,keyName,{$_.data -shr 16},{$_.data -band 0xFFFF} DeviceID keyName $_.data -shr 16 $_.data -band 0xFFFF -------- ------- --------------- -------------------- PCI\VEN_8086&DEV_7000&SUBSYS_00000000&REV_00\3&267A616A&0&08 DEVPKEY_Device_Address 1 0 PCI\VEN_80EE&DEV_CAFE&SUBSYS_00000000&REV_00\3&267A616A&0&20 DEVPKEY_Device_Address 4 0 PCI\VEN_8086&DEV_2829&SUBSYS_00000000&REV_02\3&267A616A&0&68 DEVPKEY_Device_Address 13 0 PCI\VEN_8086&DEV_1237&SUBSYS_00000000&REV_02\3&267A616A&0&00 DEVPKEY_Device_Address 0 0 PCI\VEN_1AF4&DEV_1000&SUBSYS_00011AF4&REV_00\3&267A616A&0&18 DEVPKEY_Device_Address 3 0 PCI\VEN_1AF4&DEV_1000&SUBSYS_00011AF4&REV_00\3&267A616A&0&40 DEVPKEY_Device_Address 8 0 PCI\VEN_1AF4&DEV_1000&SUBSYS_00011AF4&REV_00\3&267A616A&0&48 DEVPKEY_Device_Address 9 0 PCI\VEN_1AF4&DEV_1000&SUBSYS_00011AF4&REV_00\3&267A616A&0&50 DEVPKEY_Device_Address 10 0 PCI\VEN_1AF4&DEV_1000&SUBSYS_00011AF4&REV_00\3&267A616A&0&80 DEVPKEY_Device_Address 16 0 PCI\VEN_1AF4&DEV_1000&SUBSYS_00011AF4&REV_00\3&267A616A&0&88 DEVPKEY_Device_Address 17 0 PCI\VEN_1AF4&DEV_1000&SUBSYS_00011AF4&REV_00\3&267A616A&0&90 DEVPKEY_Device_Address 18 0 PCI\VEN_1AF4&DEV_1000&SUBSYS_00011AF4&REV_00\3&267A616A&0&98 DEVPKEY_Device_Address 19 0 PCI\VEN_80EE&DEV_BEEF&SUBSYS_00000000&REV_00\3&267A616A&0&10 DEVPKEY_Device_Address 2 0
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now