« Previous Next »

Thread: An easy one

Last post 03-10-2009 5:36 AM by daemonoid. 4 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (5 items)

Sort Posts:

  • 02-15-2009, 6:25 PM

    • daemonoid
    • Not Ranked
    • Joined on 02-15-2009, 6:13 PM
    • London, England
    • Posts 3

    An easy one

    Probably...

    I'm completely new to powershell, I just need to perform a simple set of commands to get my dll installed and integrated with my server ( http://msdn.microsoft.com/en-us/library/bb802799.aspx ).

    I'm stuck on the first powershell step:

    $yourProviderConfig = new-object –ComObject
    'Your.BlobProviderConfig.1'
    $yourProviderConfig.Active = $false
     
    I'm not sure what the parameters should be, I've tried a lot of variations such as:
    PS G:\temp> $yourProviderConfig = new-object -ComObject ISPExternalBinaryProvider.MyProvider
     
    But i get the error:
    New-Object : A parameter cannot be found that matches parameter name 'ISPExternalBinaryProvider.MyProvider'.
    At line:1 char:33
    + $yourProviderConfig = new-object  <<<< - ComObject ISPExternalBinaryProvider.
    MyProvider
     
    Does anyone have any ideas? Powershell is completely new to me and I don't really know where to start; unfortunately I have a tight deadline so don't have time to read up about it as much as I'd like.
     Thanks in advance... 

     

    www.zombiecentral.co.uk
  • 02-16-2009, 3:07 AM In reply to

    Re: An easy one

  • 02-16-2009, 3:53 AM In reply to

    • daemonoid
    • Not Ranked
    • Joined on 02-15-2009, 6:13 PM
    • London, England
    • Posts 3

    Re: An easy one

    Thanks Paul, but it's not really the problem I have. I actually have to use regasm rather than regsvr32 as my dll is managed .Net code.

     My problem comes after the registering of the .dll - a quick registry search shows that my classes within the .dll are registered. It's the powershell step:

    $yourProviderConfig = new-object –ComObject
    'Your.BlobProviderConfig.1'
    $yourProviderConfig.Active = $false

     I just don't understand what is expected in place of 'Your.BlobProviderConfig.1', is it the class name? In which case why am I getting the parameter not found error?

    www.zombiecentral.co.uk
  • 03-10-2009, 1:15 AM In reply to

    • sergeia
    • Top 75 Contributor
    • Joined on 04-14-2008, 4:47 PM
    • Posts 68

    Re: An easy one

    If you have managed DLL, and not COM object, you shouldn't use -ComObject parameter, use just a class name from loaded assembly, or fully qualified name of class from assembly located in GAC, just like you would do in c#.

    [sergeia-64]: PS C:\Users\sergeia\Documents> $o = new-object System.Text.StringBuilder
    [sergeia-64]: PS C:\Users\sergeia\Documents> $o | gm


       TypeName: System.Text.StringBuilder

    Name           MemberType            Definition
    ----           ----------            ----------
    Append         Method                System.Text.StringBuilder Append(char value, int repeatCount), System.Text.Stri...
    AppendFormat   Method                System.Text.StringBuilder AppendFormat(System.IFormatProvider provider, string ...
    AppendLine     Method                System.Text.StringBuilder AppendLine(), System.Text.StringBuilder AppendLine(st...
    CopyTo         Method                System.Void CopyTo(int sourceIndex, char[] destination, int destinationIndex, i...
    EnsureCapacity Method                int EnsureCapacity(int capacity)
    Equals         Method                bool Equals(System.Text.StringBuilder sb), bool Equals(System.Object obj)
    GetHashCode    Method                int GetHashCode()
    GetType        Method                type GetType()
    Insert         Method                System.Text.StringBuilder Insert(int index, string value, int count), System.Te...
    Remove         Method                System.Text.StringBuilder Remove(int startIndex, int length)
    Replace        Method                System.Text.StringBuilder Replace(string oldValue, string newValue, int startIn...
    ToString       Method                string ToString(), string ToString(int startIndex, int length)
    Chars          ParameterizedProperty char Chars(int index) {get;set;}
    Capacity       Property              System.Int32 Capacity {get;set;}
    Length         Property              System.Int32 Length {get;set;}
    MaxCapacity    Property              System.Int32 MaxCapacity {get;} 

     

  • 03-10-2009, 5:36 AM In reply to

    • daemonoid
    • Not Ranked
    • Joined on 02-15-2009, 6:13 PM
    • London, England
    • Posts 3

    Re: An easy one

     Hi, forgot about this help request. Thanks for the reply, my understanding has moved on a lot now.

     My problem was not the powershell command, but the registering of the COM object itself.  It turns out that powershell was caching the dll meaning when i did:

    .\gacutil.exe /u MyDll
    .\RegAsm.exe /u MyDll.dll
    .\RegAsm.exe MyDll.dll
    .\gacutil.exe /if MyDll.dll

    I was actually re-installing the same dll. Simply closing powershell and doing the aforementioned commands then loaded the correct dll. This issue was compounded by the fact I'd changed my com object name very early on so could not figure out what was going on. 

    www.zombiecentral.co.uk
Page 1 of 1 (5 items)