Link to home
Start Free TrialLog in
Avatar of campbell1972
campbell1972

asked on

Formatting Powershell Get-Counter Output

I'm looking to create an HTML table populated with a number of performance counters derived from the Get-Counter command.

The table should consist of 3 columns only: Set, Counter, Value.

I've performed the usual Google searches looking for an example but nothing has met the above criteria as of yet.

Does anybody have any useful pointers or examples I could refer to to achieve the above?
Avatar of Qlemo
Qlemo
Flag of Germany image

I did not try if it works out reasonably, but the generic answer is
get-counter ... | select set, name, value | convertTo-HTML

Open in new window

name maybe something different. The great pro with PowerShell is that you can try at the command prompt, and refine your command until satisfied.
Avatar of campbell1972
campbell1972

ASKER

I've now got this working by creating an array consisting of all the counters I wish to snapshot and passing this through a get-counter statement to tidy up the output

What I would now like to do is parse the Path property (i.e. \\server\set\counter) so that server, set and counter may be presented as three separate objects in the final select statement.

Any pointers as to how best to perform this parsing within the confines of a select statement and subsequently renaming the property?

Many Thanks
ASKER CERTIFIED SOLUTION
Avatar of Qlemo
Qlemo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Great stuff Qlemo ... learnt plenty of syntax today!

Thanks again for the help.

JC
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial