Home Dashboard Directory Help
Search

Get-ItemProperty : Specified cast is not valid Error When REG_DWORD Value Has Binary Data by Ben0xA


Status: 

Active


1
0
Sign in
to vote
Type: Bug
ID: 801007
Opened: 9/16/2013 5:05:40 PM
Access Restriction: Public
1
Workaround(s)
view
0
User(s) can reproduce this bug

Description

When you use the Get-ItemProperty command on a REG_DWORD value that has binary data instead of Int-32 data, you get the following error message:

Get-ItemProperty : Specified cast is not valid.
At line:1 char:1
+ Get-ItemProperty HKCU:\Software\Microsoft\Windows\CurrentVersion\Run\Fail
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo         : NotSpecified: (:) [Get-ItemProperty], InvalidCastException
    + FullyQualifiedErrorId : System.InvalidCastException,Microsoft.PowerShell.Commands.GetItemPropertyCommand

I tested this in PowerShell 3.0
Screenshots are attached.
Details
Sign in to post a comment.
Sign in to post a workaround.
Posted by Ben0xA on 9/16/2013 at 5:10 PM
The workaround is to set the REG_DWORD value to a valid 32-bit value. However, I am not sure if that will affect the program that created that registry entry. I found this because Netbeans will put binary data into the REG_DWORD that will show up as (invalid DWORD (32-bit) value).
File Name Submitted By Submitted On File Size  
ps_results.png 9/16/2013 27 KB
ps_gip_regfail_dword_value.png 9/16/2013 3 KB
ps_gip_regfail.png 9/16/2013 34 KB