Home
> InDesign Scripts > Get network adapter Name/MAC/Speed
Get network adapter Name/MAC/Speed
Yesterday we had example how to read IP/Gateway with help of VBscript. Todaw we will try to get Adapter info and MAC address. On some systems, I don’t know why, but adapters are duplicated, so you can later convert values to array, and delete unwanted ones.
First, copy this script and save it in our scripts folder with following name: GetMyAdapter.vbs
strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set IPConfigSet = objWMIService.ExecQuery ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True") Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\WMI") Set AdaptInfo = objWMI.InstancesOf("MSNdis_LinkSpeed WHERE Active = True",48) For Each adaptInfo in AdaptInfo AdaptNameLink = AdaptNameLink & adaptInfo.InstanceName & vbNewLine AdaptSpeed = AdaptSpeed & adaptInfo.NdisLinkSpeed & vbNewLine Next For Each IPConfig in IPConfigSet If Not IsNull(IPConfig.Description) Then AdaptName = AdaptName + IPConfig.Description & vbNewLine End If If Not IsNull(IPConfig.MACAddress) Then MACadd = MACadd + IPConfig.MACAddress & vbNewLine End If Next app.scriptArgs.SetValue "myAdaptNameLink", AdaptNameLink app.scriptArgs.SetValue "myAdaptSpeed", AdaptSpeed app.scriptArgs.SetValue "myAdapt", AdaptName app.scriptArgs.SetValue "myMAC", MACadd
Now, let’s open new Javascript file, and paste this script:
app.doScript(File(app.activeScript.path+'/GetMyAdapter.vbs'), ScriptLanguage.visualBasic); var myAdaptName = app.scriptArgs.getValue("myAdaptNameLink"); var myAdaptSpeed = app.scriptArgs.getValue("myAdaptSpeed"); var myAdapt = app.scriptArgs.getValue("myAdapt"); var myMAC = app.scriptArgs.getValue("myMAC");
Notice that myAdaptSpeed is in bytes per second!
With this technique we can receive all kind of info, for example, Windows serial number, hard disk drive serial number, and really great stuff, so if you are interested, feel free to contact me.
Have fun! 😉
Categories: InDesign Scripts
InDesign CS4, InDesign CS5
Is it possible to make the same technique in photoshop or ExtendedScript tool kit? Or is it only for inDesign? I am using PS CS3. Thanks a lot.