defecta
asked on
PowerShell noob: script optimisation. Is there a better way to do this?
Hey guys,
I am trying to hack my way through teaching myself PowerShell by looking at code examples online and doing a lot of testing and reading. I am also working my way through some books that I bought but I haven't yet learned what a better way to do what I am doing here in this code example.
Basically i want to see ALL the methods and properties and their values listed for the WMI object "Win32_NetworkAdapterConfi guration" in the code example shown below, not just the rather brief version that it returns if no other format parameters are specified.
This code example does what I want but it seems awfully verbose to me. Is there a more clever and concise to acheive the same output?
Cheers,
AC
I am trying to hack my way through teaching myself PowerShell by looking at code examples online and doing a lot of testing and reading. I am also working my way through some books that I bought but I haven't yet learned what a better way to do what I am doing here in this code example.
Basically i want to see ALL the methods and properties and their values listed for the WMI object "Win32_NetworkAdapterConfi
$member = Get-WmiObject -Class Win32_NetworkAdapterConfiguration -ComputerName $computerName | Where { $_.IPEnabled -eq $enabledAdapters} | get-member
Get-WmiObject -Class Win32_NetworkAdapterConfiguration -ComputerName $computerName | Where { $_.IPEnabled -eq $enabledAdapters} | Format-list $member.name
This code example does what I want but it seems awfully verbose to me. Is there a more clever and concise to acheive the same output?
Cheers,
AC
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER