locked
Custom cmdlet questions RRS feed

  • Question

  • Hi,

    I was looking at a ps1 file someone else wrote. It contains what looks like a custom cmdlet - 'Restart-AXAOS'.

    This is to restart a microsoft dynamics service. The question is, how is this defined and created in the first place. I cannot find a reference to it. There is the main ps1 file and a config file but it is in neither. Has someone created this as an assembly and registered it on this server? How is the functionality if this cmdlet defined?

    Thanks a lot.

    Thursday, July 31, 2014 7:47 AM

Answers

  • Hi Damon,

    this cmdlet is part of the DynamicAxCommunity Powershell Module (here an Introduction). Either the module is imported somewhere in the script using Import-Module, or it's used in Powershell 3+ where Modules are loaded automatically as required.

    If the script is working that means it's installed somewhere on the executing computer, I'd recommend checking the Module folders ($env:PSModulePath will show you where).

    If it's a script-module, you can simply read the function in your favorite script editor. If it's a compiled module, you'll need a library inspector, such as ILSpy, to read just what it's doing.

    Cheers,
    Fred


    There's no place like 127.0.0.1

    • Proposed as answer by Mike Laughlin Thursday, July 31, 2014 1:20 PM
    • Marked as answer by AnnaWY Friday, August 8, 2014 3:55 AM
    Thursday, July 31, 2014 8:11 AM