Skip to content

Instantly share code, notes, and snippets.

@ynkdir
Created January 28, 2015 15:12
Show Gist options
  • Save ynkdir/1dc8ced8e3fd9eccdb88 to your computer and use it in GitHub Desktop.
Save ynkdir/1dc8ced8e3fd9eccdb88 to your computer and use it in GitHub Desktop.
wmitest.js
// [Scripting API for WMI](https://msdn.microsoft.com/en-us/library/aa393258.aspx)
var SWbemServices = GetObject("winmgmts:");
//var SWbemServices = GetObject("winmgmts:{impersonationLevel=impersonate}");
//var SWbemServices = GetObject("winmgmts:\\\\.\\root\\cimv2")
var objWbemObjectSet = SWbemServices.InstancesOf("Win32_NetworkAdapterConfiguration");
//var objWbemObjectSet = SWbemServices.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration")
for (var e = new Enumerator(objWbemObjectSet); !e.atEnd(); e.moveNext()) {
var s = e.item();
WScript.Echo(s.Caption);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment