Terms of Use For FixedByVonnie

By proceeding to access fixedByVonnie.com, you expressly acknowledge, and agree to, all of the following:

fixedByVonnie.com is a personal website and blog owned by Security Plus Pro LLC, which is being presented for informational purposes only. The views on this website are solely those of the website owner (and not those of any employer or of any professional associations affiliated with the website owner).  Any views expressed in this website and any information presented on this website, or in any of its blog entries, should not be relied on for any purpose whatsoever other than as the personal opinions of the website owner.  The website owner expressly disclaims any and all liability for any information presented on this site.  The owner of this website and its blog posts shall not be held liable, and shall be held harmless, for any errors or omissions in any information or representations contained in this website, or in any of its blog entries.  The website owner also expressly disclaims any liability for the current or future availability of any such information. The website owner makes no representations as to the accuracy or completeness of any information on this website or which may be found by following any link on this website. The website owner shall not be held liable for any losses, injuries, damages, claims, or causes of action, from the display or use of any information on this website or in any of its blog entries. If you use the information on this website, or on any of its blog entries, you do so solely at your own risk.

How to fix the "Unable to cast object of type 'System.Boolean' to type 'System.String'" - fixedByVonnie

How to fix the “Unable to cast object of type ‘System.Boolean’ to type ‘System.String'”

This is perhaps one of the most impenetrable errors you’ll find on a Windows system.  If Application Development isn’t your vocation then you’re probably wondering what it means and why it’s here.

"Unable to cast object of type 'System.Boolean' to type 'System.String'"

Some people see this recondite message as a pop-up every time they log into Windows.  Things get even more abstruse  if you click Start and type

view event

Because you might see something like this:

Log Name:Application
 Source WMI
 Event ID 10
 Level : error
 Event filter with query "SELECT * FROM __InstanceModificationEvent WITHIN 60 WHERE TargetInstance ISA "Win32_Processor" AND TargetInstance.LoadPercentage > 99" could not be reactivated in namespace "//./root/CIMV2" because of error 0x80041003. Events cannot be delivered through this filter until the problem is corrected.

In the log, do you see where it says “Source WMI“?  This is the Windows Management Instrumentation registration process.  That’s just a bunch of techno jargon to describe the drivers that allow Powershell and VBScripts to manage your system.

Microsoft says the “unable to cast object type” error happens because the WMI registration process is left behind on the Windows 7 SP1 DVD or ISO.  The registration is only supposed to happen while the DVD or ISO is being created but sometimes it erroneously tries to run on your live system.  That’s why your computer is chronically beset with these stupid pop-ups.

Fortunately, you can fix this problem by running a Microsoft Fix.  Some people claim they’ve absolved the issue by restoring the system to an earlier point or disabling Event logging all together; however, I think these solutions are inadequate because they don’t actually resolve the underlying issue. The fix is actually pretty easy to implement.  Check it out:

Running the Microsoft Fix

Microsoft created an installer which essentially launches a VBscript that deletes the bad objects that causes the error. Visit Microsoft’s website and download the MSI installer.

MSI Installer

Accept the license terms and click Next.

Microsoft Fix It 50688

The wizard creates a restore point and then asks you to confirm that you actually wish to install it. Go ahead and click Yes

. MicrosoftFixit50688.msi User Account Control

The installation completes in about 10 seconds and then politely asks you to close the window.

Microsoft Fixit Done

Now that should do it; You’re all done. If for some reason this doesn’t fix it, you can copy and paste the VBScript below into a text file and save it as microsoftfix-50688.vbs.

strComputer = "."

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\subscription")

Set obj1 = objWMIService.ExecQuery("select * from __eventfilter where name='BVTFilter' and query='SELECT * FROM __InstanceModificationEvent WITHIN 60 WHERE TargetInstance ISA ""Win32_Processor"" AND TargetInstance.LoadPercentage > 99'")

For Each obj1elem in obj1

set obj2set = obj1elem.Associators_("__FilterToConsumerBinding")

set obj3set = obj1elem.References_("__FilterToConsumerBinding")

For each obj2 in obj2set

 WScript.echo "Deleting the object"

 WScript.echo obj2.GetObjectText_

 obj2.Delete_

next

For each obj3 in obj3set

 WScript.echo "Deleting the object"

 WScript.echo obj3.GetObjectText_

 obj3.Delete_

next

WScript.echo "Deleting the object"

WScript.echo obj1elem.GetObjectText_

obj1elem.Delete_

Next

After saving the file, click Start, type

 cmd

right click the command prompt icon and choose Run as Administrator.

Run command prompt as the administrator

Then change to the directory containing microsoftfix-50688.vbs and type this:

cscript microsoftfix-50688.vbs

run VBS

Now you can reboot and the errors should be gone!

About

Connect with Vonnie on Twitter

Posted in How To, Windows 7 Tagged with:
  • Chadi AlHaj

    Just go to Control panel > PRograms > Uninstall a program .. and search for “ProtectedSearch” .. un-install it .. problem solved. 🙂

    • Abdalla Alkhateeb

      wow, thank you for this nice solution