Misc/VMResourceGenerator.ps1

  $name = New-DscResourceProperty -Name Name -Type String -Attribute Key -Description "Name of the VM"
  $vhdPath = New-DscResourceProperty -Name VhdPath -Type String -Attribute Required -Description "VHD associated with the VM"
  $switchName = New-DscResourceProperty -Name SwitchName -Type String -Attribute Write -Description "Virtual switch associated with the VM"
  $path = New-DscResourceProperty -Name Path -Type String -Attribute Write -Description "Folder where the VM data will be stored"
  $generation = New-DscResourceProperty -Name Generation -Type String -Attribute Write -ValidateSet "Vhd","Vhdx" -Description "Associated Virtual disk format - Vhd or Vhdx"
  $ensure = New-DscResourceProperty -Name Ensure -Type String -Attribute Write -ValidateSet "Present","Absent" -Description "Should the VHD be created or deleted"
  $startupMem = New-DscResourceProperty -Name StartupMemory -Type Uint32 -Attribute Write -Description "Startup RAM for the VM"
  $minMem = New-DscResourceProperty -Name MinimumMemory -Type Uint32 -Attribute Write -Description "Minimum RAM for the VM. This enables dynamic memory"
  $maxMem = New-DscResourceProperty -Name MaximumMemory -Type Uint32 -Attribute Write -Description "Maximum RAM for the VM. This enable dynamic memory"
  $macAddress = New-DscResourceProperty -Name MACAddress -Type String -Attribute Write -Description "MAC address of the VM."
  $waitForIP = New-DscResourceProperty -Name WaitForIP -Type Boolean -Attribute Write -Description "Waits for VM to get valid IP address"
  $state = New-DscResourceProperty -Name State -Type String -Attribute Write -ValidateSet "Running","Paused","Off" -Description "State of the VM"
  $procCount = New-DscResourceProperty -Name ProcessorCount -Type Uint32 -Attribute Write -Description "Processor count for the VM"
  $restartIfNeeded = New-DscResourceProperty -Name RestartIfNeeded -Type Boolean -Attribute Write -Description "If specified, shutsdown and restarts the VM if needed for resource change"
 
  $id = New-DscResourceProperty -Name ID -Type String -Attribute Read -Description "VM unique ID"
  $status = New-DscResourceProperty -Name Status -Type String -Attribute Read -Description "Status of the VM"
  $CPUUsage = New-DscResourceProperty -Name CPUUsage -Type Uint32 -Attribute Read -Description "CPU Usage of the VM"
  $memAssigned = New-DscResourceProperty -Name MemoryAssigned -Type Real32 -Attribute Read -Description "Memory assigned to the VM"
  $uptime = New-DscResourceProperty -Name Uptime -Type String -Attribute Read -Description "Uptime of the VM"
  $creationTime = New-DscResourceProperty -Name CreationTime -Type DateTime -Attribute Read -Description "Creation time of the VM"
  $hasDynamicMemory = New-DscResourceProperty -Name HasDynamicMemory -Type Boolean -Attribute Read -Description "Does VM has dynamic memory enabled"
  $networkAdapters = New-DscResourceProperty -Name NetworkAdapters -Type String[] -Attribute Read -Description "Network adapters of the VM"

  New-DscResource -Name MSFT_xVMHyperV -Properties $name,$vhdPath,$switchName,$state,$path,$generation,$startupMem,$minMem,$maxMem,$macAddress,$procCount,$waitForIP,$restartIfNeeded,$ensure,$id,$status,$CPUUsage,$memAssigned,$uptime,$creationTime,$hasDynamicMemory,$networkAdapters -Path . -ClassVersion 1.0.0 -FriendlyName xVMHyperV