Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - [uint64] - [uint64] not defined

Reply
 
Old 05-02-2007   #1 (permalink)
Keith Hill [MVP]


 
 

[uint64] - [uint64] not defined

This blows:

352# $v = [uint64]54
353# $v | gtn
UInt64
354# $y = [uint64]454545454545
355# $y - $v
The operation '[System.UInt64] - [System.UInt64]' is not defined.
At line:1 char:5
+ $y - <<<< $v

I was trying to do some math on Win32_LogicalDisk (freespace and size).

--
Keith



My System SpecsSystem Spec
Old 05-03-2007   #2 (permalink)
Thomas Lee


 
 

Re: [uint64] - [uint64] not defined

In message <#Yujd9RjHHA.2272@TK2MSFTNGP02.phx.gbl>, "Keith Hill [MVP]"
<r_keith_hill@no.spam.thank.u.hotmail.com> writes
>This blows:
>
>352# $v = [uint64]54
>353# $v | gtn
>UInt64
>354# $y = [uint64]454545454545
>355# $y - $v
>The operation '[System.UInt64] - [System.UInt64]' is not defined.
>At line:1 char:5
>+ $y - <<<< $v
>
>I was trying to do some math on Win32_LogicalDisk (freespace and size).


$y + $v returns:

Cannot convert value "454545454545" to type "System.Int32". Error:
"Value was either too large or too small for an Int32."
At line:1 char:


Bug??
--
Thomas Lee
doctordns@gmail.com
MVP - Admin Frameworks and Security

My System SpecsSystem Spec
Old 05-03-2007   #3 (permalink)
Keith Hill


 
 

Re: [uint64] - [uint64] not defined

"Thomas Lee" <tfl@psp.co.uk> wrote in message
news:gbcgMgPX3aOGFAn1@mail.psp.co.uk...
> In message <#Yujd9RjHHA.2272@TK2MSFTNGP02.phx.gbl>, "Keith Hill [MVP]"
> Cannot convert value "454545454545" to type "System.Int32". Error: "Value
> was either too large or too small for an Int32."
> At line:1 char:
>
>
> Bug??


Or limitation. Either way I think it should be fixed. Someone already
submitted this issue:

https://connect.microsoft.com/feedba...4700&SiteID=99

so I voted on it.

--
Keith

My System SpecsSystem Spec
Old 05-03-2007   #4 (permalink)
Kiron


 
 

RE: [uint64] - [uint64] not defined

You can cast the (System.UInt64) WMI property into (System.Int64):
[long]$a = (gwmi win32_logicaldisk -filter "Name='c:'").size
--
Kiron
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Test if a variables is defined or not .NET General
Check if user defined in SD VB Script
nothing highly defined in HD Graphic cards
How can I tell if a function is already defined? PowerShell
UInt64 division PowerShell


Vista Forums 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 Ltd

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