Windows Vista Forums

Can't Create a New Object in PowerShell
  1. #1


    CCENT Guest

    Can't Create a New Object in PowerShell

    I'm trying to create a new object in powershell and I get the follow
    error:



    "New-Object : Cannot find type [Reflection2.Session]: make sure the
    assembly containing this type is loaded."

    Here is the power shell code that I'm running that is returning the
    error:

    $confObj = New-Object "Reflection2.Session"
    $confObj.Visible = $true

    The following code DOES work when I create a vbs script:

    Set confObj = CreateObject("Reflection2.Session")
    confObj.Visible = True


    If a assembly needs to be loaded, how do I find out which file to
    load?

    Thanks in advance!!

      My System SpecsSystem Spec

  2. #2


    PaulChavez Guest

    RE: Can't Create a New Object in PowerShell

    This looks like a COM object, so try the new-object command with the
    -comobject parameter.

    "CCENT" wrote:

    > I'm trying to create a new object in powershell and I get the follow
    > error:
    >
    > "New-Object : Cannot find type [Reflection2.Session]: make sure the
    > assembly containing this type is loaded."
    >
    > Here is the power shell code that I'm running that is returning the
    > error:
    >
    > $confObj = New-Object "Reflection2.Session"
    > $confObj.Visible = $true
    >
    > The following code DOES work when I create a vbs script:
    >
    > Set confObj = CreateObject("Reflection2.Session")
    > confObj.Visible = True
    >
    >
    > If a assembly needs to be loaded, how do I find out which file to
    > load?
    >
    > Thanks in advance!!
    > .
    >

      My System SpecsSystem Spec

Can't Create a New Object in PowerShell problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to create print object JohnBoy Vista print fax & scan 1 03 Jan 2010
error create object selector to create group or user Javier VFM Server General 0 28 Oct 2009
Can I Create an empty MetaFile Object in C#? Leon_Amirreza .NET General 0 27 Mar 2009
How to create an object for WebEdit box? Mru VB Script 4 12 Oct 2008
Error 429 : ActiveX component can't create object Brad Vista General 9 16 Mar 2007