Skip to content
Chris Lynch edited this page Jan 18, 2018 · 53 revisions

Introduction

HPE OneView is a fresh approach to converged infrastructure management, inspired by the way you expect to work, with a single integrated view of your IT infrastructure. While HPE OneView provides an easy and intuitive web user interface, not all administrators like to manage their infrastructure with a GUI.

This library provides HPE OneView management capabilities for Windows PowerShell. The library can be used as either a CLI or using the core cmdlets to call from wrapper scripts. The core cmdlets are:

This PowerShell module provides access into the HPE OneView REST API with CMDLETs that can be used like a CLI, or scripting interface to automate certain functions. To begin, make sure you have the latest version.

This PowerShell module requires the following minimum versions:

Table 1. Requirements

Library Components Version
HPE OneView 1.20* Windows Management Framework (WMF) 3.0
HPE OneView 1.20* .Net Client Framework 4.0
HPE OneView 1.20* HPE OneView 1.20 or newer
HPE OneView 2.00* Windows Management Framework (WMF) 4.0
HPE OneView 2.00* .Net Client Framework 4.6**
HPE OneView 2.00* HPE OneView 2.00 or newer
HPE OneView 3.00 Windows Management Framework (WMF) 4.0
HPE OneView 3.00 .Net Client Framework 4.6**
HPE OneView 3.00 HPE OneView/HPE Synergy 3.00 or newer
HPE OneView 3.10 Windows Management Framework (WMF) 4.0
HPE OneView 3.10 .Net Client Framework 4.6**
HPE OneView 3.10 HPE OneView/HPE Synergy 3.10 or newer
HPE OneView 4.00 Windows Management Framework (WMF) 4.0
HPE OneView 4.00 .Net Client Framework 4.6**
HPE OneView 4.00 HPE OneView/HPE Synergy 4.00 or newer
All FormatPX v1.1.2.12 or greater***
All SnippetPX v1.0.2.13 or greater***

*NOTE: The HPOneView 1.20 and 2.00 libraries are now in maintenance mode, and only critical fixes will be released.

**NOTE: Windows Server 2008 R2 SP1 will be required to install the 4.6 .Net Client Framework.

***NOTE: Already included within the Signed Installer.

The installer will verify if your system does not meet the minimum requirements, and provides method to obtain them.

Once the package has been installed, you can launch the HPE OneView CLI shortcut from your Start Menu. Or you can choose to import the module dynamically in your PowerShell runtime by simply calling

Table 2. Import Library Command

HPE OneView POSH Library Command
1.20 Library import-module HPOneView.120
2.00 Library import-module HPOneView.200
3.00 Library import-module HPOneView.300
3.10 Library import-module HPOneView.310
4.00 Library import-module HPOneView.400

There are 5 primary CMDLETs to interact with the HPE OneView appliance:

How to install the library

The library can be installed in one of two ways:

  • Any release, go to the Code then Releases tab in this repository, and download the current release for the version you wish to download.
  • Starting with the HPE OneView 3.10 library release, it is now published on the PowerShellGallery. Install-Module HPOneView.[310|400] or Save-Module HPOneView.[310|4.00] can be used for those using PowerShell 4.0 (with the PowerShellGet module) or newer

Silent installation of library (for 2.00 only)

The installer technology used is provided from InnoSetup. Included within the 2.00.604.0 release (older installers do not support full silent installation, as the installer will default to JustMe), a new directory called Unattended with sample INF files are provided. The only custom key option supported within the Unattended INF answer file is Users.

Table 3. Supported Users Key value in Unattended INF Answer File

Value Definition Installation Directory
0 Install to JustMe %UserProfile%\Documents\WindowsPowerShell\Modules
1 Install to AllUsers %WinDir%\System32\WindowsPowerShell\v1\Modules

To execute a silent installation, use the following command line parameters:

HPOneView PowerShell Library.exe /loadinf="{Unattend_File}.inf" /VERYSILENT /SUPPRESSMSGBOXES /NORESTART

Updated Installation directory for 3.00 and newer library

Starting with the HPE OneView 3.00 library, the installation directory will no longer reside in either the Windows ($env:WinDir\System32\WindowsPowerShell\v1.0\Modules) or Users ($env:UserProfile\Documents\WindowsPowerShell\Modules) directory. Instead, the 3.00 library will now install to $env:ProgramFiles\WindowsPowerShell\Modules\HPOneView.{VERSION}, which follows the new common location Windows Management Framework 4 introduced.

How to start using the 1.20 or older library

The Connect-HPOVMgmt CMDLET will authenticate you to the requested appliance. From there, a variable $ciMgmtSessionId (Type [PSCustomObject]) is created in your PowerShell runtime environment that other CMDLETs will use. This object contains a property called sessionId which contains the authenticated users REST API session token that the internal RestClient function uses to add the required auth HTTP header.

Once completed, you can either close out of your PowerShell console, or issue the Disconnect-HPOVMgmt CMDLET to terminate your session, and return you back to your PowerShell consoles prior state.

How to start using the 2.00 or newer library

New in the HPE OneView 2.00 library is the ability to connect to multiple appliances, which allows the user to execute various CMDLETs without requiring to disconnect and reconnect to other appliances within your PowerShell session. The Connect-HPOVMgmt CMDLET will authenticate you to the requested appliance. From there, a session object (Type [HPOneView.Appliance.Connection]) is created and added to a global variable $ConnectedSessions (Type [System.Collections.ArrayList]) in your PowerShell runtime environment that other CMDLETs will use. Within the [HPOneView.Appliance.Connection] object contains a number of properties, of which the connected appliance hostname value provided by Connect-HPOVMgmt is stored, along with the SessionID of your user session.

For more information about multiple appliance connection support, please review get-help about_Appliance_Connections from your PowerShell console, or read the online wiki page for about_Appliance_Connections.

Once completed, you can either close out of your PowerShell console, or issue the Disconnect-HPOVMgmt CMDLET to terminate your session, and return you back to your PowerShell consoles prior state.


Sample Scripts

NOTE: Starting with the HPE OneView 3.00 library, the installation directory (including where Samples are stored) are no longer in either the Windows or Users directory. Instead, the 3.00 library is now within $env:ProgramFiles\WindowsPowerShell\Modules\HPOneView.{VERSION}.

To ease the use of the HPE OneView PowerShell library, we have included a number of sample scripts administrators can use to quickly get familiar with the capabilities of the library. The sample scripts are part of the Source Code and installer. Depending on which installation selection you chose (Just You, or For Everyone), there is a Samples directory that contain all of the sample scripts. By no means are they exhaustive, but will help you get more familiar with the library.

Sample Scripts location for All Users installation (Click on image for larger view):

Sample Scripts location for Just Me installation (Click on image for larger view):

Others have contributed example scripts to further automate management within the infrastructure. Please use the following links to see other examples not included within the library Samples directory.


Additional Resources

HPE OneView Python Library

HPE OneView Documentation on the HPE Enterprise Information Library

HPE Virtual Connect Documentation

HPE OneView Community

Learn more about HPE OneView at hpe.com/info/HPOneView


Wiki Table of Contents

Clone this wiki locally