`Felix` Posted May 18, 2008 Share Posted May 18, 2008 Hi there,Firstly i am not a programmer by any means, however i have in the past couple of days being teaching myself as i go some VBscript. I started off working with a Script By Gunsmokingman that automates oeminfo.ini creation. The problem with the original is that it was written for Vista and i wanted to use it with XP. Anyway after much investigation and trial and error i have managed to get most of the things working i wanted to have in the script and have added some new features also. The one problem i am having that i haven't found a solution to is that in a system with multiple NIC's i want to simply add the the default Nic (Local Area Connection) to the OEMinfo.ini file. I have everything i need except i can't seem to get the correct IP address added - it adds the last in the array.Anyway below is the portion code i have been working with and i would greatly appreciate it if one of you VB guru's can help with out with some clues to solving this issue. '/-----------------------------------------------------------------------> Set colItems = ObjWMI.ExecQuery("Select IPAddress, MACAddress from Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE") '/-----------------------------------------------------------------------> For Each objItem in colItems If Not IsNull(objItem.IPAddress) Then For i=LBound(objItem.IPAddress) To UBound(objItem.IPAddress) IP = objItem.IPAddress(i) Next End If Next '/-----------------------------------------------------------------------> Set colItems = ObjWMI.ExecQuery( "SELECT * FROM Win32_NetworkAdapter WHERE NetConnectionID = 'Local Area Connection'") '/-----------------------------------------------------------------------> Cnt = 1 For Each objItem in colItems If Cnt = 1 Then C1 = C1 +1 Ts.WriteLine "Line" & C1 & "=" & TitleL & "NETWORK ADAPTER INFORMATION" & TitleR C1 = C1 +1 Ts.WriteLine "Line" & C1 & "=" & S_3 & "Adapter Name " & vbTab & objItem.Name C1 = C1 +1 Ts.WriteLine "Line" & C1 & "=" & S_3 & "Manufacturer By " & vbTab & objItem.Manufacturer C1 = C1 +1 Ts.WriteLine "Line" & C1 & "=" & S_3 & "IP Address " & vbTab & IP C1 = C1 +1 Ts.WriteLine "Line" & C1 & "=" & S_3 & "MACAddress " & vbTab & objItem.MACAddress C1 = C1 +1 Ts.WriteLine "Line" & C1 & "=" Exit For End If Next Cnt = 0Cheers,Felix Link to comment Share on other sites More sharing options...
gunsmokingman Posted May 18, 2008 Share Posted May 18, 2008 Check out Updated MkOem_V6 as it been updated. 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