Application Integration
1752805 Members
5536 Online
108789 Solutions
New Discussion

Nimble PowerShell Toolkit now posted to the Microsoft PSGallery

 
Chris_Lionetti
HPE Pro

Nimble PowerShell Toolkit now posted to the Microsoft PSGallery

So when writing a new PowerShell Module, you should consider how people are going to download it. Commonly these PowerShell modules have been tucked away behind vendor support websites that require logon, and while this method is usable, it doesn’t lend itself to supporting automation.

This is the brave new world, and in this new world, we expect servers to configure themselves, and if your like me you sure as heck don’t want to embed your username and password to a vendor site in your scripts especially if that site is for Infosight.hpe.com.

Of course the answer to this question is PS Gallery, which is a website similar to GitHub that hosts PowerShell Modules. Below I outline the steps to allow a Windows Server to obtain modules directly from the PS Gallery.

The first step is to download the per-requisites such as NuGet and PowerShellGet; Make sure to use an Administrator PowerShell Window for the following steps.

PS:> Install-PackageProvider -name NuGet -force

Name Version Source Summary
---- ------- ------ -------
nuget 2.8.5.208 https://onege… NuGet provider for the...

Additionally you will need to download a newer version of the PowerShellGet module;

PS:> update-module -name powershellget -force

And by default Microsoft does not trust even its own sites, you must tell your server to allow itself to download from the PS Gallery.

PS:> Set-PSRepository -name PSGallery -InstallationPolicy Trusted

Once these per-requisites have been done, you can download any of the Modules, but we don’t want ANY old module, we want the HPE Nimble Storage Module. The easiest way to find the module is to use the find command as follows; Note that I am lazy, so I use ‘*’ wildcards when I can.

PS C:\Windows\system32> Find-Module hpe*

Version Name
------- ----
1.1.0.0 HPERedfishCmdlets
1.2.0.0 HPESysInfoCmdlets
2.2.0.0 HPEiLOCmdlets
1.0.0.1 HPESmartArrayCmdlets
2.0.0.0 HPENVDIMMCmdlets
1.2.14.0 HPESvtCmdlets
1.1.0.0 HPEMigrationAdvisoryTool
2.2.0.0 HPEBIOSCmdlets
2.0.0.0 HPEOACmdlets
1.0.0.0 HPEVCCmdlets
3.0.0 HPENimblePowerShellToolkit
1.0.0.1 HPEOSProvisionCmdlets
1.2 hpeonesphere

Of course we only need one module, and as long as our query only returns a single module, we can pipe that directly to the Install-Module commands.

Special note here, you must explicitly accept the license or you will not be able to download the module.

PS:> Find-Module HPENi* | Install-Module -AcceptLicense
PS:> Import-Module HPENimblePowerShellToolkit

 

Chris Lionetti.

 

Chris Lionetti