PowerCLI script for configuring the GuestStore repository on the hosts managed by a vCenter Server 7.0 U2
search cancel

PowerCLI script for configuring the GuestStore repository on the hosts managed by a vCenter Server 7.0 U2

book

Article ID: 336081

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

This article provides information on the location and how to use the Configure-GuestStore.ps1 script for configuring the GuestStore repository on ESXi hosts managed by a vCenter server.


Environment

VMware vCenter Server 7.0.x

Resolution

Prerequisites:
  • Powershell version:
PS C:\> $PSVersionTable.PSVersion

Major  Minor  Build  Revision
   -----  -----  -----  --------
   5      1      19041  546
PS C:\> Get-Module -Name VMware.PowerCLI -ListAvailable
Directory: C:\Users\TestUser\Documents\WindowsPowerShell\Modules
ModuleType Version    Name                                ExportedCommands
   ---------- -------    ----                                ----------------
   Manifest   12.0.0.... VMware.PowerCLI
  • vSphere 7.0 Update 2
The steps below need to be performed from a Windows system. You can skip Step 1 & Step 2 if you have already done so before.

Step 1:
  1. Install VMware PowerCLI in Windows PowerShell.
  2. To uninstall old version of VMware PowerCLI, run:
PS C:\> (Get-Module -Name VMware.PowerCLI -ListAvailable).RequiredModules | Uninstall-Module -Force
PS C:\> Get-Module -Name VMware.PowerCLI -ListAvailable | Uninstall-Module -Force
  1. To install the latest VMware PowerCLI from PowerShell repository 'PSGallery', run:
PS C:\> Install-Module -Name VMware.PowerCLI -Scope CurrentUser

This installs VMware PowerCLI to the current user directory $home\Documents\PowerShell\Modules.
Note, you don't need to run the script in a PowerShell (Admin) session.
Step 2:
  1. Set Windows PowerShell execution policy:
PS C:\> Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
  1. Close the current Windows PowerShell window, re-start Windows PowerShell.
Step 3:
Save this script to a local file, e.g., 'C:\Tool\Configure-GuestStore.ps1'.

Step 4:
Run this command to set Prompt if the server certificate is not trusted:
 
Set-PowerCLIConfiguration -Scope Session -InvalidCertificateAction Prompt

Command Samples:

Sample test commands (Enter empty string to clear repository URL setting and disable GuestStore)

Configure-GuestStore.ps1 -Server '<VC server name>' -User '[email protected]' -Password '********' \ -Datacenter '<datacenter name>' -ConfigAction get

Configure-GuestStore.ps1 -Server '<VC server name>' -User '[email protected]' -Password '********' \ -Datacenter '<datacenter name>' -ConfigAction set -Url 'ds:///vmfs/volumes/5bda46e0-08260d5c-3328d0946644b1a3/GuestStore'

Configure-GuestStore.ps1 -Server '<VC server name>' -User '[email protected]' -Password '********' \ -Datacenter '<datacenter name>' -ConfigAction set -Url ''

Configure-GuestStore.ps1 -Server '<VC server name>' -User '[email protected]' -Password '********' \ -Cluster '<cluster name>' -ConfigAction get

Attachments

Configure-GuestStore get_app