none
Import customize cmdlet dll issue RRS feed

  • Question

  • Hi All,

    Now i using c# code wrapped my customize cmdlet to achieved simple feature. But when i import the dll i get some issues:

    And here is my import code:

    set-alias installutil $env:windir/Microsoft.NET/Framework/v4.0.30319/installutil
    set-location 'path...'
    installutil 'my cmdlet dll'

    I don't know this operation is correct ? any ideas for this issue? appreciated!


    True mastery of any skill takes a lifetime.

    Friday, April 24, 2015 2:58 AM

Answers

  • We don't install custom CmdLets into the GAC.  We just create them with a module manifest and copy them o the "Modules" folder.

    Your DLL cannot be installed because it is not designed and compiled correctly for installation.

    Assume you are creaing BitLocker CmdLets. Her eis how they look as a module:

        Directory: C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\BitLocker

    Mode                LastWriteTime         Length Name
    ----                -------------         ------ ----
    -a---l        8/22/2013   8:40 AM          12288 Microsoft.BitLocker.Structures.dll

    We just copy the dll to a folder and be sure it has an included PowerShell manifest. If VS is set up coorreclty it will generate eth manifest for you.

    Post in the VS forum for more assistance with building custom modules.


    \_(ツ)_/


    • Edited by jrv Friday, April 24, 2015 3:30 AM
    • Marked as answer by lxd_DD Monday, May 4, 2015 2:33 AM
    Friday, April 24, 2015 3:29 AM

All replies

  • We don't install custom CmdLets into the GAC.  We just create them with a module manifest and copy them o the "Modules" folder.

    Your DLL cannot be installed because it is not designed and compiled correctly for installation.

    Assume you are creaing BitLocker CmdLets. Her eis how they look as a module:

        Directory: C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\BitLocker

    Mode                LastWriteTime         Length Name
    ----                -------------         ------ ----
    -a---l        8/22/2013   8:40 AM          12288 Microsoft.BitLocker.Structures.dll

    We just copy the dll to a folder and be sure it has an included PowerShell manifest. If VS is set up coorreclty it will generate eth manifest for you.

    Post in the VS forum for more assistance with building custom modules.


    \_(ツ)_/


    • Edited by jrv Friday, April 24, 2015 3:30 AM
    • Marked as answer by lxd_DD Monday, May 4, 2015 2:33 AM
    Friday, April 24, 2015 3:29 AM
  • Thank you for your reply. It works.

    True mastery of any skill takes a lifetime.

    Monday, May 4, 2015 2:32 AM