<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>VMware PowerCLI Blog</title>
	<atom:link href="https://blogs.vmware.com/PowerCLI/feed" rel="self" type="application/rss+xml" />
	<link>https://blogs.vmware.com/PowerCLI/</link>
	<description>PowerCLI is the best tool for automating management and configuration of VMware vSphere</description>
	<lastBuildDate>Fri, 04 Oct 2024 11:35:19 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.2.2</generator>
	<item>
		<title>Introducing PowerCLI 13.3</title>
		<link>https://blogs.vmware.com/PowerCLI/2024/07/introducing-powercli-13-3.html</link>
		
		<dc:creator><![CDATA[Angel Petrov]]></dc:creator>
		<pubDate>Thu, 25 Jul 2024 14:08:24 +0000</pubDate>
				<category><![CDATA[Release]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[release]]></category>
		<category><![CDATA[VCF]]></category>
		<guid isPermaLink="false">https://blogs.vmware.com/PowerCLI/?p=4624</guid>

					<description><![CDATA[<div><img width="300" height="168" src="https://blogs.vmware.com/PowerCLI/files/2022/07/vmw-ico-powercli-vmc-rgb_400px-1-300x168.jpg" class="attachment-medium size-medium wp-post-image" alt="" decoding="async" style="margin-bottom: 10px;" srcset="https://blogs.vmware.com/PowerCLI/files/2022/07/vmw-ico-powercli-vmc-rgb_400px-1-300x168.jpg 300w, https://blogs.vmware.com/PowerCLI/files/2022/07/vmw-ico-powercli-vmc-rgb_400px-1-576x324.jpg 576w, https://blogs.vmware.com/PowerCLI/files/2022/07/vmw-ico-powercli-vmc-rgb_400px-1-600x335.jpg 600w, https://blogs.vmware.com/PowerCLI/files/2022/07/vmw-ico-powercli-vmc-rgb_400px-1.jpg 743w" sizes="(max-width: 300px) 100vw, 300px" /></div>
<p>It’s the perfect moment! With just a month until VMware Explore Las Vegas, we have an exciting new PowerCLI 13.3 version to share. This release brings numerous bug fixes, enhancements, and fantastic new capabilities, such as the Privilege Report cmdlet, among others. There will be plenty of topics to discuss at Explore &#x1f60a;. Let me &#8230; <a href="https://blogs.vmware.com/PowerCLI/2024/07/introducing-powercli-13-3.html">Continued</a></p>
<p>The post <a href="https://blogs.vmware.com/PowerCLI/2024/07/introducing-powercli-13-3.html">Introducing PowerCLI 13.3</a> appeared first on <a href="https://blogs.vmware.com/PowerCLI">VMware PowerCLI Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div><img width="300" height="168" src="https://blogs.vmware.com/PowerCLI/files/2022/07/vmw-ico-powercli-vmc-rgb_400px-1-300x168.jpg" class="attachment-medium size-medium wp-post-image" alt="" decoding="async" loading="lazy" style="margin-bottom: 10px;" srcset="https://blogs.vmware.com/PowerCLI/files/2022/07/vmw-ico-powercli-vmc-rgb_400px-1-300x168.jpg 300w, https://blogs.vmware.com/PowerCLI/files/2022/07/vmw-ico-powercli-vmc-rgb_400px-1-576x324.jpg 576w, https://blogs.vmware.com/PowerCLI/files/2022/07/vmw-ico-powercli-vmc-rgb_400px-1-600x335.jpg 600w, https://blogs.vmware.com/PowerCLI/files/2022/07/vmw-ico-powercli-vmc-rgb_400px-1.jpg 743w" sizes="(max-width: 300px) 100vw, 300px" /></div><p>It’s the perfect moment! With just a month until VMware Explore Las Vegas, we have an exciting new PowerCLI 13.3 version to share. This release brings numerous bug fixes, enhancements, and fantastic new capabilities, such as the Privilege Report cmdlet, among others. There will be plenty of topics to discuss at Explore <img src="https://s.w.org/images/core/emoji/14.0.0/72x72/1f60a.png" alt="😊" class="wp-smiley" style="height: 1em; max-height: 1em;" />. Let me guide you through the details of this new PowerCLI version.</p>
<p>&nbsp;</p>
<h2><strong>VCF SDDC Manager </strong><strong>enhancements</strong></h2>
<p>With 13.3 we are adding two new cmdlets:</p>
<ul>
<li><strong>Wait-VcfTask &#8211; </strong>enables waiting for generic async operations like for examples <a href="https://developer.broadcom.com/xapis/vmware-cloud-foundation-api/4.5.1/data-structures/Task/"><strong>Tasks</strong></a></li>
<li><strong>Wait-VcfValidation &#8211; </strong>enables waiting for specific VCF validation operations like for example<strong> <a href="https://developer.broadcom.com/xapis/vmware-cloud-foundation-api/4.5.1/v1/domains/validations/post/">Validate Domains Operations</a></strong></li>
</ul>
<p>&nbsp;</p>
<h2><strong>vSphere </strong><strong>enhancements</strong></h2>
<p>We add new cmdlet for recording the privilege checks that occur for specified sessions during execution of a specified script block:</p>
<ul>
<li><strong>Get-VIPrivilegeReport</strong></li>
</ul>
<p>&nbsp;</p>
<h2><strong>VSAN enhancements</strong></h2>
<p>In PowerCLI 13.3 we are adding two new cmdlets to support alarm threshold customisations.</p>
<ul>
<li><strong>New-AlarmTriggerArgument</strong> – creates a new action trigger for the specified alarm action</li>
<li><strong>Get-AlarmTriggerArgumentAttributeName</strong> &#8211; list attribute names of the alarm trigger argument for the &#8220;<strong>vsan.health.ssd.endurance</strong>&#8221; event type</li>
</ul>
<p>Also we are updating few existing cmdlets.</p>
<ul>
<li><strong>Get-VsanSpaceUsage</strong> enhancement &#8211; add  support new attribute space efficiency ratio in return type</li>
<li><strong>Set-VsanClusterConfiguration</strong> &#8211; new parameter &#8220;<strong>vsanmaxenabled</strong>&#8221; is added to enable vSAN Max service</li>
<li><strong>Get-VsanClusterConfiguration</strong> &#8211; new parameter &#8220;<strong>vsanmaxenabled</strong>&#8221; is added to check whether the vSAN cluster is vSAN Max enabled.</li>
</ul>
<p>&nbsp;</p>
<h2><strong>HSX </strong><strong>enhancements</strong></h2>
<p>In PowerCLI 13.3 we are adding two new cmdlets for GuestOS customisations.</p>
<ul>
<li><strong>New-HCXGuestOSNetworkCustomization</strong> creates an object for network customisation which is a part of Guest OS customisation</li>
<li><strong>New-HCXGuestOSCustomization</strong> creates an object for Guest OS customisation</li>
</ul>
<p>Following two cmdlets are updated to receive above new cmdlets as parameters:</p>
<ul>
<li><strong>New-HCXMigration</strong> for migration level guest os customisations;</li>
<li><strong>New-HCXMobilityGroupConfiguration</strong> for group level guest os customisations.</li>
</ul>
<p>&nbsp;</p>
<h2><strong>Image Builder Enhancements </strong></h2>
<p>With PowerCLI 13.3, we are adding support for Python version 3.12. Along with this, we are adding support for OpenSSL 3.0.</p>
<p><strong>Notice:</strong> We are dropping support for OpenSSL 1.1 due to its End of Life announced in September 2023.</p>
<h2><strong>Updated SDK modules</strong></h2>
<p>Following modules are updated with PowerCLI 13.3:</p>
<ul>
<li>The vSphere modules are updated to vSphere 8.0U3.</li>
<li>The NSX modules are updated to NSX 4.2.0.0.</li>
<li>The SRM and vSphere Replication modules are updated to version 9.0.1</li>
<li>The VCF module are updated to VMware Cloud Foundation 5.2.</li>
</ul>
<p>For more details, please check detailed <a href="https://docs.vmware.com/en/VMware-PowerCLI/latest/rn/vmware-powercli-change-log.html">Change log</a> and <a href="https://docs.vmware.com/en/VMware-PowerCLI/latest/rn/powercli-133-release-notes.html">Release notes</a> for PowerCLI 13.3 release version.</p>
<h2><strong>Removed SDK modules </strong></h2>
<p><strong>Changes in PowerCLI Offering: Horizon Module Removal in Version 13.3</strong></p>
<p>With the recent separation of VMware’s End User Computing (EUC) division by Broadcom, a key update is being made in the PowerCLI offering. Starting from PowerCLI version 13.3, the <strong>VMware.VimAutomation.HorizonView</strong> module will no longer be included. This change reflects the broader restructuring of the product lines.For users requiring the Horizon module, <strong>PowerCLI version 13.2</strong> will be the latest version that contains <strong>VMware.VimAutomation.HorizonView</strong>.</p>
<h2><strong>Conclusion</strong></h2>
<p>With PowerCLI 13.3, you can enjoy the benefits of the newest features of vSphere, vSAN, NSX, and more. And as always, PowerCLI 13.3 comes with the latest bug-fixes and performance enhancements to make your work easier and faster. Don’t wait any longer, update your PowerCLI version today. The New version is available in <a href="https://www.powershellgallery.com/packages/VMware.PowerCLI/13.2.1.22851661">PowerShell Gallery</a> and <a href="https://developer.broadcom.com/tools/vmware-powercli/latest/">Broadcom Developer Portal</a>.</p><p>The post <a href="https://blogs.vmware.com/PowerCLI/2024/07/introducing-powercli-13-3.html">Introducing PowerCLI 13.3</a> appeared first on <a href="https://blogs.vmware.com/PowerCLI">VMware PowerCLI Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Git integration for Power Actions</title>
		<link>https://blogs.vmware.com/PowerCLI/2023/11/git-integration-for-power-actions.html</link>
		
		<dc:creator><![CDATA[Kamen Nikolov]]></dc:creator>
		<pubDate>Tue, 21 Nov 2023 14:56:15 +0000</pubDate>
				<category><![CDATA[General]]></category>
		<guid isPermaLink="false">https://blogs.vmware.com/PowerCLI/?p=4600</guid>

					<description><![CDATA[<div><img width="300" height="166" src="https://blogs.vmware.com/PowerCLI/files/2023/04/Power-Actions-logo-300x166.png" class="attachment-medium size-medium wp-post-image" alt="" decoding="async" loading="lazy" style="margin-bottom: 10px;" srcset="https://blogs.vmware.com/PowerCLI/files/2023/04/Power-Actions-logo-300x166.png 300w, https://blogs.vmware.com/PowerCLI/files/2023/04/Power-Actions-logo-1024x566.png 1024w, https://blogs.vmware.com/PowerCLI/files/2023/04/Power-Actions-logo-768x424.png 768w, https://blogs.vmware.com/PowerCLI/files/2023/04/Power-Actions-logo-1536x848.png 1536w, https://blogs.vmware.com/PowerCLI/files/2023/04/Power-Actions-logo-600x331.png 600w, https://blogs.vmware.com/PowerCLI/files/2023/04/Power-Actions-logo.png 1805w" sizes="(max-width: 300px) 100vw, 300px" /></div>
<p>Ever since we introduced Power Actions back in April, one of the most frequently asked questions we get from our customers is whether we plan to integrate with source control systems like Git. While we still don’t have that out-of-the-box in Power Actions, in this blog post, I’ll show you how to easily create a &#8230; <a href="https://blogs.vmware.com/PowerCLI/2023/11/git-integration-for-power-actions.html">Continued</a></p>
<p>The post <a href="https://blogs.vmware.com/PowerCLI/2023/11/git-integration-for-power-actions.html">Git integration for Power Actions</a> appeared first on <a href="https://blogs.vmware.com/PowerCLI">VMware PowerCLI Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div><img width="300" height="166" src="https://blogs.vmware.com/PowerCLI/files/2023/04/Power-Actions-logo-300x166.png" class="attachment-medium size-medium wp-post-image" alt="" decoding="async" loading="lazy" style="margin-bottom: 10px;" srcset="https://blogs.vmware.com/PowerCLI/files/2023/04/Power-Actions-logo-300x166.png 300w, https://blogs.vmware.com/PowerCLI/files/2023/04/Power-Actions-logo-1024x566.png 1024w, https://blogs.vmware.com/PowerCLI/files/2023/04/Power-Actions-logo-768x424.png 768w, https://blogs.vmware.com/PowerCLI/files/2023/04/Power-Actions-logo-1536x848.png 1536w, https://blogs.vmware.com/PowerCLI/files/2023/04/Power-Actions-logo-600x331.png 600w, https://blogs.vmware.com/PowerCLI/files/2023/04/Power-Actions-logo.png 1805w" sizes="(max-width: 300px) 100vw, 300px" /></div><p>Ever since <a href="https://blogs.vmware.com/PowerCLI/2023/04/new-release-power-actions-1-0.html">we introduced Power Actions back in April</a>, one of the most frequently asked questions we get from our customers is whether we plan to integrate with source control systems like Git. While we still don’t have that out-of-the-box in Power Actions, in this blog post, I’ll show you how to easily create a script that you can run with Power Actions to sync your script library with a Git folder.</p>
<h2>Let’s get started.</h2>
<p>Since Git is not available out-of-the-box in Power Actions, the first thing we need to do in our script is to install Git.</p>
<div>
<pre class="crayon-plain-tag">#Intall git
tdnf install -y git</pre><br />
The next step is to pull the scripts that we want from Git to our machine. In this sample script, we’ll sync our script library with the PowerActions folder in the PowerCLI sample scripts repo on GitHub (https://github.com/vmware/PowerCLI-Example-Scripts/tree/master/PowerActions).</p>
<div>
<pre class="crayon-plain-tag">#Clone the repo
git clone -n --depth=1 --filter=tree:0 https://github.com/vmware/PowerCLI-Example-Scripts.git
cd PowerCLI-Example-Scripts
git sparse-checkout set --no-cone PowerActions
git checkout
cd PowerActions</pre><br />
Now that we have the scripts from the Git repo, the next step is to check what we have in our script library. Since the script library is actually backed by a content library, we’ll use the PowerCLI cmdlets for content library to do this. For every script that we have retrieved from Git, we’ll check if a script with the same name already exists in the script library. If it doesn’t, that means we have to upload it there using the New-ContentLibraryItem cmdlet. If it already exists in the script library, we’ll download it from there and compare it with the file that we have retrieved from Git. No action is needed if the files are identical. However, if the file that we have downloaded from Git is different, we’ll update the script in the script library.</p>
<div>
<pre class="crayon-plain-tag">#Get all the files that we have cloned from the repo
$files = Get-ChildItem -Path . -File
foreach ($file in $files) {
    $name = $file.BaseName


    #Check if the item for this file already exists in the content library
    $item = Get-ContentLibraryItem -Name $name -ContentLibrary $contentLibrary -ErrorAction SilentlyContinue
    if ($item) {
        #If the item exists, check if it is up to date
        #Create a folder to store the current content library item
        if (-not (Test-Path -Path ./cl_versions -PathType Container))
        {
            New-Item -Path ./cl_versions -ItemType Directory
        }
        #Download the item from the content library
        $clFile = Export-ContentLibraryItem -ContentLibraryItem $item -Destination ((Get-Location).Path + "/cl_version") -Force
        #Compare if it's the same as the file we have downloaded from the repo
        $compResult = Compare-Object -ReferenceObject (Get-Content $file.FullName) -DifferenceObject (Get-Content ($clFile.FullName+"/"+$file.Name))
        if ($compResult) {
            #If the item is not up to date, update it
            Write-Host "Updating $name"
            Set-ContentLibraryItem -ContentLibraryItem $item -Files $file.FullName
        } else {
            Write-Host "$name is up to date"
        }
    } else {
        #If the item does not exist, create it
        New-ContentLibraryItem -Name $name -Files $file.FullName -ContentLibrary $contentLibrary
    }
}</pre></p>
<h2>And that’s it!</h2>
<p>Using this script you can sync your script library with a Git folder. This way, you can easily keep your scripts up to date and share them with your team. You can also customize this script to work with other source control systems or other repos and folders.</p>
<p>You can find the script in the <a href="https://github.com/vmware/PowerCLI-Example-Scripts/tree/master/PowerActions">PowerActions folder in the PowerCLI sample scripts repo on GitHub</a>. I hope you found this blog post useful and learned something new. Happy scripting!</p>
</div>
</div>
</div>
<div></div><p>The post <a href="https://blogs.vmware.com/PowerCLI/2023/11/git-integration-for-power-actions.html">Git integration for Power Actions</a> appeared first on <a href="https://blogs.vmware.com/PowerCLI">VMware PowerCLI Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Introducing PowerCLI 13.2</title>
		<link>https://blogs.vmware.com/PowerCLI/2023/11/introducing-powercli-13-2.html</link>
		
		<dc:creator><![CDATA[Kamen Nikolov]]></dc:creator>
		<pubDate>Wed, 08 Nov 2023 14:28:45 +0000</pubDate>
				<category><![CDATA[Release]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[release]]></category>
		<category><![CDATA[VCF]]></category>
		<guid isPermaLink="false">https://blogs.vmware.com/PowerCLI/?p=4582</guid>

					<description><![CDATA[<div><img width="300" height="168" src="https://blogs.vmware.com/PowerCLI/files/2022/07/vmw-ico-powercli-vmc-rgb_400px-1-300x168.jpg" class="attachment-medium size-medium wp-post-image" alt="" decoding="async" loading="lazy" style="margin-bottom: 10px;" srcset="https://blogs.vmware.com/PowerCLI/files/2022/07/vmw-ico-powercli-vmc-rgb_400px-1-300x168.jpg 300w, https://blogs.vmware.com/PowerCLI/files/2022/07/vmw-ico-powercli-vmc-rgb_400px-1-576x324.jpg 576w, https://blogs.vmware.com/PowerCLI/files/2022/07/vmw-ico-powercli-vmc-rgb_400px-1-600x335.jpg 600w, https://blogs.vmware.com/PowerCLI/files/2022/07/vmw-ico-powercli-vmc-rgb_400px-1.jpg 743w" sizes="(max-width: 300px) 100vw, 300px" /></div>
<p>Momentum season is still going, VMware Explore in Barcelona is currently underway, and it&#8217;s the perfect time for a new PowerCLI release. We&#8217;re thrilled to introduce the new PowerCLI 13.2! This release brings you official support for VMware Cloud Foundation (VCF) in PowerCLI, along with new features for vSphere, vSAN, and VMC. Let&#8217;s dive into &#8230; <a href="https://blogs.vmware.com/PowerCLI/2023/11/introducing-powercli-13-2.html">Continued</a></p>
<p>The post <a href="https://blogs.vmware.com/PowerCLI/2023/11/introducing-powercli-13-2.html">Introducing PowerCLI 13.2</a> appeared first on <a href="https://blogs.vmware.com/PowerCLI">VMware PowerCLI Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div><img width="300" height="168" src="https://blogs.vmware.com/PowerCLI/files/2022/07/vmw-ico-powercli-vmc-rgb_400px-1-300x168.jpg" class="attachment-medium size-medium wp-post-image" alt="" decoding="async" loading="lazy" style="margin-bottom: 10px;" srcset="https://blogs.vmware.com/PowerCLI/files/2022/07/vmw-ico-powercli-vmc-rgb_400px-1-300x168.jpg 300w, https://blogs.vmware.com/PowerCLI/files/2022/07/vmw-ico-powercli-vmc-rgb_400px-1-576x324.jpg 576w, https://blogs.vmware.com/PowerCLI/files/2022/07/vmw-ico-powercli-vmc-rgb_400px-1-600x335.jpg 600w, https://blogs.vmware.com/PowerCLI/files/2022/07/vmw-ico-powercli-vmc-rgb_400px-1.jpg 743w" sizes="(max-width: 300px) 100vw, 300px" /></div><p>Momentum season is still going, VMware Explore in Barcelona is currently underway, and it&#8217;s the perfect time for a new PowerCLI release. We&#8217;re thrilled to introduce the new PowerCLI 13.2!</p>
<p>This release brings you official support for VMware Cloud Foundation (VCF) in PowerCLI, along with new features for vSphere, vSAN, and VMC. Let&#8217;s dive into the details.</p>
<h3>New SDK modules for VCF</h3>
<p>VMware Cloud Foundation (VCF) is an integrated platform incorporating a full range of software-defined services into a single platform. As more and more VMware customers adopt VCF, the demand for CLI automation is also increasing. Until now, the only option was to use the open-source PowerVCF module, but with PowerCLI 13.2 we&#8217;re now adding two official VCF modules &#8211; <code>VMware.Sdk.Vcf.CloudBuilder</code> and <code>VMware.Sdk.Vcf.SddcManager</code>. These are SDK modules and use the same technology as the PowerCLI SDK modules for the vSphere Automation, NSX, SRM, and the vSphere Replication APIs. As with all SDK modules, you can find PowerCLI examples directly in the <a href="https://developer.vmware.com/apis/vcf/latest/">VCF REST API documentation</a>.</p>
<p><strong>New vSphere Lifecycle Management functionality</strong></p>
<p>In PowerCLI 13.2 we&#8217;re adding two new cmdlets for vLCM:</p>
<ul>
<li><code>Export-LcmVMHostDesiredState</code> exports the desired state of a vSphere Lifecycle Manager host</li>
<li><code>New-OfflineBundle</code> creates a vLCM-compliant offline bundle based on input depots and a software specification.</li>
</ul>
<p><strong>New vSAN functionality</strong></p>
<p>In PowerCLI 13.2 we have added a new cmdlet in the <code>VMware.VimAutomation.Storage</code> module &#8211; <code>Get-VsanPerformanceContributor</code>. It allows you to retrieve a list of the most impactful vSAN performance contributors. We have also extended the output of the <code>Get-VsanSpaceUsage</code> cmdlet to include an <code>EsaObjectOverheadGB</code> property, which provides information for the additional overhead for vSAN ESA objects to store meta-data and to provide high performance.</p>
<p><strong>New VMC functionality</strong></p>
<p>In PowerCLI 13.2 we have extended the <code>New-VmcSddc</code> and <code>New-VmcSddcCluster</code> cmdlets with support for <code>I4I</code> hosts.</p>
<p><strong>Updated SDK modules</strong></p>
<p>With PowerCLI 13.2 we have also updated all the modules that provide API bindings. The following modules have been updated:</p>
<ul>
<li>The vSphere modules have been updated to vSphere 8.0U2.</li>
<li>The NSX modules have been updated to NSX 4.1.2.</li>
<li>The SRM and vSphere Replication modules have been updated to version 8.8.</li>
<li>The Horizon module has been updated to VMware Horizon 8 2306.</li>
</ul>
<p><strong>Conclusion</strong></p>
<p>With PowerCLI 13.2, you can enjoy the benefits of the newest features of vSphere, vSAN, NSX, and more. Plus, you can access the official VCF modules that are now part of PowerCLI. And as always, PowerCLI 13.2 comes with the latest bugfixes and performance enhancements to make your work easier and faster. Don’t wait any longer, update your PowerCLI version today.</p><p>The post <a href="https://blogs.vmware.com/PowerCLI/2023/11/introducing-powercli-13-2.html">Introducing PowerCLI 13.2</a> appeared first on <a href="https://blogs.vmware.com/PowerCLI">VMware PowerCLI Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>PowerCLI and vSAN: A Comprehensive Guide to vSAN Disk Management</title>
		<link>https://blogs.vmware.com/PowerCLI/2023/08/powercli-and-vsan-a-comprehensive-guide-to-vsan-disk-management.html</link>
		
		<dc:creator><![CDATA[Nichole Yang]]></dc:creator>
		<pubDate>Fri, 04 Aug 2023 09:37:16 +0000</pubDate>
				<category><![CDATA[Storage]]></category>
		<category><![CDATA[disk management]]></category>
		<category><![CDATA[vSAN]]></category>
		<guid isPermaLink="false">https://blogs.vmware.com/PowerCLI/?p=4565</guid>

					<description><![CDATA[<div><img width="300" height="136" src="https://blogs.vmware.com/PowerCLI/files/2023/07/vsan-product-ico-rgb_400px_1-300x136.jpg" class="attachment-medium size-medium wp-post-image" alt="" decoding="async" loading="lazy" style="margin-bottom: 10px;" srcset="https://blogs.vmware.com/PowerCLI/files/2023/07/vsan-product-ico-rgb_400px_1-300x136.jpg 300w, https://blogs.vmware.com/PowerCLI/files/2023/07/vsan-product-ico-rgb_400px_1-1024x464.jpg 1024w, https://blogs.vmware.com/PowerCLI/files/2023/07/vsan-product-ico-rgb_400px_1-768x348.jpg 768w, https://blogs.vmware.com/PowerCLI/files/2023/07/vsan-product-ico-rgb_400px_1-1536x696.jpg 1536w, https://blogs.vmware.com/PowerCLI/files/2023/07/vsan-product-ico-rgb_400px_1-600x272.jpg 600w, https://blogs.vmware.com/PowerCLI/files/2023/07/vsan-product-ico-rgb_400px_1.jpg 1850w" sizes="(max-width: 300px) 100vw, 300px" /></div>
<p>In this blog post, we&#8217;ll explore the powerful capabilities of PowerCLI in managing disks within a vSAN cluster and vSAN ESA enabled cluster. Disk management is a critical aspect of maintaining an efficient and optimized virtual storage infrastructure. With the help of specific PowerCLI cmdlets for vSAN cluster, we can manage vSAN disk groups, such as &#8230; <a href="https://blogs.vmware.com/PowerCLI/2023/08/powercli-and-vsan-a-comprehensive-guide-to-vsan-disk-management.html">Continued</a></p>
<p>The post <a href="https://blogs.vmware.com/PowerCLI/2023/08/powercli-and-vsan-a-comprehensive-guide-to-vsan-disk-management.html">PowerCLI and vSAN: A Comprehensive Guide to vSAN Disk Management</a> appeared first on <a href="https://blogs.vmware.com/PowerCLI">VMware PowerCLI Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div><img width="300" height="136" src="https://blogs.vmware.com/PowerCLI/files/2023/07/vsan-product-ico-rgb_400px_1-300x136.jpg" class="attachment-medium size-medium wp-post-image" alt="" decoding="async" loading="lazy" style="margin-bottom: 10px;" srcset="https://blogs.vmware.com/PowerCLI/files/2023/07/vsan-product-ico-rgb_400px_1-300x136.jpg 300w, https://blogs.vmware.com/PowerCLI/files/2023/07/vsan-product-ico-rgb_400px_1-1024x464.jpg 1024w, https://blogs.vmware.com/PowerCLI/files/2023/07/vsan-product-ico-rgb_400px_1-768x348.jpg 768w, https://blogs.vmware.com/PowerCLI/files/2023/07/vsan-product-ico-rgb_400px_1-1536x696.jpg 1536w, https://blogs.vmware.com/PowerCLI/files/2023/07/vsan-product-ico-rgb_400px_1-600x272.jpg 600w, https://blogs.vmware.com/PowerCLI/files/2023/07/vsan-product-ico-rgb_400px_1.jpg 1850w" sizes="(max-width: 300px) 100vw, 300px" /></div><p>In this blog post, we&#8217;ll explore the powerful capabilities of PowerCLI in managing disks within a vSAN cluster and vSAN ESA enabled cluster. Disk management is a critical aspect of maintaining an efficient and optimized virtual storage infrastructure. <span class="inline-comment-marker" data-ref="2eeaa478-63e5-46ab-88a0-328e5488afb6">With the help of specific PowerCLI cmdlets for vSAN cluster, we can manage vSAN disk groups, such as New-VsanDiskGroup, New-VsanDisk, Get-VsanDisk, Remove-VsanDisk, Get-VsanDiskGroup, and Remove-VsanDiskGroup. With Get-VsanEsaEligibleDisk, Add-VsanStoragePoolDisk, Remove-VsanStoragePoolDisk, we can streamline our vSAN ESA storage pool disk management tasks and ensure smooth operations within vSAN or vSAN ESA environment</span>. Let&#8217;s dive in!</p>
<h2 id="UnleashingthePowerofPowerCLI:AComprehensiveGuidetovSANDiskManagement-ManagingvSANDisksGroupsandvSANDisks">Managing vSAN Disks Groups and vSAN Disks</h2>
<p>In vSAN clusters, vSAN architecture consists of two tiers: a cache tier for the purpose of read caching and write buffering, and a capacity tier for persistent storage. This <span class="inline-comment-marker" data-ref="d386394c-2e00-498b-8b4f-7d3c4f55eae1">two-tier</span> design offers supreme performance to VMs while ensuring that data is written to devices in the most efficient way. vSAN uses a logical construct called disk groups to manage the relationship between capacity devices and their cache tier.</p>
<h3 id="UnleashingthePowerofPowerCLI:AComprehensiveGuidetovSANDiskManagement-ManagingvSANDiskGroups">Managing vSAN Disk Groups</h3>
<p>1. Creating a New Disk Group</p>
<p>To create a new disk group with specific solid-state and hard disk devices, we can <span class="inline-comment-marker" data-ref="b2bcfddc-ef94-4c53-8676-c5292fcd0ba9">use</span> the New-VsanDiskGroup cmdlet. For example, let&#8217;s create a new disk group with an SSD and two data disks:</p>
<p class="p1"><code></code></p>
<p></p><pre class="crayon-plain-tag">New-VsanDiskGroup -VMHost $vmHost -SsdCanonicalName $MySsdCanonicalName -DataDiskCanonicalName $DataDisk1,$DataDisk2</pre><p></p>
<p class="p1"><code></code></p>
<p class="p1"><code></code></p>
<p>2. Fetching vSAN Disk Groups</p>
<p>To retrieve information about vSAN disk groups, we can use the Get-VsanDiskGroup cmdlet. For instance, to fetch the disk group &#8220;<span class="inline-comment-marker" data-ref="6e32e2d0-41a6-49e6-a0c2-6864f77114c0">DiskGroup02</span>&#8221; we can execute the following command. T<span class="inline-comment-marker" data-ref="dcc0d445-d012-4342-a0f3-899324a7720d">he output will the type of VsanDiskGroup.</span></p>
<p class="p1"><code></code></p>
<p></p><pre class="crayon-plain-tag">Get-VsanDiskGroup -Name "DiskGroup02"</pre><p></p>
<p class="p1"><code></code></p>
<p class="p1"><code></code></p>
<p class="p1">3. Removing vSAN Disk Groups</p>
<p>If we need to remove a vSAN disk group, we can use the Remove-VsanDiskGroup cmdlet. We can reuse the result from the Get-VsanDiskGroup command.</p><pre class="crayon-plain-tag">$diskGroup = Get-VsanDiskGroup -DiskCanonicalName $DiskCanonicalName -VMHost $vmHost
Remove-VsanDiskGroup&amp;nbsp;-VsanDiskGroup $diskGroup -Confirm:$false</pre><p>vSAN disk groups consist of vSAN disks. We can, therefore,  manage vSAN disks within vSAN disk groups.</p>
<p>4. Adding vSAN Disks to an existing Disk Group</p>
<p>To add a vSAN disk to an existing disk group, we can <span class="inline-comment-marker" data-ref="4794c006-6a11-49bd-b56a-9650722400c8">use</span> the New-VsanDisk cmdlet. For example, we can use the New-VsanDisk cmdlet to add a new disk, <span class="inline-comment-marker" data-ref="0dd37dce-6866-474d-97d4-0d6c341272e2">&#8220;DiskCanonicalName&#8221;</span> to this disk group:</p>
<p><code></code></p><pre class="crayon-plain-tag">New-VsanDisk -CanonicalName "mpx.vmhba0:C0:T11:L0" -VsanDiskGroup $vsanDiskGroup</pre><p><code></code></p>
<p><code></code></p>
<p>5. Fetching vSAN Disks</p>
<p>To fetch vSAN disks based on their ID or disk group information, we can use the Get-VsanDisk cmdlet. For instance, to retrieve information about all disks in a specified vSAN disk group we can execute the following command:</p><pre class="crayon-plain-tag">Get-VsanDisk -VsanDiskGroup $vsanDiskGroup</pre><p>6. Removing vSAN Disks from a Disk Group</p>
<p>If we need to remove a vSAN disk from a disk group, the Remove-VsanDisk cmdlet comes to our rescue. Let&#8217;s remove &#8220;mpx.vmhba0:C0:T11:L0&#8221; disk by <span class="inline-comment-marker" data-ref="ea3ec97c-b31e-4157-8a25-70e8724d2aa2">using</span> the following command:</p><pre class="crayon-plain-tag">$vsanDisk = Get-VsanDisk -CanonicalName "mpx.vmhba0:C0:T11:L0"
Remove-VsanDisk -VsanDisk $vsanDisk -Confirm:$false</pre><p></p>
<h2 id="UnleashingthePowerofPowerCLI:AComprehensiveGuidetovSANDiskManagement-IntroducingStoragePoolDisksinvSANESA">Introducing Storage Pool Disks in vSAN ESA</h2>
<p>In the vSAN 8.0, we introduced a new storage architecture. In <a href="https://core.vmware.com/blog/introduction-vsan-express-storage-architecture">vSAN ESA</a> (Express Storage Architecture), we <span class="inline-comment-marker" data-ref="83589bcd-2901-4119-ac3c-e5c8c62030a2">introduced</span> a new storage format called storage pool disks. These disks provide a more efficient and simplified approach to adding, removing, and managing storage within the ESA environment.</p>
<p class="p">We can claim disks to define a storage pool on a <span class="ph productname">vSAN</span> host. Each host that contributes storage contains a single storage pool of flash devices. Each flash device provides caching and capacity to the cluster. We can create a storage pool with any devices that are compatible for ESA. <span class="ph productname">vSAN</span> creates only one storage pool per host.</p>
<p class="p">In a storage pool, each device provides both caching and capacity in a single tier. This is different from a Disk Group, which has dedicated devices in different tiers of cache and capacity.</p>
<p class="p">Before we add storage pool disks, we can see which one is available to add by using the Get-VsanEsaEligibleDisk cmdlet. The output will be the ScsiLun type.</p>
<p></p><pre class="crayon-plain-tag">Get-VsanEsaEligibleDisk -Cluster $cluster</pre><p><span class="token-powershell variable"><span class="token-powershell function">When we know the disk canonical name from ScsiLun, we can claim disks to define the storage pool on a specified host.<br />
</span></span></p><pre class="crayon-plain-tag">Add-VsanStoragePoolDisk -VMHost (Get-VMHost "MyVMHost") -VsanStoragePoolDiskType "singleTier" -DiskCanonicalName ("mpx.vmhba0:C0:T11:L0","mpx.vmhba0:C0:T12:L0")</pre><p><span class="token-powershell variable">Also, we can query the storage pool disk with the specified VMHost or Cluster, and remove the disk from the defined storage pool disk.</span></p><pre class="crayon-plain-tag">$disks =get-vsanstoragepooldisk -VMHost (Get-VMHost 10.192.201.50)

Remove-VsanStoragePoolDisk -VsanStoragePoolDisk $disks -VsanDataMigrationMode nodatamigration -Purpose "test" -Confirm:$false</pre><p>&nbsp;</p>
<p>By harnessing the power of PowerCLI and leveraging its rich features, you can simplify and optimize your storage infrastructure, ensuring smooth operations within your vSAN cluster.</p>
<p><span class="inline-comment-marker" data-ref="dba1c815-b7de-4f49-8b7f-7a0fcbcf1ea8">Happy disk management with PowerCLI in your vSAN environment!</span></p><p>The post <a href="https://blogs.vmware.com/PowerCLI/2023/08/powercli-and-vsan-a-comprehensive-guide-to-vsan-disk-management.html">PowerCLI and vSAN: A Comprehensive Guide to vSAN Disk Management</a> appeared first on <a href="https://blogs.vmware.com/PowerCLI">VMware PowerCLI Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>PowerCLI and vSAN: Exploring Remote Datastore Mounting</title>
		<link>https://blogs.vmware.com/PowerCLI/2023/07/powercli-and-vsan-exploring-remote-datastore-mounting.html</link>
		
		<dc:creator><![CDATA[Nichole Yang]]></dc:creator>
		<pubDate>Tue, 25 Jul 2023 13:46:23 +0000</pubDate>
				<category><![CDATA[Storage]]></category>
		<guid isPermaLink="false">https://blogs.vmware.com/PowerCLI/?p=4528</guid>

					<description><![CDATA[<div><img width="300" height="136" src="https://blogs.vmware.com/PowerCLI/files/2023/07/vsan-product-ico-rgb_400px_1-300x136.jpg" class="attachment-medium size-medium wp-post-image" alt="" decoding="async" loading="lazy" style="margin-bottom: 10px;" srcset="https://blogs.vmware.com/PowerCLI/files/2023/07/vsan-product-ico-rgb_400px_1-300x136.jpg 300w, https://blogs.vmware.com/PowerCLI/files/2023/07/vsan-product-ico-rgb_400px_1-1024x464.jpg 1024w, https://blogs.vmware.com/PowerCLI/files/2023/07/vsan-product-ico-rgb_400px_1-768x348.jpg 768w, https://blogs.vmware.com/PowerCLI/files/2023/07/vsan-product-ico-rgb_400px_1-1536x696.jpg 1536w, https://blogs.vmware.com/PowerCLI/files/2023/07/vsan-product-ico-rgb_400px_1-600x272.jpg 600w, https://blogs.vmware.com/PowerCLI/files/2023/07/vsan-product-ico-rgb_400px_1.jpg 1850w" sizes="(max-width: 300px) 100vw, 300px" /></div>
<p>In the ever-evolving world of PowerCLI, each release brings exciting updates and enhancements to vSAN. With new cmdlets and vSAN APIs, managing your virtual storage infrastructure becomes even more efficient and powerful. One of the recent additions to PowerCLI is the support for remote datastore related features, opening up new possibilities for vSAN clusters. Now, &#8230; <a href="https://blogs.vmware.com/PowerCLI/2023/07/powercli-and-vsan-exploring-remote-datastore-mounting.html">Continued</a></p>
<p>The post <a href="https://blogs.vmware.com/PowerCLI/2023/07/powercli-and-vsan-exploring-remote-datastore-mounting.html">PowerCLI and vSAN: Exploring Remote Datastore Mounting</a> appeared first on <a href="https://blogs.vmware.com/PowerCLI">VMware PowerCLI Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div><img width="300" height="136" src="https://blogs.vmware.com/PowerCLI/files/2023/07/vsan-product-ico-rgb_400px_1-300x136.jpg" class="attachment-medium size-medium wp-post-image" alt="" decoding="async" loading="lazy" style="margin-bottom: 10px;" srcset="https://blogs.vmware.com/PowerCLI/files/2023/07/vsan-product-ico-rgb_400px_1-300x136.jpg 300w, https://blogs.vmware.com/PowerCLI/files/2023/07/vsan-product-ico-rgb_400px_1-1024x464.jpg 1024w, https://blogs.vmware.com/PowerCLI/files/2023/07/vsan-product-ico-rgb_400px_1-768x348.jpg 768w, https://blogs.vmware.com/PowerCLI/files/2023/07/vsan-product-ico-rgb_400px_1-1536x696.jpg 1536w, https://blogs.vmware.com/PowerCLI/files/2023/07/vsan-product-ico-rgb_400px_1-600x272.jpg 600w, https://blogs.vmware.com/PowerCLI/files/2023/07/vsan-product-ico-rgb_400px_1.jpg 1850w" sizes="(max-width: 300px) 100vw, 300px" /></div><p>In the ever-evolving world of PowerCLI, each release brings exciting updates and enhancements to vSAN. With new cmdlets and vSAN APIs, managing your virtual storage infrastructure becomes even more efficient and powerful. One of the recent additions to PowerCLI is the support for remote datastore related features, opening up new possibilities for vSAN clusters.</p>
<p>Now, vSAN clusters have the ability to share their datastores with other vSAN clusters, or even beyond a single vCenter Server. The beauty of this functionality lies in the flexibility it offers. Any compatible vSAN cluster can act as a server, allowing other vSAN clusters to mount its local datastores. This opens up a world of potential use cases and enables efficient data sharing across clusters.</p>
<p>But how do you go about mounting a remote datastore using PowerCLI? Fear not, as I&#8217;ll guide you through the process using PowerCLI cmdlets in various scenarios.</p>
<h2 id="PowerCLIandvSAN:ExploringRemoteDatastoreMounting-ManagingvSANRemoteDatastores">Managing vSAN Remote Datastores</h2>
<p class="p1">Starting from PowerCL 12.7, we have introduced support for querying, mounting, and unmounting remote datastores for a specific cluster using the Get-VsanClusterConfiguration and Set-VsanClusterConfiguration cmdlets. Let&#8217;s delve into the details and discover how these cmdlets can empower you in managing remote datastores.</p>
<h3 id="PowerCLIandvSAN:ExploringRemoteDatastoreMounting-Querythemountedremotedatastores">Query the mounted remote datastores</h3>
<p>By utilizing the Get-VsanClusterConfiguration cmdlet, we gain access to view all the properties of the vSAN configuration within the specific cluster. This includes crucial information about the mounted remote datastores.</p>
<p>In addition to accessing the overall vSAN configuration, we can specifically retrieve the value of the RemoteDatastore property by using a simple dot notation. This allows us to obtain accurate details about the remote datastores and their current status.</p><pre class="crayon-plain-tag">Get-VsanClusterConfiguration -Cluster "MyCluster" | select *
$vsanConfiguration = Get-VsanClusterConfiguration -Cluster "MyCluster"
$vsanConfiguration.RemoteDatastore</pre><p></p>
<h3 id="PowerCLIandvSAN:ExploringRemoteDatastoreMounting-Mount/Unmounttheremotedatastore">Mount / Unmount the remote datastore</h3>
<p>As we intend to modify the vSAN configuration setting, we will utilize the Set-VsanClusterConfiguration cmdlet. To do so, it is necessary to retrieve the original vSAN cluster configuration beforehand <span class="inline-comment-marker" data-ref="39818c1c-86ee-49cd-95e7-d8dbaaa52aae">with the Get-VsanClusterConfiguration cmdlet</span>.</p>
<p class="p1"><sup><code></code></sup></p>
<p></p><pre class="crayon-plain-tag">$config = Get-VsanClusterConfiguration -Cluster "MyCluster"
Set-VsanClusterConfiguration -Configuration $config -MountRemoteDatastore (Get-Datastore -Name "MyDatastore")

#If we want to unmount the existing remote datastore, we can go fetch the current vSAN configuration again
$newVsanConfiguration = Get-VsanClusterConfiguration -Cluster "MyCluster"
Set-VsanClusterConfiguration -Configuration $newVsanConfiguration -UnMountRemoteDatastore $newVsanConfiguration.RemoteDatastore</pre><p></p>
<p class="p1"><sup><code></code></sup></p>
<p class="p1"><sup><code></code></sup></p>
<h3 id="PowerCLIandvSAN:ExploringRemoteDatastoreMounting-Mount/Unmounttheremotedatastorefromthestretchedcluster">Mount / Unmount the remote datastore from the stretched cluster</h3>
<p>In the latest PowerCLI <span class="inline-comment-marker" data-ref="29043fad-fd03-4cd8-ab23-cad507d4ac2c">13.1 release</span>, which supports vSAN 8.0 Update 1, we&#8217;re thrilled to introduce the ability to mount remote datastores from both stretched clusters and vSAN ESA (Express Storage Architecture) enabled clusters. If you want to mount or unmount the remote datastore from a vSAN ESA enabled cluster, the operation would be the same as the first scenario, the normal vSAN cluster, and no additional settings are required. Let&#8217;s take a look at the configuration steps involved when mounting from stretched clusters</p>
<p><strong><span class="inline-comment-marker" data-ref="810e7a28-894d-4fc9-92fa-6de24c75769d">Mounting the Remote Datastore from Stretched Clusters</span></strong></p>
<p>When dealing with stretched clusters, an additional configuration step is necessary to ensure seamless remote datastore mounting. Specifically, you&#8217;ll need to configure the RemoteVsanServerClusterConfig as outlined below.</p>
<p><strong><span class="inline-comment-marker" data-ref="0db1f5f6-4bd4-4812-888d-b32ec48a1c7d">Understanding the NetworkTopology Parameter</span></strong></p>
<p>The NetworkTopology parameter plays a crucial role in defining the network topology between the client and server clusters in an HCI Mesh configuration. It offers two values: Asymmetric and Symmetric. In a Symmetric configuration, no ServerSiteName or ClientSiteName is required. However, in an Asymmetric configuration, the ServerSiteName becomes necessary and represents the fault domain of the stretched cluster, <span class="inline-comment-marker" data-ref="69565ecc-3dee-41af-a1d6-648ef6ad927e">which is</span> referred to as &#8220;Preferred&#8221; or &#8220;Secondary&#8221;. Additionally, if both the host cluster and server cluster are stretched clusters, the ClientSiteName is also required.</p>
<p>Below are some sample configurations for different RemoteVsanServerClusterConfig scenarios.</p><pre class="crayon-plain-tag">$serverconfig = New-RemoteVsanServerClusterConfig -cluster $clusterServer -networktopology "Symmetric" 
$serverconfig = New-RemoteVsanServerClusterConfig -cluster $clusterServer -networktopology "Asymmetric" -ServerSiteName "Secondary"
$serverconfig = New-RemoteVsanServerClusterConfig -cluster $clusterServer -networktopology "Asymmetric" -ServerSiteName "Secondary" -ClientSiteName "Preferred"

Set-VsanClusterConfiguration -configuration $clusterClient -MountRemoteDatastore $datastore -RemoteVsanServerClusterConfig $serverconfig</pre><p></p>
<p class="p1">When unmounting a remote datastore from the stretched cluster, it is <span class="inline-comment-marker" data-ref="bca108d4-fea3-4a82-9f9d-f336bbc8318c">enough</span> to pass the UnmountRemoteDatastore parameter. The RemoteVsanServerClusterConfig will be automatically adjusted and cleared accordingly.</p>
<p></p><pre class="crayon-plain-tag">Set-VsanClusterConfiguration -configuration $config -UnmountRemoteDatastore $datastore</pre><p></p>
<h3 id="PowerCLIandvSAN:ExploringRemoteDatastoreMounting-Mount/UnmounttheremotedatastorefromanothervCenterServersystem" class="p1">Mount / Unmount the remote datastore from another vCenter Server system</h3>
<p>In PowerCLI13.1, we also have the capability to mount and unmount remote datastores from another <span class="inline-comment-marker" data-ref="e64dbf0c-e0c2-4b50-91cd-95719ed86621">vCenter Server System</span>, allowing for cross-vCenter remote datastore operations.</p>
<h3>Adding Datastore Source to the current vCenter Server system</h3>
<p>Before we can proceed with mounting the Cross-vCenter (XVC) remote datastore, we need to add the datastore source to the <span class="inline-comment-marker" data-ref="1b3d1fe6-b6e2-4cc6-8668-8cf9e0aef8f6">current vCenter</span> Server system by <span class="inline-comment-marker" data-ref="cd0f05b8-ccdc-4ada-b51e-eeb148b23dee">using</span> the appropriate credentials. This step ensures that the target <span class="inline-comment-marker" data-ref="82db671b-c2a4-47a6-8589-c1e0a02e071f">vCenter</span> Server can be accessed as another datastore source. To achieve this, we can utilize the New-VsanHCIMeshDatastoreSource cmdlet, where the VCHost parameter specifies the target vCenter that we want to add as a datastore source.</p><pre class="crayon-plain-tag">New-VsanHCIMeshDatastoreSource -VCHost 'MyAnotherVCIP' -User 'administrator@vsphere.local'  -Password 'MyVCPassword'</pre><p></p>
<h3>Retrieving HCI Mesh Datastore</h3>
<p>Once we&#8217;ve successfully added the datastore source, we can retrieve the datastore and fetch the HCI mesh datastore from the specified source. This retrieval process allows us to access the necessary data and information required for further operations.</p><pre class="crayon-plain-tag">$dsSource = Get-VsanHCIMeshDatastoreSource -VCHost 'MyVCIP'
$ds = Get-VsanHCIMeshDatastore -VsanHCIMeshDatastoresource $dsSource</pre><p></p>
<h3>Mounting and Unmounting Remote Datastores</h3>
<p>With the retrieved HCI mesh datastore at our disposal, we can now proceed to mount or unmount the remote datastore by <span class="inline-comment-marker" data-ref="6fa23cb2-9d6e-40b5-ad49-0a92bbc38292">using</span> the MountXVCDatastore or UnmountXVCDatastore parameters. With these parameters, you can execute the desired operations efficiently.</p><pre class="crayon-plain-tag">Set-VsanClusterConfiguration -Configuration $clusterClient -MountXVCDatastore $ds

Set-VsanClusterConfiguration -Configuration $clusterClient -UnmountXVCDatastore $ds</pre><p></p>
<h3 id="PowerCLIandvSAN:ExploringRemoteDatastoreMounting-QuerythemounteddatastorefromanothervCenterServerSystem">Query the mounted datastore from another <span class="inline-comment-marker" data-ref="6bfa2627-4de2-4be1-91fc-52470c7741d6">vCenter Server System</span></h3>
<p>The mounted datastore from another vCenter Server system can be fetched with the <span class="inline-comment-marker" data-ref="f74f4664-e85a-450e-b767-987d34bcb6a3">VsanXVCDatastore parameter</span>.</p>
<p><code></code></p><pre class="crayon-plain-tag">$vsanConfiguration = Get-VsanClusterConfiguration -Cluster "MyCluster"

$vsanConfiguration.VsanXVCDatastore

#output
DatastoreMoID            OwnerVcAddress
----------------------   --------------
Datastore-datastore-17   MyVCIP</pre><p><code></code></p>
<h2>Summary</h2>
<p>In this blog post, we&#8217;ve touched upon the latest advancements in PowerCLI and vSAN, focusing on the ability to mount remote datastores. As we move forward, we&#8217;ll delve deeper into each scenario and provide step-by-step guides on configuring remote datastores for stretched clusters, understanding network topology, implementing the <span class="inline-comment-marker" data-ref="cbbcced4-8c07-4d36-8059-e5af7e415272">RemoteVsanServerClusterConfig cmdlet</span>, and exploring the <span class="inline-comment-marker" data-ref="23d14315-70e8-4eeb-904f-0ceaec1194b8">cross-vCenter</span> remote datastores.</p>
<p>Join us on this thrilling journey as we unlock the full potential of PowerCLI and vSAN, empowering you to optimize your virtual storage infrastructure and harness the benefits of remote datastore mounting. Exciting times lie ahead for vSAN enthusiasts and PowerCLI users alike!</p>
<p>Make sure to stay tuned for our upcoming blog posts as we&#8217;ll unveil more insights, tips, and tricks to enhance your vSAN management experience. Until then, happy exploring!</p><p>The post <a href="https://blogs.vmware.com/PowerCLI/2023/07/powercli-and-vsan-exploring-remote-datastore-mounting.html">PowerCLI and vSAN: Exploring Remote Datastore Mounting</a> appeared first on <a href="https://blogs.vmware.com/PowerCLI">VMware PowerCLI Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Array Based Replication with PowerCLI 13.1</title>
		<link>https://blogs.vmware.com/PowerCLI/2023/06/array-based-replication-with-powercli-13-1.html</link>
		
		<dc:creator><![CDATA[Pavel Dimitrov]]></dc:creator>
		<pubDate>Tue, 06 Jun 2023 08:23:30 +0000</pubDate>
				<category><![CDATA[Advanced]]></category>
		<category><![CDATA[Array Based Replication]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[VMware Site Recovery Manager]]></category>
		<guid isPermaLink="false">https://blogs.vmware.com/PowerCLI/?p=4474</guid>

					<description><![CDATA[<div><img width="300" height="166" src="https://blogs.vmware.com/PowerCLI/files/2023/06/srmlogo2-300x166.png" class="attachment-medium size-medium wp-post-image" alt="" decoding="async" loading="lazy" style="margin-bottom: 10px;" srcset="https://blogs.vmware.com/PowerCLI/files/2023/06/srmlogo2-300x166.png 300w, https://blogs.vmware.com/PowerCLI/files/2023/06/srmlogo2-1024x566.png 1024w, https://blogs.vmware.com/PowerCLI/files/2023/06/srmlogo2-768x424.png 768w, https://blogs.vmware.com/PowerCLI/files/2023/06/srmlogo2-1536x848.png 1536w, https://blogs.vmware.com/PowerCLI/files/2023/06/srmlogo2-600x331.png 600w, https://blogs.vmware.com/PowerCLI/files/2023/06/srmlogo2.png 1805w" sizes="(max-width: 300px) 100vw, 300px" /></div>
<p>This blog post explains how to configure Array Based Replication (ABR) with the PowerCLI VMware.Sdk.Srm module. Before diving in, consider reading the blog post, explaining the basic concepts of the VMware.Sdk.Srm module: &#8220;Managing SRM and VR with PowerCLI 13.1&#8220;. There you can find out more about the module&#8217;s connection management, which will not be covered &#8230; <a href="https://blogs.vmware.com/PowerCLI/2023/06/array-based-replication-with-powercli-13-1.html">Continued</a></p>
<p>The post <a href="https://blogs.vmware.com/PowerCLI/2023/06/array-based-replication-with-powercli-13-1.html">Array Based Replication with PowerCLI 13.1</a> appeared first on <a href="https://blogs.vmware.com/PowerCLI">VMware PowerCLI Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div><img width="300" height="166" src="https://blogs.vmware.com/PowerCLI/files/2023/06/srmlogo2-300x166.png" class="attachment-medium size-medium wp-post-image" alt="" decoding="async" loading="lazy" style="margin-bottom: 10px;" srcset="https://blogs.vmware.com/PowerCLI/files/2023/06/srmlogo2-300x166.png 300w, https://blogs.vmware.com/PowerCLI/files/2023/06/srmlogo2-1024x566.png 1024w, https://blogs.vmware.com/PowerCLI/files/2023/06/srmlogo2-768x424.png 768w, https://blogs.vmware.com/PowerCLI/files/2023/06/srmlogo2-1536x848.png 1536w, https://blogs.vmware.com/PowerCLI/files/2023/06/srmlogo2-600x331.png 600w, https://blogs.vmware.com/PowerCLI/files/2023/06/srmlogo2.png 1805w" sizes="(max-width: 300px) 100vw, 300px" /></div><p>This blog post explains how to configure Array Based Replication (ABR) with the PowerCLI VMware.Sdk.Srm module. Before diving in, consider reading the blog post, explaining the basic concepts of the VMware.Sdk.Srm module: &#8220;<a href="https://blogs.vmware.com/PowerCLI/2023/06/managing-srm-and-vr-with-powercli-13-1.html">Managing SRM and VR with PowerCLI 13.1</a>&#8220;. There you can find out more about the module&#8217;s connection management, which will not be covered in details here.</p>
<h2>Connect Site Recovery Manager with Connect-SrmSdkServer</h2>
<p>To connect Site Recover Manager server use the Connect-SrmSdkServer cmdlet:</p><pre class="crayon-plain-tag">$srmConnection = Connect-SrmSdkServer -Server &quot;MySrmAddress.com&quot; `
&nbsp;&nbsp; -User &quot;administrator@vsphere.local&quot; `
&nbsp;&nbsp; -Password &quot;MyLocalVcPassword&quot; `
&nbsp;&nbsp; -RemoteUser &quot;administrator@vsphere.local&quot; `
&nbsp;&nbsp; -RemotePassword &quot;MyRemoteVcPassword&quot;</pre><p></p>
<h2>Create Array Managers for the Array Pair</h2>
<p>Before creating the array pair you must create array managers for the local and the remote sites.</p>
<h3>Retrieve Storage Replication Adapter for the local Array Manager</h3>
<p>For this example we will use NetApp Storage Replication Adapter for ONTAP:</p><pre class="crayon-plain-tag">$localAdapter = (Invoke-SrmGetStorageAdapters -PairingId $srmConnection.ConnectedPairing.PairingId `
   -SrmId $srmConnection.ConnectedPairing.LocalSrmServer.Id `
   -FilterProperty 'Name' `
   -Filter 'NetApp').List[0]</pre><p>Invoke-SrmGetStorageAdapters returns a list of adapters, matching the specified filters. In our case we filter the available storage adapters by their Name property and expect only one adapter with name matching &#8216;NetApp&#8217; to be found. Accordingly we will use the first element of the List property of the StorageAdapterDetailsDrResponseList object, returned from Invoke-SrmGetStorageAdapters.</p>
<h3>Prepare Connection Parameters for the Storage Replication Adapter</h3>
<p>To allow the array manager to communicate with the storage adapter we must prepare connection parameters, which will be used for the connection. Retrieve ConnectionParamGroup object for the local storage adapter:</p><pre class="crayon-plain-tag">$localConnectionParamGroup = (Invoke-SrmGetStorageAdapterConnectionParams `
   -PairingId $srmConnection.ConnectedPairing.PairingId `
   -SrmId $srmConnection.ConnectedPairing.LocalSrmServer.Id `
   -StorageAdapterId $localAdapter.Id).List[0]</pre><p>The output of Invoke-SrmGetStorageAdapterConnectionParams is a ConnectionParamGroupDrResponseList object, which in our case contains a list of one ConnectionParamGroup element. You have to provide values to the connection parameter, available in the $localConnectionParamGroup.ConnectionParams list. The set of parameters, available in the ConnectionParams list is specific for the used storage replication adapter. Here we will provide values for connection parameters, specific for the NetApp storage replication adapter:</p><pre class="crayon-plain-tag">($localConnectionParamGroup.ConnectionParams | where {$_.key -eq &quot;username&quot;}).Value = &quot;myUser&quot;
($localConnectionParamGroup.ConnectionParams | where {$_.key -eq &quot;password&quot;}).Value = &quot;myPass&quot;
($localConnectionParamGroup.ConnectionParams | where {$_.key -eq &quot;VolumeInclusion&quot;}).Value = &quot;myVolume&quot;
($localConnectionParamGroup.ConnectionParams | where {$_.key -eq &quot;SVM Name&quot;}).Value = &quot;myLocalSvmName&quot;
($localConnectionParamGroup.ConnectionParams | where {$_.key -eq &quot;mgmtIP&quot;}).Value = &quot;192.168.10.10&quot;</pre><p></p>
<h3>Create the local Array Manager</h3>
<p>Now when we have all the prerequisites for the array manager, use the ConnectionParamGroup and the storage adapter Id to initialize ArrayManagerSpec object:</p><pre class="crayon-plain-tag">$localArrayManagerSpec = Initialize-SrmArrayManagerSpec -Name &quot;primary-array-manager&quot; `
&nbsp;&nbsp; -StorageAdapter $localAdapters.Id `
&nbsp;&nbsp; -ConnectionParams $localConnectionParamGroup</pre><p>Then create the array manger, using the Invoke-SrmCreateArrayManage cmdlet:</p><pre class="crayon-plain-tag">$task = Invoke-SrmCreateArrayManager -PairingId $srmConnection.ConnectedPairing.PairingId `
&nbsp;&nbsp; -SrmId $srmConnection.ConnectedPairing.LocalSrmServer.Id `
&nbsp;&nbsp; -ArrayManagerSpec $localArrayManagerSpec</pre><p>Wait for the task to complete and retrieve the array manager. The Result property of the task will contain the Id of the array manager, once the task completes:</p><pre class="crayon-plain-tag">$localManagerTask = Invoke-SrmGetTaskInfo -TaskId $task.Id

$localArrayManager = Invoke-SrmGetArrayManager -PairingId $srmConnection.ConnectedPairing.PairingId `
&nbsp;&nbsp; -SrmId $srmConnection.ConnectedPairing.LocalSrmServer.Id `
&nbsp;&nbsp; -ArrayManagerId $localManagerTask.Result</pre><p>Create the remote array manager, using the same approach:</p><pre class="crayon-plain-tag">$remoteAdapter = (Invoke-SrmGetStorageAdapters -PairingId $srmConnection.ConnectedPairing.PairingId `
   -SrmId $srmConnection.ConnectedPairing.RemoteSrmServer.Id `
   -FilterProperty 'Name' `
   -Filter 'NetApp').List[0]

$remoteConnectionParamGroup = (Invoke-SrmGetStorageAdapterConnectionParams `
   -PairingId $srmConnection.ConnectedPairing.PairingId `
   -SrmId $srmConnection.ConnectedPairing.RemoteSrmServer.Id `
   -StorageAdapterId $remoteAdapters.List[0].Id).List[0]

($remoteConnectionParamGroup.ConnectionParams | Where-Object {$_.key -eq &quot;username&quot;}).Value = &quot;myUser&quot;
($remoteConnectionParamGroup.ConnectionParams | Where-Object {$_.key -eq &quot;password&quot;}).Value = &quot;myPass&quot;
($remoteConnectionParamGroup.ConnectionParams | Where-Object {$_.key -eq &quot;VolumeInclusion&quot;}).Value = &quot;myVolume&quot;
($remoteConnectionParamGroup.ConnectionParams | Where-Object {$_.key -eq &quot;SVM Name&quot;}).Value = &quot;myRemoteSvmName&quot;
($remoteConnectionParamGroup.ConnectionParams | Where-Object {$_.key -eq &quot;mgmtIP&quot;}).Value = &quot;192.168.10.11&quot;

$remoteArrayManagerSpec = Initialize-SrmArrayManagerSpec -Name &quot;secondary-array-manager&quot; `
   -StorageAdapter $remoteAdapter.Id `
   -ConnectionParams $remoteConnectionParamGroup

$task = Invoke-SrmCreateArrayManager -PairingId $srmConnection.ConnectedPairing.PairingId `
   -SrmId $srmConnection.ConnectedPairing.RemoteSrmServer.Id `
   -ArrayManagerSpec $remoteArrayManagerSpec

#Wait for the create array manager task to complete
$remoteManagerTask = Invoke-SrmGetTaskInfo -TaskId $task.Id

$remoteArrayManager = Invoke-SrmGetArrayManager -PairingId $srmConnection.ConnectedPairing.PairingId `
   -SrmId $srmConnection.ConnectedPairing.RemoteSrmServer.Id `
   -ArrayManagerId $remoteManagerTask.Result</pre><p></p>
<h2>Create Replicated Array Pair</h2>
<p>To create the replicated array pair, you have to initialize a ReplicatedArrayPairSpec object:</p><pre class="crayon-plain-tag">$replicatedArrayPairSpec = Initialize-SrmReplicatedArrayPairSpec -ArrayManagerId $localArrayManager.Id `
&nbsp;&nbsp; -StorageArrayKey $localArrayManager.StorageArrays[0].StorageArrayKey `
&nbsp;&nbsp; -PeerStorageArrayKey $remoteArrayManager.StorageArrays[0].StorageArrayKey</pre><p>Besides the ArrayManagerId you have to specify the StorageArrayKey and the PeerStorageArrayKey parameter. The available storage array keys can be found in the StorageArrays property of the local and the remote array managers.</p>
<p>Use the Invoke-SrmCreateReplicatedArrayPair cmdlet to create the replicated array pair:</p><pre class="crayon-plain-tag">$task = Invoke-SrmCreateReplicatedArrayPair -PairingId $srmConnection.ConnectedPairing.PairingId `
&nbsp;&nbsp; -SrmId $srmConnection.ConnectedPairing.LocalSrmServer.Id `
&nbsp;&nbsp; -ReplicatedArrayPairSpec $replicatedArrayPairSpec</pre><p>Wait for the task to complete and retrieve the replicated array pair. The Result property of the task will contain the Id of the replicated array pair, once the task completes:</p><pre class="crayon-plain-tag">$replicatedArrayPairTask = Invoke-SrmGetTaskInfo -TaskId $task.Id

$replicatedArrayPair = Invoke-SrmGetReplicatedArrayPair -PairingId $srmConnection.ConnectedPairing.PairingId `
&nbsp;&nbsp; -SrmId $srmConnection.ConnectedPairing.LocalSrmServer.Id `
&nbsp;&nbsp; -ArrayPairId $replicatedArrayPairTask.Result</pre><p></p>
<h2>Create Protected Group and Recovery Plan for the Replicated Array Pair</h2>
<p>Use the Invoke-SrmDiscoverStorageDevices cmdlet to discover the storage devices of the replicated array pair. Wait for the task to complete before proceeding to the next step:</p><pre class="crayon-plain-tag">$task = Invoke-SrmDiscoverStorageDevices -PairingId $srmConnection.ConnectedPairing.PairingId `
&nbsp;&nbsp; -SrmId $srmConnection.ConnectedPairing.LocalSrmServer.Id `
&nbsp;&nbsp; -ArrayPairId $replicatedArrayPair.Id

Invoke-SrmGetTaskInfo -TaskId $task.Id</pre><p>Retrieve the storage devices from the replicated array pair:</p><pre class="crayon-plain-tag">$storageDevices = Invoke-SrmGetStorageDevices -PairingId $srmConnection.ConnectedPairing.PairingId `
&nbsp;&nbsp; -SrmId $srmConnection.ConnectedPairing.LocalSrmServer.Id `
&nbsp;&nbsp; -ArrayPairId $replicatedArrayPair.Id</pre><p>Initialize an AbrProtectionGroupSpec object. In our setup we created replicated array pair with single storage device, containing one datastore. We will create protection group for this datastore:</p><pre class="crayon-plain-tag">$abrProtectionGroupSpec = Initialize-SrmAbrProtectionGroupSpec `
   -ReplicatedArrayPair $replicatedArrayPair.Id `
   -Datastores $storageDevices.StorageDevicesData[0].Datastores[0].Id</pre><p>Then initialize ProtectionGroupCreateSpec object. For the ReplicationType parameter specify ABR:</p><pre class="crayon-plain-tag">$protectionGroupSpec = Initialize-SrmProtectionGroupCreateSpec -Name &quot;MyAbrProtectionGroup&quot; `
&nbsp;&nbsp; -ReplicationType ABR `
&nbsp;&nbsp; -ProtectedVcGuid $srmConnection.ConnectedPairing.LocalVcServer.Id `
&nbsp;&nbsp; -AbrSpec $abrProtectionGroupSpec</pre><p>Use Invoke-SrmCreateGroup to create the ABR protection group. Wait for the task to complete and retrieve the protection group:</p><pre class="crayon-plain-tag">$task = Invoke-SrmCreateGroup -PairingId $srmConnection.ConnectedPairing.PairingId `
&nbsp;&nbsp; -ProtectionGroupCreateSpec $protectionGroupSpec

$task = Invoke-SrmGetTaskInfo -TaskId $task.Id

$protectionGroup = Invoke-SrmGetGroup -PairingId $srmConnection.ConnectedPairing.PairingId `
   -GroupId $task.Result</pre><p>Finally, you can create recovery plan for the protection group, we have just crated. To do this, Initialize RecoveryPlanCreateSpec object:</p><pre class="crayon-plain-tag">$recPlanSpec = Initialize-SrmRecoveryPlanCreateSpec `
&nbsp;&nbsp; -Name &quot;AbrRecoveryPlan&quot; `
&nbsp;&nbsp; -ProtectedVcGuid $srmConnection.ConnectedPairing.LocalVcServer.Id `
&nbsp;&nbsp; -ProtectionGroups @($protectionGroup.Id)</pre><p>Create recovery plan with the Invoke-SrmCreatePlan cmdlet and wait for the task to complete:</p><pre class="crayon-plain-tag">$task = Invoke-SrmCreatePlan -PairingId $srmConnection.ConnectedPairing.PairingId ` &nbsp;
   -RecoveryPlanCreateSpec $recPlanSpec

Invoke-SrmGetTaskInfo -TaskId $task.Id</pre><p></p>
<h2>Disconnect the SRM server connection</h2>
<p>After you have finished interacting with the SRM server, close the connection, using the Disconnect-SrmSdkServer cmdlet.</p><pre class="crayon-plain-tag">Disconnect-SrmSdkServer &quot;MySrmAddress.com&quot;</pre><p></p>
<h2>Conclusion</h2>
<p>VMware.Sdk.Srm PowerCLI module enables the access to the Site Recovery Manager Rest API through PowerShell cmdlets. In this article we covered the end to end scenario of configuring array based replication and creation of protection group and recovery plan, based on this replication flavor. If you&#8217;re interested in using host based replication, refer to the &#8220;<a href="https://blogs.vmware.com/PowerCLI/2023/06/managing-srm-and-vr-with-powercli-13-1.html">Managing SRM and VR with PowerCLI 13.1</a>&#8221; blog post.</p><p>The post <a href="https://blogs.vmware.com/PowerCLI/2023/06/array-based-replication-with-powercli-13-1.html">Array Based Replication with PowerCLI 13.1</a> appeared first on <a href="https://blogs.vmware.com/PowerCLI">VMware PowerCLI Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Managing SRM and VR with PowerCLI 13.1</title>
		<link>https://blogs.vmware.com/PowerCLI/2023/06/managing-srm-and-vr-with-powercli-13-1.html</link>
		
		<dc:creator><![CDATA[Pavel Dimitrov]]></dc:creator>
		<pubDate>Tue, 06 Jun 2023 08:22:55 +0000</pubDate>
				<category><![CDATA[Advanced]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[Host Based Replication]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[VMware Site Recovery Manager]]></category>
		<category><![CDATA[vSphere Replication]]></category>
		<guid isPermaLink="false">https://blogs.vmware.com/PowerCLI/?p=4408</guid>

					<description><![CDATA[<div><img width="300" height="166" src="https://blogs.vmware.com/PowerCLI/files/2023/06/srmlogo2-300x166.png" class="attachment-medium size-medium wp-post-image" alt="" decoding="async" loading="lazy" style="margin-bottom: 10px;" srcset="https://blogs.vmware.com/PowerCLI/files/2023/06/srmlogo2-300x166.png 300w, https://blogs.vmware.com/PowerCLI/files/2023/06/srmlogo2-1024x566.png 1024w, https://blogs.vmware.com/PowerCLI/files/2023/06/srmlogo2-768x424.png 768w, https://blogs.vmware.com/PowerCLI/files/2023/06/srmlogo2-1536x848.png 1536w, https://blogs.vmware.com/PowerCLI/files/2023/06/srmlogo2-600x331.png 600w, https://blogs.vmware.com/PowerCLI/files/2023/06/srmlogo2.png 1805w" sizes="(max-width: 300px) 100vw, 300px" /></div>
<p>PowerCLI 13.1 introduces two new auto generated modules that provide PowerShelI bindings for the vSphere Replication REST API and the Site Recovery Manager REST API. We will cover connection management for both modules &#8211; host based replication with vSphere Replication and creation of protection groups and recovery plans with Site Recovery Manager. Note: VMware.Sdk.Vr and VMware.Sdk.Srm &#8230; <a href="https://blogs.vmware.com/PowerCLI/2023/06/managing-srm-and-vr-with-powercli-13-1.html">Continued</a></p>
<p>The post <a href="https://blogs.vmware.com/PowerCLI/2023/06/managing-srm-and-vr-with-powercli-13-1.html">Managing SRM and VR with PowerCLI 13.1</a> appeared first on <a href="https://blogs.vmware.com/PowerCLI">VMware PowerCLI Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div><img width="300" height="166" src="https://blogs.vmware.com/PowerCLI/files/2023/06/srmlogo2-300x166.png" class="attachment-medium size-medium wp-post-image" alt="" decoding="async" loading="lazy" style="margin-bottom: 10px;" srcset="https://blogs.vmware.com/PowerCLI/files/2023/06/srmlogo2-300x166.png 300w, https://blogs.vmware.com/PowerCLI/files/2023/06/srmlogo2-1024x566.png 1024w, https://blogs.vmware.com/PowerCLI/files/2023/06/srmlogo2-768x424.png 768w, https://blogs.vmware.com/PowerCLI/files/2023/06/srmlogo2-1536x848.png 1536w, https://blogs.vmware.com/PowerCLI/files/2023/06/srmlogo2-600x331.png 600w, https://blogs.vmware.com/PowerCLI/files/2023/06/srmlogo2.png 1805w" sizes="(max-width: 300px) 100vw, 300px" /></div><p>PowerCLI 13.1 introduces two new auto generated modules that provide PowerShelI bindings for the vSphere Replication REST API and the Site Recovery Manager REST API. We will cover connection management for both modules &#8211; host based replication with vSphere Replication and creation of protection groups and recovery plans with Site Recovery Manager.</p>
<p>Note: VMware.Sdk.Vr and VMware.Sdk.Srm modules are compatible with vSphere Replication and Site Recovery Manager 8.7 and above.</p>
<h2>Connecting vSphere Replication server with Connect-VrServer</h2>
<p>To connect to a vSphere Replication management server you must use the Connect-VrServer cmdlet. Replications can be configured within a single vCenter Server, or between local and remote vCenter Server instances.</p>
<p>When configuring replication within the same VC you can connect only to the local vSphere Replication site. For Server parameter specify the vSphere Replication server address. For User and Password parameters specify the user name and the password for the vCenter Server instance where the vSphere Replication appliance is deployed:</p><pre class="crayon-plain-tag">$vrConnection = Connect-VrServer -Server &quot;MyVrAddress.com&quot; 
   -User &quot;administrator@vsphere.local&quot; `
   -Password &quot;MyLocalVCenterServerPassword&quot;</pre><p>Let&#8217;s take a moment and look at the VrServerConnection object, returned from the Connect-VrServer cmdlet. It contains ConnectedPairings property:</p>
<p><a href="https://blogs.vmware.com/PowerCLI/files/2023/05/ConnectedPairingsSingle-1.jpg"><img decoding="async" loading="lazy" class="alignnone wp-image-4483" src="https://blogs.vmware.com/PowerCLI/files/2023/05/ConnectedPairingsSingle-1-300x38.jpg" alt="" width="624" height="79" srcset="https://blogs.vmware.com/PowerCLI/files/2023/05/ConnectedPairingsSingle-1-300x38.jpg 300w, https://blogs.vmware.com/PowerCLI/files/2023/05/ConnectedPairingsSingle-1-768x97.jpg 768w, https://blogs.vmware.com/PowerCLI/files/2023/05/ConnectedPairingsSingle-1-600x76.jpg 600w, https://blogs.vmware.com/PowerCLI/files/2023/05/ConnectedPairingsSingle-1.jpg 894w" sizes="(max-width: 624px) 100vw, 624px" /></a></p>
<p>This property is a Dictionary, where all connected Pairings are stored. The Pairing is the VR API representation of the paired local and the remote sites. As we just authenticated only against the local VR site, the Dictionary contains only one entry. This is the local vCenter self-pair.</p>
<p>You can index this dictionary, by the vCenter name, and obtain certain Pairing object. You will need this Pairing object to invoke various operations from the VR API:</p>
<p><a href="https://blogs.vmware.com/PowerCLI/files/2023/05/Pairing-1.jpg"><img decoding="async" loading="lazy" class="alignnone wp-image-4488" src="https://blogs.vmware.com/PowerCLI/files/2023/05/Pairing-1-300x65.jpg" alt="" width="623" height="135" srcset="https://blogs.vmware.com/PowerCLI/files/2023/05/Pairing-1-300x65.jpg 300w, https://blogs.vmware.com/PowerCLI/files/2023/05/Pairing-1-768x168.jpg 768w, https://blogs.vmware.com/PowerCLI/files/2023/05/Pairing-1-600x131.jpg 600w, https://blogs.vmware.com/PowerCLI/files/2023/05/Pairing-1.jpg 917w" sizes="(max-width: 623px) 100vw, 623px" /></a></p>
<p>To authenticate against a remote vCenter Server, you will use another parameter set of the Connect-VrServer cmdlet. (Note that you must have a site pairing configured between the local and the remote vSphere Replication sites.). This time, for LocalServer parameter specify the already available VrServerConnection object. For RemoteServer parameter specify the name of the remote VC. For RemoteUser and RemotePassword parameters specify the user name and the password of the remote VC. Note that with VR we can have multiple remote sites configured:</p><pre class="crayon-plain-tag">$remoteVc = &quot;myRemoteVcName&quot;
$vrConnection = Connect-VrServer -LocalServer $vrConnection `
&nbsp;&nbsp;&nbsp; -RemoteServer $remoteVc `
&nbsp;&nbsp;&nbsp; -RemoteUser &quot;administrator@vsphere.local&quot; `
&nbsp;&nbsp;&nbsp; -RemotePassword &quot;MyRemoteVCenterServerPassword&quot;</pre><p>Now, if you check the ConnectedPairings property of the VrServerConnection object, you will see that the dictionary contains second pairing, allowing you to invoke API operations on the remote site:</p>
<h2><a href="https://blogs.vmware.com/PowerCLI/files/2023/05/ConnectedPairingsRemote-1.jpg"><img decoding="async" loading="lazy" class="alignnone wp-image-4487" src="https://blogs.vmware.com/PowerCLI/files/2023/05/ConnectedPairingsRemote-1-300x48.jpg" alt="" width="624" height="100" srcset="https://blogs.vmware.com/PowerCLI/files/2023/05/ConnectedPairingsRemote-1-300x48.jpg 300w, https://blogs.vmware.com/PowerCLI/files/2023/05/ConnectedPairingsRemote-1-768x123.jpg 768w, https://blogs.vmware.com/PowerCLI/files/2023/05/ConnectedPairingsRemote-1-600x96.jpg 600w, https://blogs.vmware.com/PowerCLI/files/2023/05/ConnectedPairingsRemote-1.jpg 909w" sizes="(max-width: 624px) 100vw, 624px" /></a></h2>
<p>Alternatively you can authenticate against the local and the remote sites with a single Connect-VrServer call:</p><pre class="crayon-plain-tag">$remoteVc = &quot;myRemoteVcName&quot;
$vrConnection = Connect-VrServer -Server $localVr `
   -User &quot;administrator@vsphere.local&quot; `
   -Password &quot;MyLocalVCenterServerPassword&quot; `
   -RemoteServer $remoteVc `
   -RemoteUser &quot;administrator@vsphere.local&quot; `
   -RemotePassword &quot;MyRemoteVCenterServerPassword&quot;</pre><p></p>
<h2>Configuring host based replication</h2>
<p>For convenience, let&#8217;s store the remote site pairing that we will use for the replication in a variable:</p><pre class="crayon-plain-tag">$remotePairing = $vrConnection.ConnectedPairings[$remoteVc].Pairing</pre><p></p>
<h3>Retrieve the replicated VM</h3>
<p>To start, you must retrieve the VM, which you want to replicate. Use the Invoke-VrGetLocalVms cmdlet, which requires PairingId and VcenterId parameters to be specified. We have these IDs with the Pairing object we stored in the $remotePairing variable:</p><pre class="crayon-plain-tag">$replicatedVm = Invoke-VrGetLocalVms -PairingId $remotePairing.PairingId `
&nbsp;&nbsp; -VcenterId $remotePairing.LocalVcServer.Id `
&nbsp;&nbsp; -FilterProperty 'Name' `
 &nbsp; -Filter &quot;VrSrmDemo&quot;</pre><p>You can also apply filter to this call. FilterProperty parameter specifies the VM property that will be used for the search. In this case this is the Name property. The Filter parameter specifies the property value, you are looking for. The result of this call is a VirtualMachineDrResponseList object, which contains list of VMs that match the specified filter. In our case this will be a list with one VM:</p>
<p><a href="https://blogs.vmware.com/PowerCLI/files/2023/05/localVM.jpg"><img decoding="async" loading="lazy" class="alignnone wp-image-4455" src="https://blogs.vmware.com/PowerCLI/files/2023/05/localVM-300x77.jpg" alt="" width="623" height="160" srcset="https://blogs.vmware.com/PowerCLI/files/2023/05/localVM-300x77.jpg 300w, https://blogs.vmware.com/PowerCLI/files/2023/05/localVM-768x196.jpg 768w, https://blogs.vmware.com/PowerCLI/files/2023/05/localVM-600x153.jpg 600w, https://blogs.vmware.com/PowerCLI/files/2023/05/localVM.jpg 951w" sizes="(max-width: 623px) 100vw, 623px" /></a></p>
<h3>Configure VM&#8217;s HDDs for the replication</h3>
<p>When configuring host based replication, you have to specify the VM&#8217;s hard disks that will be replicated. For each replicated disk you have to specify a datastore on the target VC. In this example we will replicate all the hard disks of our VM on one target datastore on the remote VC:<br />
Retrieve the target datastore on the remote VC, using the Invoke-VrGetVrCapableTargetDatastores cmdlet:</p><pre class="crayon-plain-tag">$targetDatastore = Invoke-VrGetVrCapableTargetDatastores -PairingId $remotePairing.PairingId `
   -VcenterId $remotePairing.RemoteVcServer.Id `
   -FilterProperty &quot;Name&quot; `
   -Filter &quot;MyRemoteDS&quot;</pre><p>Here for VcenterId, specify the remote VC Id. Specify FilterProperty and Filter parameters to choose the target datastore by name.</p>
<p>Hard disks are available in the Disks property of our VirtualMachine object, stored in the $replicatedVm variable. Iterate over the Disks list and initialize ConfigureReplicationVmDisk objects for each hard disk. Store these configurations in $replicationVmDisks array variable:</p><pre class="crayon-plain-tag">$replicationVmDisks = @()
$replicatedVm.List[0].Disks | ForEach-Object {
&nbsp;&nbsp; $replicationVmDisks += Initialize-VrConfigureReplicationVmDisk -VmDisk $_ `
&nbsp;&nbsp;&nbsp; &nbsp; -EnabledForReplication:$true `
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -DestinationDatastoreId $targetDatastore.List[0].Id `
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -DestinationDiskFormat 'SAMEASSOURCE'
}</pre><p></p>
<h3>Configure Host Based Replication</h3>
<p>First you have to initialize ConfigureReplicationSpec object. Besides various replication settings, we have to specify the disk replication configuration, stored in the $replicationVmDisks variable to the Disk parameter. You also have to specify the target VC Id and the Id of the replicated VM.</p><pre class="crayon-plain-tag">$replicationSpec = Initialize-VrConfigureReplicationSpec `
   -Rpo 60 `
   -NetworkCompressionEnabled:$true `
   -MpitEnabled:$true `
   -AutoReplicateNewDisks:$true `
   -LwdEncryptionEnabled:$false `
   -MpitInstances 1 `
   -MpitDays 1 `
   -Disks $replicationVmDisks `
   -TargetVcId $remotePairing.RemoteVcServer.Id `
   -VmId $replicatedVm.List[0].Id</pre><p>Then use the Invoke-VrConfigureReplication cmdlet to configure the replication. For parameters, specify the PairingId and the ConfigureReplicationSpec object:</p><pre class="crayon-plain-tag">$task = Invoke-VrConfigureReplication -PairingId $remotePairing.PairingId `
   -ConfigureReplicationSpec $replicationSpec</pre><p>The result of the operation is a TaskDrResponseList object, which in our example contains list of one task. If you want, you can specify array of ConfigureReplicationSpec objects, and replicate multiple VMs with single call.</p>
<p>To wait until the replication configuration task completes, retrieve the task until its Status property equals to something different from &#8216;RUNNING&#8217;:</p><pre class="crayon-plain-tag">Invoke-VrGetTaskInfo -TaskId $task.List[0].Id</pre><p><a href="https://blogs.vmware.com/PowerCLI/files/2023/05/configureReplicationTask.jpg"><img decoding="async" loading="lazy" class="alignnone wp-image-4462" src="https://blogs.vmware.com/PowerCLI/files/2023/05/configureReplicationTask-300x116.jpg" alt="" width="605" height="234" srcset="https://blogs.vmware.com/PowerCLI/files/2023/05/configureReplicationTask-300x116.jpg 300w, https://blogs.vmware.com/PowerCLI/files/2023/05/configureReplicationTask-768x296.jpg 768w, https://blogs.vmware.com/PowerCLI/files/2023/05/configureReplicationTask-600x231.jpg 600w, https://blogs.vmware.com/PowerCLI/files/2023/05/configureReplicationTask.jpg 903w" sizes="(max-width: 605px) 100vw, 605px" /></a></p>
<p>In the next chapter we will use cmdlets from the VMware.Sdk.Srm module to create protection group and recovery plan for the replication that we just created.</p>
<h2>Connecting Site Recovery Manager with Connect-SrmSdkServer</h2>
<p>To connect Site Recover Manager server use the Connect-SrmSdkServer cmdlet. Do not use the old Connect-SrmServer cmdlet, already available in the VMware.VimAutomation.Srm module, as it&#8217;s not compatible with the VMware.Sdk.Srm module cmdlets.</p>
<p>Site Recover Manager supports only one pairing between local and remote SRM sites. You can connect either only to the local site, or you can authenticate with the remote site vCenter server site in the same call. Since we will further create protection group and recovery plan we will choose the second option. Note that you must have a site pairing configured between the local and the remote SRM sites.</p><pre class="crayon-plain-tag">$srmConnection = Connect-SrmSdkServer -Server &quot;MySrmAddress.com&quot; `
&nbsp;&nbsp; -User &quot;administrator@vsphere.local&quot; `
&nbsp;&nbsp; -Password &quot;MyLocalVcPassword&quot; `
&nbsp;&nbsp; -RemoteUser &quot;administrator@vsphere.local&quot; `
&nbsp;&nbsp; -RemotePassword &quot;MyRemoteVcPassword&quot;</pre><p>If we look at the SrmServerConnection object, returned from the Connect-SrmSdkServer cmdlet, we will see that it contains property named ConnectedPairing. In this case this is a single Pairing object that represents the pair between the local and the remote SRM sites. You will need this Pairing object for invoking various operations from the SRM API:</p>
<p><a href="https://blogs.vmware.com/PowerCLI/files/2023/05/PairingSrm.jpg"><img decoding="async" loading="lazy" class="alignnone wp-image-4469" src="https://blogs.vmware.com/PowerCLI/files/2023/05/PairingSrm-300x68.jpg" alt="" width="622" height="141" srcset="https://blogs.vmware.com/PowerCLI/files/2023/05/PairingSrm-300x68.jpg 300w, https://blogs.vmware.com/PowerCLI/files/2023/05/PairingSrm-768x174.jpg 768w, https://blogs.vmware.com/PowerCLI/files/2023/05/PairingSrm-600x136.jpg 600w, https://blogs.vmware.com/PowerCLI/files/2023/05/PairingSrm.jpg 785w" sizes="(max-width: 622px) 100vw, 622px" /></a></p>
<h2>Creating protection group and recovery plan for host based replication</h2>
<p>In this chapter we will use the host based replication that we configured earlier. First we will initialize HbrProtectionGroupSpec with the VM that we already replicated:</p>
<p>$hbrSpec = Initialize-SrmHbrProtectionGroupSpec -Vms $replicatedVm.List[0].Id</p>
<p>In this example we reuse the VM Id, we have stored in the $replicatedVm variable, as it&#8217;s consistent between the VR and SRM APIs. If you need to retrive the replicated VM with the VMware.Sdk.Srm module, use the Invoke-SrmGetReplicatedVms cmdlet:</p><pre class="crayon-plain-tag">$replicatedVm = Invoke-SrmGetReplicatedVms `
   -PairingId $srmConnection.ConnectedPairing.PairingId `
   -VcenterId $srmConnection.ConnectedPairing.LocalVcServer.Id `
   -FilterProperty &quot;Name&quot; `
   -Filter &quot;VrSrmDemo&quot;</pre><p>Use the HbrProtectionGroupSpec object to initialize SrmProtectionGroupCreateSpec. For the ReplicationType parameter specify HBR:</p><pre class="crayon-plain-tag">$protectionGroupSpec = Initialize-SrmProtectionGroupCreateSpec -Name &quot;SrmDemoGroup&quot; `
&nbsp;&nbsp; -ReplicationType HBR `
&nbsp;&nbsp; -ProtectedVcGuid $srmConnection.ConnectedPairing.LocalVcServer.Id `
&nbsp;&nbsp; -HbrSpec $hbrSpec</pre><p>Create protection group with the Invoke-SrmCreateGroup cmdlet:</p><pre class="crayon-plain-tag">$task = Invoke-SrmCreateGroup -PairingId $srmConnection.ConnectedPairing.PairingId `
   -ProtectionGroupCreateSpec $protectionGroupSpec</pre><p>Wait for the SRM task to complete:</p><pre class="crayon-plain-tag">$task = Invoke-SrmGetTaskInfo -TaskId $task.Id</pre><p>When $task.Status is equal to &#8216;SUCCESS&#8217;, retrieve the protection group, using the $task.Result property, which contains the ID of the created group:</p><pre class="crayon-plain-tag">$protectionGroup = Invoke-SrmGetGroup -PairingId $srmConnection.ConnectedPairing.PairingId `
   -GroupId $task.Result</pre><p>To conclude this example we will create a recovery plan for the protection group. For that purpose first Initialize RecoveryPlanCreateSpec, required by the Invoke-SrmCreatePlan cmdlet:</p><pre class="crayon-plain-tag">$recPlanSpec = Initialize-SrmRecoveryPlanCreateSpec `
&nbsp;&nbsp; -Name &quot;SrmDemoRecoveryPlan&quot; `
&nbsp;&nbsp; -ProtectedVcGuid $srmConnection.ConnectedPairing.LocalVcServer.Id `
&nbsp;&nbsp; -ProtectionGroups $protectionGroup.Id</pre><p>Then create the recovery plan with the RecoveryPlanCreateSpec object and wait for the task to complere, using the Invoke-SrmCreatePlan:</p><pre class="crayon-plain-tag">$task = Invoke-SrmCreatePlan -PairingId $srmConnection.ConnectedPairing.PairingId `
&nbsp; -RecoveryPlanCreateSpec $recPlanSpec
Invoke-SrmGetTaskInfo -TaskId $task.Id</pre><p></p>
<h2>Disconnect SRM and VR server connections</h2>
<p>After you have finished interacting with the SRM server, close the connection, using the Disconnect-SrmSdkServer cmdlet:</p><pre class="crayon-plain-tag">Disconnect-SrmSdkServer &quot;MySrmAddress.com&quot;</pre><p>To close the VR server connection use the Disconnect-VrServer cmdlet:</p><pre class="crayon-plain-tag">Disconnect-VrServer &quot;MyVrAddress.com&quot;</pre><p></p>
<h2>Conclusion</h2>
<p>You can combine the VMware.Sdk.Vr and the VMware.Sdk.Srm PowerCLI modules to automate the end to end scenario of creating host based replication, and utilizing it with protection group and recovery plan. If you want to automate array based replication, available with the VMware.Sdk.Srm module, refer to the &#8220;<a href="https://blogs.vmware.com/PowerCLI/2023/06/array-based-replication-with-powercli-13-1.html">Array Based Replication with PowerCLI 13.1</a>&#8221; blog post. Also, you can check out &#8220;<a href="https://blogs.vmware.com/code/2023/05/25/vsphere-replication-rest-api-with-powershell-configure-vm-replication/">vSphere Replication REST API with PowerShell: Configure VM replication</a>&#8220;.</p><p>The post <a href="https://blogs.vmware.com/PowerCLI/2023/06/managing-srm-and-vr-with-powercli-13-1.html">Managing SRM and VR with PowerCLI 13.1</a> appeared first on <a href="https://blogs.vmware.com/PowerCLI">VMware PowerCLI Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>PowerCLI 13.1 is now released</title>
		<link>https://blogs.vmware.com/PowerCLI/2023/04/powercli-13-1-is-now-released.html</link>
		
		<dc:creator><![CDATA[Kamen Nikolov]]></dc:creator>
		<pubDate>Wed, 19 Apr 2023 12:33:39 +0000</pubDate>
				<category><![CDATA[Release]]></category>
		<guid isPermaLink="false">https://blogs.vmware.com/PowerCLI/?p=4394</guid>

					<description><![CDATA[<div><img width="300" height="168" src="https://blogs.vmware.com/PowerCLI/files/2022/07/vmw-ico-powercli-vmc-rgb_400px-1-300x168.jpg" class="attachment-medium size-medium wp-post-image" alt="" decoding="async" loading="lazy" style="margin-bottom: 10px;" srcset="https://blogs.vmware.com/PowerCLI/files/2022/07/vmw-ico-powercli-vmc-rgb_400px-1-300x168.jpg 300w, https://blogs.vmware.com/PowerCLI/files/2022/07/vmw-ico-powercli-vmc-rgb_400px-1-576x324.jpg 576w, https://blogs.vmware.com/PowerCLI/files/2022/07/vmw-ico-powercli-vmc-rgb_400px-1-600x335.jpg 600w, https://blogs.vmware.com/PowerCLI/files/2022/07/vmw-ico-powercli-vmc-rgb_400px-1.jpg 743w" sizes="(max-width: 300px) 100vw, 300px" /></div>
<p>After the exciting first release of Power Actions last week, this week brings another new release &#8211; PowerCLI 13.1. With this release, we&#8217;re delivering one of the most requested PowerCLI features &#8211; a PowerCLI module for vSphere Replication. It is built on the same technology that we used to deliver the auto-generated modules for the &#8230; <a href="https://blogs.vmware.com/PowerCLI/2023/04/powercli-13-1-is-now-released.html">Continued</a></p>
<p>The post <a href="https://blogs.vmware.com/PowerCLI/2023/04/powercli-13-1-is-now-released.html">PowerCLI 13.1 is now released</a> appeared first on <a href="https://blogs.vmware.com/PowerCLI">VMware PowerCLI Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div><img width="300" height="168" src="https://blogs.vmware.com/PowerCLI/files/2022/07/vmw-ico-powercli-vmc-rgb_400px-1-300x168.jpg" class="attachment-medium size-medium wp-post-image" alt="" decoding="async" loading="lazy" style="margin-bottom: 10px;" srcset="https://blogs.vmware.com/PowerCLI/files/2022/07/vmw-ico-powercli-vmc-rgb_400px-1-300x168.jpg 300w, https://blogs.vmware.com/PowerCLI/files/2022/07/vmw-ico-powercli-vmc-rgb_400px-1-576x324.jpg 576w, https://blogs.vmware.com/PowerCLI/files/2022/07/vmw-ico-powercli-vmc-rgb_400px-1-600x335.jpg 600w, https://blogs.vmware.com/PowerCLI/files/2022/07/vmw-ico-powercli-vmc-rgb_400px-1.jpg 743w" sizes="(max-width: 300px) 100vw, 300px" /></div><p>After the exciting <a href="https://blogs.vmware.com/PowerCLI/2023/04/new-release-power-actions-1-0.html">first release of Power Actions</a> last week, this week brings another new release &#8211; PowerCLI 13.1.</p>
<p>With this release, we&#8217;re delivering one of the most requested PowerCLI features &#8211; a PowerCLI module for vSphere Replication. It is built on the same technology that we used to deliver the auto-generated modules for the NSX and vSphere REST APIs and provides full coverage of the new vSphere Replication REST API.</p>
<p>Here are some of the other exciting features of this PowerCLI release:</p>
<ul>
<li>New auto-generated module for the new SRM REST API</li>
<li>Added support for vLCM host configuration and offline depots</li>
<li>New vSAN cmdlets for vSAN direct disk and remote datastore management</li>
<li>New cmdlets for vSAN cluster shutdown</li>
<li>Updated NSX and Horizon modules</li>
<li>Extended Python version support for the ImageBuilder module</li>
</ul>
<p>Let&#8217;s take a closer look at some of these new features.</p>
<h3>New SDK modules for SRM and vSphere Replication</h3>
<p>With the 8.6 release of SRM and vSphere Replication, these two products received new REST APIs. In fact, it was the first public API released for vSphere Replication. This gave us the opportunity to automatically generate PowerCLI modules for these products as we had already done for NSX and vSphere. As with vSphere you will be able to find the PowerCLI examples directly in the vSphere Replication and SRM REST API documentation. We&#8217;re also working on a dedicated blog post to demonstrate how to use those modules to perform some common use cases.</p>
<p><strong>vLCM improvements</strong></p>
<p>In PowerCLI 13.1 we&#8217;re adding new parameters to the <code>Set-VMHost</code> cmdlet to allow you to set the ESXi host LCM configuraiton in the same way that you set the cluster LCM configuration. This is a new feature, supported only in vSphere 8.0 Update 1. We&#8217;re also introducing cmdlets for the creation of new LCM offline depots with PowerCLI.</p>
<p><strong>New vSAN cmdlets</strong></p>
<p>PowerCLI 13.1 comes with a lot of new vSAN functionality. New cmdlets are introduced for vSAN remote datastore management, direct disk management, and vSAN cluster shutdown.</p>
<h3>VMware Cloud Director changes</h3>
<p>For VMware Cloud Director, we changed the authentication mechanism of Connect-CIServer and it now authenticates against the new vCD API authentication endpoint. This will allow the cmdlet to continue working without issues with the future vCD versions. We also updated the Import-CIVappTemplate cmdlet to work with the latest APIs. Because of this we made some cmdlet interface changes, which might lead to the need of reworking some of your Cloud Director scripts.</p>
<h3>ImageBuilder module Python version support</h3>
<p>With PowerCLI 13.0 we ported the ImageBuilder and AutoDeploy modules to work on Linux and MacOS. That required users to have Python installed as a pre-requisite for those modules. In 13.0, these modules only supported Python version 3.7.x, which was quite limiting. With PowerCLI 13.1, we have fixed that and the ImageBuilder module now works with Python 3.7.1 and all later versions.</p>
<p><strong>Conclusion</strong></p>
<p>PowerCLI 13.1 is another release that brings a rich set of new features to our customers. It delivers one of the most requested PowerCLI functionalities, vSphere replication module, as well as new SRM module, new vSAN cmdlets, extended support for vLCM, and much more. For a full list of all improvements and fixes, check the <a href="https://developer.vmware.com/docs/18508/">PowerCLI 13.1 Release Notes</a>. For more information on specific cmdlets, see the <a href="https://developer.vmware.com/docs/powercli/latest/products/" target="_blank" rel="noopener">PowerCLI Cmdlet Reference</a>.</p>
<p>&nbsp;</p><p>The post <a href="https://blogs.vmware.com/PowerCLI/2023/04/powercli-13-1-is-now-released.html">PowerCLI 13.1 is now released</a> appeared first on <a href="https://blogs.vmware.com/PowerCLI">VMware PowerCLI Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>New Release &#8211; Power Actions 1.0</title>
		<link>https://blogs.vmware.com/PowerCLI/2023/04/new-release-power-actions-1-0.html</link>
		
		<dc:creator><![CDATA[Kamen Nikolov]]></dc:creator>
		<pubDate>Sat, 15 Apr 2023 13:35:00 +0000</pubDate>
				<category><![CDATA[Extensions]]></category>
		<category><![CDATA[vCenter]]></category>
		<category><![CDATA[Power Actions]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[vSphere client]]></category>
		<guid isPermaLink="false">https://blogs.vmware.com/PowerCLI/?p=4384</guid>

					<description><![CDATA[<div><img width="300" height="166" src="https://blogs.vmware.com/PowerCLI/files/2023/04/Power-Actions-logo-300x166.png" class="attachment-medium size-medium wp-post-image" alt="" decoding="async" loading="lazy" style="margin-bottom: 10px;" srcset="https://blogs.vmware.com/PowerCLI/files/2023/04/Power-Actions-logo-300x166.png 300w, https://blogs.vmware.com/PowerCLI/files/2023/04/Power-Actions-logo-1024x566.png 1024w, https://blogs.vmware.com/PowerCLI/files/2023/04/Power-Actions-logo-768x424.png 768w, https://blogs.vmware.com/PowerCLI/files/2023/04/Power-Actions-logo-1536x848.png 1536w, https://blogs.vmware.com/PowerCLI/files/2023/04/Power-Actions-logo-600x331.png 600w, https://blogs.vmware.com/PowerCLI/files/2023/04/Power-Actions-logo.png 1805w" sizes="(max-width: 300px) 100vw, 300px" /></div>
<p>We are extremely excited to announce that the first standalone tech preview release of the new Power Actions went live today. Power Actions is a vSphere Client plug-in that provides an easy way to share PowerCLI scripts with users who have no PowerShell experience. Power Actions provides a script library where you can upload PowerCLI &#8230; <a href="https://blogs.vmware.com/PowerCLI/2023/04/new-release-power-actions-1-0.html">Continued</a></p>
<p>The post <a href="https://blogs.vmware.com/PowerCLI/2023/04/new-release-power-actions-1-0.html">New Release &#8211; Power Actions 1.0</a> appeared first on <a href="https://blogs.vmware.com/PowerCLI">VMware PowerCLI Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div><img width="300" height="166" src="https://blogs.vmware.com/PowerCLI/files/2023/04/Power-Actions-logo-300x166.png" class="attachment-medium size-medium wp-post-image" alt="" decoding="async" loading="lazy" style="margin-bottom: 10px;" srcset="https://blogs.vmware.com/PowerCLI/files/2023/04/Power-Actions-logo-300x166.png 300w, https://blogs.vmware.com/PowerCLI/files/2023/04/Power-Actions-logo-1024x566.png 1024w, https://blogs.vmware.com/PowerCLI/files/2023/04/Power-Actions-logo-768x424.png 768w, https://blogs.vmware.com/PowerCLI/files/2023/04/Power-Actions-logo-1536x848.png 1536w, https://blogs.vmware.com/PowerCLI/files/2023/04/Power-Actions-logo-600x331.png 600w, https://blogs.vmware.com/PowerCLI/files/2023/04/Power-Actions-logo.png 1805w" sizes="(max-width: 300px) 100vw, 300px" /></div><p>We are extremely excited to announce that the first standalone tech preview release of the new Power Actions went live today.</p>
<p>Power Actions is a vSphere Client plug-in that provides an easy way to share PowerCLI scripts with users who have no PowerShell experience. Power Actions provides a script library where you can upload PowerCLI scripts that you want to make available to everyone in your organization. Users can then easily execute those scripts using a user-friendly interface to specify the script parameters. This provides an extremely powerful mechanism to extend the vSphere Client with custom PowerCLI scripts.</p>
<p>How about the security and permissions? All the scripts are executed by using the permissions of the user that&#8217;s logged in to the vSphere Client. So, if a user does not have permission to perform certain operations they won&#8217;t be able to perform these operations with Power Actions as well.</p>
<p>Let&#8217;s take a closer look at how to get started with Power Actions:</p>
<h3>Installation</h3>
<p>Power Actions is distributed as a virtual appliance. You can download the OVA file from the <a href="https://via.vmw.com/power-actions">Power Actions page</a>. Also from there, you can download the complete user&#8217;s guide that contains detailed installation instructions. After you install Power Actions you can use it through the Developer Center in the vSphere Client.</p>
<h3>Script library</h3>
<p>The main function of Power Actions is to run scripts from your script library. So the first thing to do is to create a script library and upload your scripts there.</p>
<p>Script libraries are actually content libraries, so any content library can be used as a script library. If you don&#8217;t have a content library at your disposal, you can create a new one by using either PowerCLI or the vSphere Client. The next step is to import your scripts to the script library. You can upload scripts one by one through the vSphere Client, or entire collections of scripts through PowerCLI.</p>
<p><a href="https://blogs.vmware.com/PowerCLI/files/2023/04/script-library.png"><img decoding="async" loading="lazy" class="wp-image-4385 aligncenter" src="https://blogs.vmware.com/PowerCLI/files/2023/04/script-library-300x146.png" alt="Screenshot of the script library" width="822" height="400" srcset="https://blogs.vmware.com/PowerCLI/files/2023/04/script-library-300x146.png 300w, https://blogs.vmware.com/PowerCLI/files/2023/04/script-library-1024x499.png 1024w, https://blogs.vmware.com/PowerCLI/files/2023/04/script-library-768x374.png 768w, https://blogs.vmware.com/PowerCLI/files/2023/04/script-library-1536x749.png 1536w, https://blogs.vmware.com/PowerCLI/files/2023/04/script-library-2048x998.png 2048w, https://blogs.vmware.com/PowerCLI/files/2023/04/script-library-600x292.png 600w" sizes="(max-width: 822px) 100vw, 822px" /></a></p>
<h3>Running scripts</h3>
<p>Once you have uploaded your scripts to the script library, you can start running them. You have two options to run a script &#8211; from the script library directly or through the context menu. In both cases, when you execute a script with parameters, you&#8217;ll be prompted to enter them. However, when you run a script from the context menu, some parameters will be pre-populated.</p>
<p>Let&#8217;s take a closer look at how this works. In our Power Actions script library we have imported a simple PowerCLI script that creates snapshots of a collection of virtual machines. This is what the script looks like:</p><pre class="crayon-plain-tag">param (
    [Parameter(Mandatory=$true)]
    [VMware.VimAutomation.ViCore.Types.V1.Inventory.VirtualMachine[]] $vms, 
    [Parameter(Mandatory=$true)]
    [string] $snapshotName)

foreach ($vm in $vms) {
    New-SnapShot -VM $vm -Name $snapshotName
}</pre><p>When we run this script from the script library, we&#8217;ll get a dialog in which we&#8217;ll have to specify the script parameters.</p>
<p><a href="https://blogs.vmware.com/PowerCLI/files/2023/04/parameters.png"><img decoding="async" loading="lazy" class="wp-image-4387 aligncenter" src="https://blogs.vmware.com/PowerCLI/files/2023/04/parameters-300x147.png" alt="" width="823" height="403" srcset="https://blogs.vmware.com/PowerCLI/files/2023/04/parameters-300x147.png 300w, https://blogs.vmware.com/PowerCLI/files/2023/04/parameters-1024x501.png 1024w, https://blogs.vmware.com/PowerCLI/files/2023/04/parameters-768x375.png 768w, https://blogs.vmware.com/PowerCLI/files/2023/04/parameters-1536x751.png 1536w, https://blogs.vmware.com/PowerCLI/files/2023/04/parameters-2048x1001.png 2048w, https://blogs.vmware.com/PowerCLI/files/2023/04/parameters-600x293.png 600w" sizes="(max-width: 823px) 100vw, 823px" /></a></p>
<p>However, if we want to run the script from the context menu, we can right-click on a VM and select &#8220;Power Actions&#8221; -&gt; &#8220;Run script&#8221;.</p>
<p><a href="https://blogs.vmware.com/PowerCLI/files/2023/04/context-menu.png"><img decoding="async" loading="lazy" class="wp-image-4388 aligncenter" src="https://blogs.vmware.com/PowerCLI/files/2023/04/context-menu-248x300.png" alt="" width="385" height="466" srcset="https://blogs.vmware.com/PowerCLI/files/2023/04/context-menu-248x300.png 248w, https://blogs.vmware.com/PowerCLI/files/2023/04/context-menu-847x1024.png 847w, https://blogs.vmware.com/PowerCLI/files/2023/04/context-menu-768x928.png 768w, https://blogs.vmware.com/PowerCLI/files/2023/04/context-menu-1271x1536.png 1271w, https://blogs.vmware.com/PowerCLI/files/2023/04/context-menu-600x725.png 600w, https://blogs.vmware.com/PowerCLI/files/2023/04/context-menu.png 1552w" sizes="(max-width: 385px) 100vw, 385px" /></a></p>
<p>We&#8217;ll get a dialog to first select the script that we want to run, and then we&#8217;ll have to enter the parameters. In this case, the vms parameter will be pre-populated from the VM we right-clicked on.</p>
<h3><a href="https://blogs.vmware.com/PowerCLI/files/2023/04/prepopulatedparams.png"><img decoding="async" loading="lazy" class="wp-image-4389 aligncenter" src="https://blogs.vmware.com/PowerCLI/files/2023/04/prepopulatedparams-300x154.png" alt="" width="524" height="269" srcset="https://blogs.vmware.com/PowerCLI/files/2023/04/prepopulatedparams-300x154.png 300w, https://blogs.vmware.com/PowerCLI/files/2023/04/prepopulatedparams-1024x526.png 1024w, https://blogs.vmware.com/PowerCLI/files/2023/04/prepopulatedparams-768x394.png 768w, https://blogs.vmware.com/PowerCLI/files/2023/04/prepopulatedparams-1536x788.png 1536w, https://blogs.vmware.com/PowerCLI/files/2023/04/prepopulatedparams-2048x1051.png 2048w, https://blogs.vmware.com/PowerCLI/files/2023/04/prepopulatedparams-600x308.png 600w" sizes="(max-width: 524px) 100vw, 524px" /></a></h3>
<h3>Monitoring script runs and checking the results</h3>
<p>The next screen in Power Actions is &#8216;Script runs&#8217;. There you can monitor your script runs and check their result. From this page you can also stop a running script.</p>
<h3>Console</h3>
<p>Another feature Power Actions provides is a built-in PowerShell console with the latest PowerCLI version pre-installed. When you open the console, it automatically connects to the vCenter Server by using the vSphere Client user. You can use the Power Actions console to run single commands or entire scripts. Keep in mind that the console will not be retained when you log out of the vSphere Client, so any files that you save on it will be lost after you log out. Beware that if you switch to another view in the vSphere Client or to another Power Actions screeen, and then return to the console, a new PowerShell session will be created and all in-memory variables from your previous session will be lost.</p>
<p><a href="https://blogs.vmware.com/PowerCLI/files/2023/04/console.png"><img decoding="async" loading="lazy" class="wp-image-4390 aligncenter" src="https://blogs.vmware.com/PowerCLI/files/2023/04/console-300x146.png" alt="" width="842" height="410" srcset="https://blogs.vmware.com/PowerCLI/files/2023/04/console-300x146.png 300w, https://blogs.vmware.com/PowerCLI/files/2023/04/console-1024x498.png 1024w, https://blogs.vmware.com/PowerCLI/files/2023/04/console-768x373.png 768w, https://blogs.vmware.com/PowerCLI/files/2023/04/console-1536x746.png 1536w, https://blogs.vmware.com/PowerCLI/files/2023/04/console-2048x995.png 2048w, https://blogs.vmware.com/PowerCLI/files/2023/04/console-600x292.png 600w" sizes="(max-width: 842px) 100vw, 842px" /></a></p>
<h3>Summary</h3>
<p>Throughout the years, Power Actions underwent multiple transformations and was part of different fling releases of the vSphere Client. Now we&#8217;re starting to develop it again as an independent product and this first tech preview release of the new Power Actions is the first step of the process. We are very excited about the plethora of possibilities that Power Actions brings and we can&#8217;t wait to receive your feedback, use cases, feature requests and ideas. So don&#8217;t hesitate to submit your comments on the <a href="https://via.vmw.com/power-actions">Power Actions site</a>.</p><p>The post <a href="https://blogs.vmware.com/PowerCLI/2023/04/new-release-power-actions-1-0.html">New Release &#8211; Power Actions 1.0</a> appeared first on <a href="https://blogs.vmware.com/PowerCLI">VMware PowerCLI Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Managing VICredentials on PowerShell 7 using VMware.VISecret Module!</title>
		<link>https://blogs.vmware.com/PowerCLI/2023/02/managing-vicredentials-on-powershell-7-using-vmware-visecret-module.html</link>
		
		<dc:creator><![CDATA[Kamen Nikolov]]></dc:creator>
		<pubDate>Wed, 15 Feb 2023 13:28:22 +0000</pubDate>
				<category><![CDATA[General]]></category>
		<category><![CDATA[vCenter]]></category>
		<category><![CDATA[Authentication]]></category>
		<category><![CDATA[Credentials]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[VIServer]]></category>
		<category><![CDATA[vSphere]]></category>
		<guid isPermaLink="false">https://blogs.vmware.com/PowerCLI/?p=4344</guid>

					<description><![CDATA[<div><img width="300" height="169" src="https://blogs.vmware.com/PowerCLI/files/2023/02/Screenshot-2023-02-15-at-6.55.26-PM-1-300x169.png" class="attachment-medium size-medium wp-post-image" alt="" decoding="async" loading="lazy" style="margin-bottom: 10px;" srcset="https://blogs.vmware.com/PowerCLI/files/2023/02/Screenshot-2023-02-15-at-6.55.26-PM-1-300x169.png 300w, https://blogs.vmware.com/PowerCLI/files/2023/02/Screenshot-2023-02-15-at-6.55.26-PM-1-1024x578.png 1024w, https://blogs.vmware.com/PowerCLI/files/2023/02/Screenshot-2023-02-15-at-6.55.26-PM-1-768x433.png 768w, https://blogs.vmware.com/PowerCLI/files/2023/02/Screenshot-2023-02-15-at-6.55.26-PM-1-1536x867.png 1536w, https://blogs.vmware.com/PowerCLI/files/2023/02/Screenshot-2023-02-15-at-6.55.26-PM-1-752x423.png 752w, https://blogs.vmware.com/PowerCLI/files/2023/02/Screenshot-2023-02-15-at-6.55.26-PM-1-576x324.png 576w, https://blogs.vmware.com/PowerCLI/files/2023/02/Screenshot-2023-02-15-at-6.55.26-PM-1-600x339.png 600w, https://blogs.vmware.com/PowerCLI/files/2023/02/Screenshot-2023-02-15-at-6.55.26-PM-1.png 1753w" sizes="(max-width: 300px) 100vw, 300px" /></div>
<p>Many customers use the PowerCLI credential store to avoid hard coding credentials in scripts or saving them unencrypted in files. The credential store uses the Windows data protection API to encrypt the credentials and then saves them in a file. However, this API is only available in Windows and that&#8217;s why the PowerCLI credential store &#8230; <a href="https://blogs.vmware.com/PowerCLI/2023/02/managing-vicredentials-on-powershell-7-using-vmware-visecret-module.html">Continued</a></p>
<p>The post <a href="https://blogs.vmware.com/PowerCLI/2023/02/managing-vicredentials-on-powershell-7-using-vmware-visecret-module.html">Managing VICredentials on PowerShell 7 using VMware.VISecret Module!</a> appeared first on <a href="https://blogs.vmware.com/PowerCLI">VMware PowerCLI Blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div><img width="300" height="169" src="https://blogs.vmware.com/PowerCLI/files/2023/02/Screenshot-2023-02-15-at-6.55.26-PM-1-300x169.png" class="attachment-medium size-medium wp-post-image" alt="" decoding="async" loading="lazy" style="margin-bottom: 10px;" srcset="https://blogs.vmware.com/PowerCLI/files/2023/02/Screenshot-2023-02-15-at-6.55.26-PM-1-300x169.png 300w, https://blogs.vmware.com/PowerCLI/files/2023/02/Screenshot-2023-02-15-at-6.55.26-PM-1-1024x578.png 1024w, https://blogs.vmware.com/PowerCLI/files/2023/02/Screenshot-2023-02-15-at-6.55.26-PM-1-768x433.png 768w, https://blogs.vmware.com/PowerCLI/files/2023/02/Screenshot-2023-02-15-at-6.55.26-PM-1-1536x867.png 1536w, https://blogs.vmware.com/PowerCLI/files/2023/02/Screenshot-2023-02-15-at-6.55.26-PM-1-752x423.png 752w, https://blogs.vmware.com/PowerCLI/files/2023/02/Screenshot-2023-02-15-at-6.55.26-PM-1-576x324.png 576w, https://blogs.vmware.com/PowerCLI/files/2023/02/Screenshot-2023-02-15-at-6.55.26-PM-1-600x339.png 600w, https://blogs.vmware.com/PowerCLI/files/2023/02/Screenshot-2023-02-15-at-6.55.26-PM-1.png 1753w" sizes="(max-width: 300px) 100vw, 300px" /></div><p>Many customers use the PowerCLI credential store to avoid hard coding credentials in scripts or saving them unencrypted in files. The credential store uses the Windows data protection API to encrypt the credentials and then saves them in a file. However, this API is only available in Windows and that&#8217;s why the PowerCLI credential store is not available on the cross-platform PowerShell 7. So what is the alternative for Linux and MacOS users?</p>
<p>Some time ago, Microsoft released two very useful cross-platform modules for managing secrets &#8211; SecretManagement and SecretStore. You can read more details about them in <a href="https://devblogs.microsoft.com/powershell/secretmanagement-and-secretstore-are-generally-available/">this blog post</a>. SecretManagement provides cmdlets that help users manage secrets across different vaults and SecretStore is one vault implementation. These two modules can be used instead of the VICredential store. To illustrate how this can be done, we&#8217;ve built a <a href="https://github.com/vmware/PowerCLI-Example-Scripts/tree/master/Modules/VISecret">sample module</a> with alternative versions of the VICredential store cmdlets using the two Microsoft modules. You can use this module as it is or just as a reference to build your own solution. Let&#8217;s go over the main use cases.</p>
<h2>Secret store configuration and vault registration</h2>
<p>The first step is to register and configure the secret vault. In our sample module, we have added an Initialize-VISecret cmdlet that does this. It registers SecretStore as a default vault and configures it to not prompt for a password when accessing the vault.</p>
<div>
<pre class="crayon-plain-tag">function Initialize-VISecret {
    [CmdletBinding()]
    param(
        [string]$Vault = "VMwareSecretStore"
    )

    process {
         Set-SecretStoreConfiguration -Scope CurrentUser -Authentication None -Interaction None -Confirm:$false 
         Register-SecretVault -Name $Vault -ModuleName Microsoft.PowerShell.SecretStore -DefaultVault
    }
}</pre><br />
<span style="font-size: 1rem;">This is the mode that is closest to the VICredentialStore as user experience, since it will not prompt for password and will still keep the password encrypted. However, it&#8217;s less secure than protecting the vault with a password. In addition, in our sample module we&#8217;re using SecretStore as a vault, but if you prefer a different vault you can modify the Initialize-VISecret to use a vault of your choice.</span></p>
<p>Here are some community vault extensions that are available:</p>
<ul>
<li><a href="https://www.powershellgallery.com/packages/Az.KeyVault" data-linktype="external">Azure KeyVault</a> (Microsoft Owned)</li>
<li><a href="https://www.powershellgallery.com/packages/SecretManagement.KeePass" data-linktype="external">KeePass</a></li>
<li><a href="https://www.powershellgallery.com/packages/SecretManagement.LastPass" data-linktype="external">LastPass</a></li>
<li><a href="https://www.powershellgallery.com/packages/SecretManagement.Hashicorp.Vault.KV" data-linktype="external">Hashicorp Vault</a></li>
<li><a href="https://www.powershellgallery.com/packages/SecretManagement.KeyChain" data-linktype="external">KeyChain</a></li>
<li><a href="https://www.powershellgallery.com/packages/SecretManagement.JustinGrote.CredMan" data-linktype="external">CredMan</a></li>
</ul>
</div>
<h2>Saving, reading and deleting credentials from the vault</h2>
<p>To save credentials to the vault, you should use the <a href="https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.secretmanagement/set-secret?view=ps-modules">Set-Secret</a> cmdlet in the SecretManagement module. The secret in this cmdlet is identified by its name only, but in our case a credential is described by two identifiers &#8211; the user name and the server it&#8217;s intended for. Therefore, in the New-VISecret cmdlet we&#8217;re concatenating &#8220;VISecret&#8221;, the server and user name by using the pipe symbol as a delimiter, and then we&#8217;re using the resulting string as an identifier of the secret. If you want to save credentials for more than one product you could extend the function to replace &#8220;VISecret&#8221; with another product specific string to build the identifier, for example &#8220;VMCSecret&#8221; for VMC. <span style="font-size: 1rem;">You can pass the password as a plain text string or as a secure string. </span></p>
<p><span style="font-size: 1rem;">Similarly, when we read a credential from the vault by using Get-VISecret, it concatenates &#8220;VISecret&#8221;, the server and username to form the identifier. Then it uses the </span><a style="background-color: #ffffff; font-size: 1rem;" href="https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.secretmanagement/get-secret?view=ps-modules">Get-Secret</a><span style="font-size: 1rem;"> to retrieve the password for the corresponding server and username. </span></p>
<p><span style="font-size: 1rem;">You can also delete a credential from the store by using Remove-VISecret, which again builds the identifier, and calls </span><a style="background-color: #ffffff; font-size: 1rem;" href="https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.secretmanagement/remove-secret?view=ps-modules">Remove-Secret</a><span style="font-size: 1rem;"> to delete the secret from the vault. If you&#8217;re using SecretStore as a vault, you can remove all the credentials it stores by calling </span><a style="background-color: #ffffff; font-size: 1rem;" href="https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.secretstore/reset-secretstore?view=ps-modules">Reset-SecretStore</a></p><pre class="crayon-plain-tag">function New-VISecret {
    [CmdletBinding()]
    [Alias("Set-VISecret")]
    param (
        [Parameter(Mandatory=$true)]
        [string]$Server,
        [Parameter(Mandatory=$true)]
        [string]$User,
        [string]$Password,
        [securestring]$SecureStringPassword,
        [string]$Vault
    )
    begin {
        if ([string]::IsNullOrWhiteSpace($password) -and (-not $secureStringPassword)) {
            Throw "Either Password or SecureStringPassword parameter needs to be specified"
        }
        if (-not [string]::IsNullOrWhiteSpace($password) -and $secureStringPassword) {
            Throw "Password and SecureStringPassword parameters cannot be both specified at the same time"
        }
    }
    process {
        $params = @{
            "Name" = "VISecret|"+$server+"|"+$User
        }
         if ($password) {
            $params += @{"Secret" = $password}
        } elseif ($secureStringPassword) {
            $params += @{"SecureStringSecret" = $secureStringPassword}
        } elseif ($Vault) {
            $params += @{"Vault" = $Vault}
        }
        Set-Secret @params
    }
}</pre><p></p><pre class="crayon-plain-tag">function Get-VISecret {
    [CmdletBinding()]
    param (
        [Parameter(Mandatory=$true)]
        [string]$Server,
        [Parameter(Mandatory=$true)]
        [string]$User,
        [switch]$AsPlainText,
        [string]$Vault
    )
    process {
        $params = @{
            "Name" = "VISecret|"+$server+"|"+$User
        }
        if ($AsPlainText.IsPresent) {
            $params += @{"AsPlainText" = $AsPlainText.ToBool()}
        } elseif ($Vault) {
            $params += @{"Vault" = $Vault}
        }
        Get-Secret @params
    }
}</pre><p>&nbsp;</p>
<h2>Integrated connection experience</h2>
<p>The last cmdlet in the sample module is Connect-VIServerWithSecret. It combines the cmdlets above to give you integrated experience, similar to the one that Connect-VIServer provides with VICredentialStore. You can call Connect-VIServerWithSecret with username and password and use the -SaveCredentials parameter to save the credentials in the vault. Then you can call it by passing just the username: Connect-VIServerWithSecret will automatically retrieve the password from the vault and connect you to the vCenter. When you&#8217;re using the VICredentialStore, if you only have a single credential saved for a specified server, you could connect with Connect-VIServer without specifying a username. In Get-Secret, however, the -Username parameter is mandatory as we cannot list all saved credentials and check if you only have a single credential saved for the specified server. To enable this experience, we have defined a global variable $global:defaultUser<span style="font-size: 1rem;"> that lets you set a default user name for the Connect-VIServerWithSecret.</span></p>
<h2>Conclusion</h2>
<p>By using Microsoft&#8217;s SecretManagement and SecretStore modules, you can achieve similar user experience as when you&#8217;re using the VICredentialStore. SecretManagement also gives you a rich set of integration options with other third-party vaults, both locally and in the cloud. You can use the sample VISecret module to configure and use vaults in a similar way as with the VICredentialStore.</p><p>The post <a href="https://blogs.vmware.com/PowerCLI/2023/02/managing-vicredentials-on-powershell-7-using-vmware-visecret-module.html">Managing VICredentials on PowerShell 7 using VMware.VISecret Module!</a> appeared first on <a href="https://blogs.vmware.com/PowerCLI">VMware PowerCLI Blog</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
