Automating PKWARE vZip with PowerCLI Scripts
If you have VMware's PowerCLI installed on your system, you can perform many vZip tasks from the Windows PowerShell.
Before Using vZip with PowerCLI
-
Install PKWARE vZip on your Windows vCenter server.
-
Confirm that Microsoft® Windows PowerShell® v2 or v3 is installed on your local PC, and that your ExecutionPolicy value is set to RemoteSigned. See http://technet.microsoft.com/en-us/library/bb978526.aspx for more information on Windows PowerShell.
-
Install VMware vSphere PowerCLI v5.0/5.1 onto your local PC. See http://www.vmware.com/support/developer/PowerCLI/PowerCLI501/ for more information on the latest version of VMware PowerCLI.
Installing the vZip Cmdlet
The vZip cmdlet is a dynamic link library (DLL) installed from the Windows PowerShell administrative prompt. The appropriate command depends on whether your system is running 32-bit or 64-bit Windows. To install vZip:
-
Go to the PowerCLI Setup page from the vZip tab in the vSphere client.
-
Follow the steps on the page to download vZipPS.dll.
-
Open Windows PowerShell administrative prompt.
NOTE: If you are running PowerShell 3.x and the vSphere Server you are accessing is outside your internal network, you will have to tell Windows that vZipPS.dll is safe to use. You can visit the file in Windows Explorer, go to Properties and click Unblock in the Security section.
You can also make the file available with a PowerShell command:
Unblock-file vZipPS.dll
-
Point to the PowerShell installation utility.
For 64-bit systems:
Set-Alias installutil $env:windir\Microsoft.NET\Framework64\v2.0.50727\installutil.exe
For 32-bit systems:
Set-Alias installutil $env:windir\Microsoft.NET\Framework\v2.0.50727\installutil.exe
-
Install vZipPS.dll
installutil vZipPS.dll
Notes on Using vZip Cmdlets in PowerShell
To make vZip available in the current PowerShell session, explicitly invoke the following command:
Add-PSSnapin vZip
You can also add the above command to the PowerShell configuration file.
To archive or restore a virtual machine, always invoke the PowerCLI cmdlet Connect-VIServer to connect to your vSphere server before running Start-vZipJobArchiveVM or Start-vZipJobExtractVM.
Command Reference
The following section contains reference information on each vZip PowerShell command.
You can find more information about vZip in Getting Started with PKWARE vZip.
Name: Connect-vZip
Description: Connect to the vZip service, obtain a session token.
Synopsis:
Connect-vZip -Server string -Credential pscredential [-Port int]
Connect-vZip -Server string -User string -Password string [-Port int]
Name: Disconnect-vZip
Description: Disconnect from the vZip service.
Synopsis:
Disconnect-vZip [[-Session] Token]
Name: Start-vZipJobArchiveVM
Description: Archive a VMware virtual machine.
Synopsis :
Start-vZipJobArchiveVM [-Item] Object[] [[-FileName] string] -Profile string [-Path string] [-Password string] [-Force] [-Session Token]
Start-vZipJobArchiveVM [-Item] Object[] [[-FileName] string] -Profile string -SecurePassword securestring [-Path string] [-Force] [-Session Token]
Name: Start-vZipJobExtractVM
Description: Restore an archived VMware virtual machine.
Synopsis:
Start-vZipJobExtractVM [-FileName] string -Item Object -Profile string [-InPath string] [-OutPath string] [-Password string] [-VMName string] [-Force] [-Session em>Token]
Start-vZipJobExtractVM [-FileName] string -Item Object -Profile string -SecurePassword securestring [-InPath string] [-OutPath string] [-VMName string] [-Force] [-Session Token]
Name: Stop-vZipJob
Description: Abort processing of any vZip job by Job ID or Job Object.
Synopsis:
Stop-vZipJob [-Item] Object[] [-Session Token]
Name: Get-vZipJob
Description: Check status of a submitted job.
Synopsis:
Get-vZipJob [[-Item] Object[]] [-Session Token]
Get-vZipJob [-Status JobStatus] [-Session Token]
Name: Get-vZipProfile
Description: Display a list of available vZip Profiles.
Synopsis:
Get-vZipProfile [[-Name] string[]] [-FIPS] [-Encrypt] [-Sign] [-NoFIPS] [-NoEncrypt] [-NoSign] [-Session Token]
Get-vZipProfile -Id uint64[] [-Session Token]
Name: Get-vZipPath
Description: Display a list of available paths.
Synopsis:
Get-vZipPath [[-Name] string[]] [-CanRead] [-CanWrite] [-Session Token]
Get-vZipPath [-Id uint64[]] [-CanRead] [-CanWrite] [-Session Token]