And turning that into a clickable link...
https://social.technet.microsoft.com/Forums/windowsserver/en-US/home?forum=winserverpowershell
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I know this could be a problem in the WMI management structure definition for Process...
But as a process's working set grows larger, and crosses the 2048 MB boundary,
the returned number becomes negative, because it's incorrectly being treated as a
signed 32-bit integer, when it is actually an unsigned 32-bit integer.
(Note that this implies a maximum WS of 4096 *1K*1K minus 1.)
ps> (get-process firefox).WS.getType()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True Int32 System.ValueType
ps> $x = (get-process firefox).WS
ps> $x.gettype()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True Int32 System.ValueType
ps> $x
-2110365696
This would not be such a problem, except... Trying to cast as uint32 fails
ps> [uint32]$x
Cannot convert value "-2110365696" to type "System.UInt32". Error: "Value was either too large or too small for a
UInt32."
At line:1 char:1
+ CategoryInfo : InvalidArgument: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvalidCastIConvertible
And converting it to int64 preserves the negativity
ps> [int64]$x
-2110365696
If I could set an int64's high longword to zero and low longword to the bit pattern of the int32, I'd get the number...
but I have no idea how to do that in PowerShell. (How can I do that?)
So I have to test for $x negative and if so use -$x-1 (because it's 2's complement).
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
And turning that into a clickable link...
https://social.technet.microsoft.com/Forums/windowsserver/en-US/home?forum=winserverpowershell
wow , Microsoft sure provides crappy web pages for being a "great" software company
That's a link to the top pinned article in the "Where is the forum for..." forum.
Go there, click the forum title link, search for PowerShell
Wrong place...
Apparently it is
https://social.technet.microsoft.com/Forums/windowsserver/en-US/home?forum=winserverpowershell
Hello,
Thank you for posting your question on Microsoft community.
This issue better suits to the developers on MSDN forums.
I would suggest you to post your question on MSDN forums.
MSDN forum
https://social.msdn.microsoft.com/Forums/en-US/home?category=vslanguages
Thank you