Closed Annabellarooskie closed 1 year ago
We cannot recreate this behavior. Running PureStoragePowerShellSDK2 on PowerShell 7.2.3. Once the module is imported, several cmdlets run without issue. Are you doing an Import-Module first, or relying on auto-loading? Could you possibly create a quick video showing the Importing of the module & subsequent cmdlet executions with the requirement to run the Import again after every one cmdlet execution?
yes, once it is imported it works fine. Closing the session and creating a new session, and the cmdlets are gone. So your module doesn't support auto-loading?
I can create a video to show you what I am experiencing. I am working in PS 7.3.0
To my knowledge, auto-loading is a native PowerShell function and is limited based on the number of identical modules and/or cmdlets that are loaded within a single session. It is not defined per module. I do not know if any functions in .net core that define auto load for a module, but I will check.
On Mon, Nov 21, 2022 at 3:04 PM Anni B @.***> wrote:
I can create a video to show you what I am experiencing. I am working in PS 7.3.0
— Reply to this email directly, view it on GitHub https://github.com/PureStorage-Connect/PowerShellSDK2/issues/15#issuecomment-1322638840, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPW7UFUYH44TC4JNEQZ3VDWJPPW5ANCNFSM6AAAAAASG3U3II . You are receiving this because you commented.Message ID: @.***>
--
Mike Nelson // Microsoft Solutions Architect - FlashArray // @.***
The way I understand it is that the module has to be designed in a way so that cmdlets can be used without importing each time. I can always just import module each time in my function that utilizes your cmdlets but it is just an extra step. I see in your manifest file (and when I look at the module with 'Get-module -ListAvailable') that there are no cmdlets or functions to export. I am assuming the module is created with C# and this property is what can be set to make that happen: https://learn.microsoft.com/en-us/dotnet/api/microsoft.powershell.commands.newmodulemanifestcommand.cmdletstoexport?view=powershellsdk-7.2.0
You are correct. The developers used a wildcard, which is not best practice, when specifying "CmdletsToLoad". I have attached an updated manifest file (rename to .psd1) PureStoragePowerShellSDK2.txt with all of the cmdlets specified and have tested it. Auto loading works with this new file. Thank you for your assistance!
I am developing some automation against my Pure arrays in PowerShell 7. It seems that every time I want to execute a command in a PowerShell 7 session I have to import the module to use the cmdlets. This is not an issue in PowerShell 5 sessions however.