Home > My Handy References, PowerShell, TroubleShooting > How to fix “Unable to cast COM object of type ‘Microsoft.SharePoint.Library.SPRequestInternalClass’ to interface type ‘Microsoft.SharePoint.Library.ISPRequest” using PowerGUI

How to fix “Unable to cast COM object of type ‘Microsoft.SharePoint.Library.SPRequestInternalClass’ to interface type ‘Microsoft.SharePoint.Library.ISPRequest” using PowerGUI

I got the error today when debugging some of my PowerShell Script in PowerGUI. The script works perfectly fine in PowerShell console. Then I had spent a couple of hours scratching my head, trying to figure out why. It turns out that the PowerShell Variables Panel causes the problem. Not quite sure why, but collapse the panel fix the problem.

Problem:

It throws the following exception when debugging my PowerShell Script.

Analysis:

It turns out that the PowerShell Variables Panel causes the problem. I assume it calls some function to grab value of some of variables which cause the problems.


Solution:

Collapse or Close the variables panel fix the problem

  1. October 25, 2012 at 6:40 am

    u saved my day !!! thanks buddy …..

  2. Harish
    January 1, 2013 at 8:28 pm

    I’m using PowerGui tool for Powershell Scripting.

    Please do a IISreset and try

    It worked for me

    Thank you
    Harish

  3. Kalyan
    February 8, 2013 at 1:07 am

    Yes.. This fix works for me. So happy. Thanks for posting this fix. I am using PowerGui too 🙂

  4. August 23, 2014 at 12:45 am

    Very Nice tip.. Thanks for such article..!

  1. No trackbacks yet.

Leave a comment