Release

New Release- vSphereDSC 2.2

The vSphere Desired State Configuration(vSphere DSC) is an open-source project lead by the VMware PowerCLI team. The project got started in 2017, and since then, it is keep growing. Today, we are excited to announce the release of vSphere DSC 2.2. This release brings various enhancements and increases the overall count of vSphere DSC resources to 73 compared to 67 from the previous release.

I also have another great piece of news for all of you. The vSphereDSC is now fully supported on Linux platforms and does not mandate you to set up a windows box to execute vSphereDSC resources.

New DSC Resources

Below are some of the new DSC resources which have been introduced with this release.

  1. DatastoreCluster: Create, modify, update, or remove Datastore cluster
  2. DatastoreClusterAddDatastore: Add Datastore to a datastore cluster
  3. DRSRule: Create, modify, update, or remove DRS rules.
  4. VMHostVdsNic: Modify, update, or remove a ‘VMKernel nic’ on a vSphere Distributed switch. 
  5. VMHostStorage: Enable or disable the software iSCSI adapter. 
  6. VMHostIScsiHbaVMKernelNic: Used to bind/unbind VMKernel Network Adapters to/from the specified iSCSI Host Bus Adapter.

Bugfixes

  1. VMHostVDSwitchMigration: Fixed the bug to allow multiple vmnic to be migrated to a dvSwitch 
  2. VMHostVssTeaming: Fixed bugs with physical network adapters when updating the teaming policy of the standard switch.
  3. NfsDatastore: Fixed the bug, to allow mount operation on the VMhost if the NFS datastore already present.

Install/Update VMware vSphereDSC Module

Execute the below command to install or update the vSphereDSC module from PowerShell Gallery.

Install

Update


VMware.PSDesiredStateConfiguration module

The vSphere DSC is a PowerShell DSC-based module that provides DSC resources for VMware vSphere. The PowerShell DSC enables IaC (Infrastructure as a Code) approach to author and build infrastructure as per the desired state configuration.

The PowerShell DSC has an important component known as Local Configuration Manager (LCM), the PowerShell DSC execution engine. The vCenter Server and ESXi host don’t have PowerShell and LCM installed and we had the compulsion of using a windows server to act as a proxy LCM server.

Recently, Microsoft has introduced a new cmdlet, Invoke-DSCResource, which allows you to execute DSC resources without a PowerShell LCM engine. We have leverage Invoke-DSCResource capabilities and introduced a new module VMware.PSDesiredStateConfiguration, to execute the vSphereDSC resources. The module is fully compatible with both Windows and Linux platforms and allows you to execute vSphereDSC resources without using the PowerShell LCM engine.

Please note that you can either choose to run vSphereDSC with a PowerShell LCM engine or VMware.PSDesiredStateConfiguration module.

Execute the below cmdlet to install VMware.PSDesiredStateConfiguration

Let’s take a look at the new cmdlets introduced along with this module.

New-VmwDscConfiguration

This cmdlet creates a VmwDscConfiguration object which contains information about the configuration. You can document the configuration with a .ps1 file and pass the configuration document as a parameter to this cmdlet.

This object is then used with the other cmdlets to perform the three primary DSC operations(GET, START, TEST).

Example:

Start-VmwDscConfiguration

This cmdlet starts the DSC execution with the PowerShell object, which was created using the New-VmwDscConfiguration cmdlet.

Example:

Test-VmwDscConfiguration

This cmdlet check the compliance of your vSphere infrastructure against a DSC configuration.

Example1:

This will return a Boolean result that shows if the state is desired or not.

Example 2:

If you want a detailed result in which every resource state is shown you can use the optional -Detailed switch for the Test-VmwDscConfiguration cmdlet.


Advantages of using VMware.PSDesiredStateConfiguration module

vSphere Nodes

A new construct, vSphereNode is introduced which allows you to specify a VINode(vCenter or ESXi host) and apply DSC configurations directly to the respective vSphereNode.

Note: vSphereNode construct is supported from PowerShell core (PS7).

Persistent VI session

With the PowerShell LCM engine, each resource required a server name (vCenter or ESXi host), and its credential to establish a VISession. If you have 3 resources in a configuration, DSC will create a separate VISession for each resource.

           With Vmware.PSDesiredStateConfiguration creates a persistent VISession across all the DSC resources and removes the need to have a separate VISession for each vSphereDSC resource.

No more MOF files

 New-VmwDSCconfiguration cmdlet executes the DSC resources without involving the PowerShell LCM engine and does not create any ‘mof’ file. The configuration can be complied with and stored in a PowerShell variable.


Important Links

Conclusion

The new VMware.PSDesiredStateConfiguration module and the ability to execute vSphereDSC from a Linux platform provide greater flexibility of consuming the vSphereDSC resources.

We would like to thank our community members and customers for sharing the required feedback, new feature request, and issues with us. We request you to start using the vSphereDSC resources and let us know what more we can do here. Happy to hear your thoughts!