posted

0 Comments

VMware PowerCLI is a command-line scripting tool built on Windows PowerShell. It provides an array of cmdlets to efficiently automate repetitive tasks, create reports as well as be used as a guardrail to ascertain possible outcomes of administrative operations.

PowerCLI is the preferred and widely used utility to manage and automate the vSphere suite of products, including VMware vSAN. Each new release of PowerCLI adds to the extensive list of cmdlets to ease administration. PowerCLI 12 now includes new cmdlets to provision and manage vSAN File Service introduced with vSAN 7.

List of new cmdlets introduced:

  • Get-VsanFileServiceDomain
  • New-VsanFileServiceDomain
  • Set-VsanFileServiceDomain
  • Remove-VsanFileServiceDomain
  • New-VsanFileServiceIpConfig
  • Get-VsanFileShare
  • New-VsanFileShare
  • Set-VsanFileShare
  • Remove-VsanFileShare
  • New-VsanFileShareNetworkPermission
  • Add-VsanFileServiceOvf
  • Get-VsanFileServiceOvfInfo

You can access the complete set of PowerCLI cmdlets and their usage here - PowerCLI Reference.

Sample Script

Here is an example of using the new cmdlets to create a File Share on a vSAN cluster:

  1. Add vSAN File Service OVF
    Add-VsanFileServiceOvf
    Set-PowerCLIConfiguration -WebOperationTimeoutSeconds 3600

  2. Enable vSAN File Service
    $fsnet = Get-VirtualNetwork
    $conf = Set-VsanClusterConfiguration $conf -FileServiceEnabled $true -FileServiceNetwork $fsnet[0]

  3. Create a File Service domain and provide network details
    $ipConfig=New-VsanFileServerIpConfig -IpAddress "X.X.X.X" -SubnetMask "Y.Y.Y.Y" -Fqdn "randomname.eng.vmware.com" -Gateway "Z.Z.Z.Z" -IsPrimary
    New-VsanFileServiceDomain -Name “vcflab-fsx” -VsanFileServerIpConfig $ipConfig -DnsServerAddress "10.198.16.1" -DnsSuffix “labs.satb.eng.vmware.com” -Cluster $conf.Cluster

  4. Create file shares that can be presented to clients
    $domain = Get-VsanFileServiceDomain New-VsanFileShare -FileServiceDomain $domain[0] -Name "vcflabx"

  5. Verify that File Service domain is created with the intended file shares
    Get-VsanFileShare

Summary

VMware Cloud Foundation is the best-in-class hybrid cloud platform powered by vSAN to run any workload. Automation is essential to build and manage hybrid cloud infrastructure at scale efficiently, and PowerCLI is a powerful tool that enables automation. PowerCLI 12 provides Day-0 support for several new features included with vSphere 7, specifically flagship features such as vSAN File Service, as demonstrated in this blog post. PowerCLI drastically improves operational efficiency and eases administration.

Next Steps

Download: VMware PowerCLI 12.0.0
Documentation:
PowerCLI User Guide
Release Notes
Blog on What’s new with PowerCLI 12