Data Protection for Microsoft Hyper-V includes a set of Windows PowerShell cmdlets to help you manage Data Protection for Microsoft Hyper-V operations in your
environment.
Before you begin
Ensure that Microsoft
Windows PowerShell 3 or later is available on the system
where
Data Protection for Microsoft Hyper-V is installed. To view
which version of PowerShell is installed, enter the following command in a PowerShell
session:
PS C:\> $PSVersionTable.PSVersion
The number in the
Major
column is the PowerShell version.
About this task
You can run the cmdlets interactively at the PowerShell command line or include them in scripts
that can help you automate Data Protection for Microsoft Hyper-V
operations.
You must complete the following steps before you use the cmdlets.
Procedure
-
Start a Microsoft
Windows PowerShell or Microsoft
Windows PowerShell ISE session with administrator
authority:
-
Click .
-
Right-click Windows PowerShell and click Run as
administrator.
-
Verify that the execution policy is set to
RemoteSigned
by issuing the
following command:
PS C:\> Get-ExecutionPolicy
If another policy is shown, set the execution policy to
RemoteSigned
by
issuing the following
command:
PS C:\> Set-ExecutionPolicy RemoteSigned
Tip: The
Set-ExecutionPolicy command must be run only
once.
-
To make the cmdlets available, import the Data Protection for Microsoft Hyper-V PowerShell module:
PS C:\> Import-Module "C:\Program Files\IBM\SpectrumProtect\DPHyperV\dphvModule.dll"
-
Authenticate to Data Protection for Microsoft Hyper-V by using
the session cmdlet:
$cred = Get-Credential -UserName user_name -message "credential"
$session = New-DpHvSession -ComputerName computer_name -Credential $cred
where:
- user_name
- Specifies the account that you use to log in to the Windows system where Data Protection for Microsoft Hyper-V is
installed.
- computer_name
- Specifies the name of the server where Data Protection for Microsoft Hyper-V is installed.
-
If the security certificate that is associated with the host your are connecting to is not
recognized or is not on the local server (where the PowerShell cmdlets are installed), the session
cmdlet fails. You must rerun the New-DpHvSession cmdlet with either the
-Force parameter to ignore the certificate or the
-CertificatePrompt parameter to display a prompt for installing a new
certificate. For Windows Core OS with or without Features on Demand installed, use the
-Force parameter . The -CertificatePrompt parameter is not
supported for installing a new certificate.
For example, run the following session cmdlet:
$cred = Get-Credential -UserName user_name -message "credential"
$session = New-DpHvSession -ComputerName computer_name -Credential $cred `
-CertificatePrompt
When you are prompted, complete the following steps for a stand-alone host or for each host in a
cluster:
-
In the Securing connection to <host name> window, click View
certificate.
If you select any other options, such as Yes to ignore the certificate
warning for the current session, No to stop the connection, or
Don't ask me again for connection to this computer to ignore all future
certificate warnings, you will not be able to connect to Data Protection for Microsoft Hyper-V.
-
In the General tab of the Certificate window, click
Install Certificate.
-
In the welcome page of the Certificate Import Wizard window, select a
store location (Current User or Local Machine) and
click Next.
-
In the Certificate Store page, click Place all certificates in
the following store and click Browse.
-
In the Select Certificate Store window, select Trusted Root
Certification Authorities and click OK.
-
Click Next in the Certificate Store page.
-
Review the selections in the Completing the Certificate Import Wizard page
and click Finish.
- In the Security Warning window, click Yes
to install the certificate.
- Click OK in the confirmation window.
If you reject the certificate, you will not be able to connect to Data Protection for Microsoft Hyper-V unless you use the
-Force parameter.
-
Review the list of available cmdlets in PowerShell cmdlets for Data Protection for Microsoft Hyper-V.
- Optional:
Review the online help for each cmdlet. For more information, see Getting help information for PowerShell cmdlets.
What to do next
For information about creating, running, monitoring, and troubleshooting scripts with cmdlets,
see Windows PowerShell 3.0 or later documentation. For more
information about Windows PowerShell cmdlets, consistent
naming patterns, parameters, arguments, and syntax, see Microsoft TechNet: Getting
Started with Windows PowerShell.