OK this is definately not what you were asking for, but it does show that you don't need to use (which means install) PowerShell to query WMI data.
Anyway, I find it useful to quickly sus-out wether what I need is easily accesible from WMI, and specifically from the user account in which intend on running it from. Well, [scriptomatic] is more flexible...
It's a HTA (HTML Application), so pretty much any Windows box can run it, even Windows 98SE (with the WMI 1.5 core installed) - be kind, it works:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<script language="vbscript">
Option Explicit
sub Main
' on error resume next
Dim i, na, o, s, wmi
Set wmi = GetObject("winmgmts:\\.\root\cimv2")
Set na = wmi.ExecQuery ("Select * From Win32_NetworkAdapterConfiguration")
output na.Count & " Network Adapters"
for each o in na
s = o.Path_.Class & ": " & o.Properties_.Count & " properties" & VbCrLf
for each i in o.Properties_
s = s & " " & i.Name & ": " & getPropVal(i) & VbCrLf
next
outputSect o.Description, s
next
end sub
'//////////////////////////////////////////////////////////
sub dispDiv()
dim b, e, v
set e = window.event.srcElement
' Find the appropriate div to be displayed/hidden, based on event source and IDs.
b = False
if (e.id = "Section") then
set e = window.event.srcelement.children(2)
b = True
elseif (e.id = "Symbol") or (e.id = "Caption") then
set e = window.event.srcElement.parentElement.children(2)
b = True
end if
if not b then exit sub
' Toggle display
v = "none"
if e.style.display = v then v = "block"
e.style.display = v
if v = "none" then v = "+" else v = "-"
e.parentElement.children(0).innerText = v
window.event.returnValue = False 'Cancel event bubble.
end sub
'//////////////////////////////////////////////////////////
Function getPropVal(p)
dim i, s, v
v = p.Value
if not isNull(v) then
if isObject(v) then
s = TypeName(v)
elseif isArray(v) then
for each i in v: s = s & CStr(i): next
else
s = CStr(v)
end if
end if
getPropVal = s
End Function
'//////////////////////////////////////////////////////////
sub outHR
dim e
set e = document.createElement("HR")
document.body.insertAdjacentElement "beforeEnd", e
end sub
'//////////////////////////////////////////////////////////
sub output( sText )
dim e
set e = document.createElement("PRE")
e.innerText = sText
document.body.insertAdjacentElement "beforeEnd", e
end sub
'//////////////////////////////////////////////////////////
sub outputSect( sCaption, sText )
dim e, ec
set e = document.createElement("PRE")
e.style.backgroundColor = "beige"
e.onclick = GetRef("dispDiv")
e.id = "Section"
e.title = "Click to expand or collapse this section"
set ec = document.createElement("SPAN")
ec.style.border = "1px solid"
ec.style.paddingLeft = "0.25em"
ec.style.paddingRight = "0.25em"
ec.style.fontSize = "80%"
ec.innerText = "+"
ec.id = "Symbol"
e.appendChild ec
set ec = document.createElement("SPAN")
ec.style.marginLeft = "0.5em"
ec.innerText = sCaption
ec.id = "Caption"
e.appendChild ec
set ec = document.createElement("PRE")
ec.style.display = "none"
ec.style.backgroundColor = "cornsilk"
ec.style.marginLeft = "1.25em"
ec.innerText = sText
e.appendChild ec
document.body.insertAdjacentElement "beforeEnd", e
end sub
'//////////////////////////////////////////////////////////
function padStr( s, n )
dim z
if not IsNumeric(n) then exit function
z = n - Len(s)
if z < 0 then z = 0
padStr = s & space(z)
end function
</script>
</head>
<body onload="Main">
<h3>Network Adapter Info</h3>
Expand or collapse each section below, by clicking on the section title or body.
</body>
</html>
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.