Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Easy question

Closed Thread
 
Thread Tools Display Modes
Old 05-12-2008   #1 (permalink)
jason
Guest


 

Easy question

What am I doing wrong with this? It is not returning anything. Running just
the get-wmiobject does.



$v = get-wmiobject -query "select PercentProcessorTime from
Win32_PerfFormattedData_PerfOS_Processor where name = '_Total'"

write-host $v

Old 05-12-2008   #2 (permalink)
Kiron
Guest


 

Re: Easy question

Could be Write-Host mishandling a System.Management.ManagementObject because it doesn't have a ToString() method... not sure.

# try:
write-host $v.PercentProcessorTime

# some properties and values
$v

# available properties and values
$v | fl *

--
Kiron
Old 05-12-2008   #3 (permalink)
Kiron
Guest


 

Re: Easy question

Correction, its inherited ToString() Method outputs a blank line. Write-Host uses the object's ToStrimg() Method and $v.toString() outputs a blank line.

$d = date
$d | gm ToString
$d.toString()
"$d"
write-host $d


$v | gm ToString
$v.toString()
"$v"
write-host $v

--
Kiron
Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows Easy Transfer Question 2 RonE22 Vista General 0 06-01-2008 09:09 AM
One easy question.. irish-grouse Vista installation & setup 6 05-08-2007 05:18 PM
Easy Question???? Perplexed Vista General 11 05-04-2007 08:26 PM
Easy Transfer Question---need help please? Boots911 Vista General 1 02-24-2007 11:09 PM
Easy Transfer Question Carl Bauman Vista General 0 06-12-2006 08:27 AM








Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50