Open Tech Support
Open Tech Support Archives
Back to HomeCommunityReviewsGuidesDownloadsTech LinksMarketplaceContact Us
 »  SITE NAVIGATION
»  OTS Home
»  OTS Forums
»  OTS Archives

»  About our site
»  Search our site
»  Support our site

»  What is this site?
»  Who are we?
 
 
 »  ADVERTISMENT
 
  Pages: 1

VBS Help

(Click here to view the original thread with full colors/images)


Posted by: mccormickp

Hi All,

I'm not sure if there is many script master on here, but if someone could help or send me to another forum. What I have have been assigned to do is collect mac addresses from over 300 NAS servers on our company network, now I know I can use the below script to get a MAC of a local machne but I can't get it to work reading a text file with all the server names and output to an excel file with the hostname and mac address.

Hope some one can help, sorry if this is in the wrong area.
Paul

Dim objNetwork : Set objNetwork = WScript.CreateObject("WScript.Network")

Dim objFSO
Dim strOpenFile

Set objShell = CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")

strOpenFile = inputbox("Enter path to input file.", "Server list required","c:\test.txt")
strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")

For Each objItem in colItems
Wscript.Echo objItem.MACAddress
For Each strAddress in objItem.IPAddress
Wscript.Echo strAddress
Next
Next



 
Copyright 2000-2008 Open Tech Support.  All Rights Reserved.  Site Design and Development by Tolitz Rosel.