dscr-for-vmware icon indicating copy to clipboard operation
dscr-for-vmware copied to clipboard

[Feature] Potential improvement/changes in future

Open KristiyanGK opened this issue 4 years ago • 0 comments

  • Logging to a property logic should be removed when Invoke-DscResource no longer uses a separate runspace in order to create the DSC resource objects.
  • When Invoke-DscResource stops internally using a new runspace, the connections to vSphere can be fully reused without creating new ones via session secret.
  • Instead of using Invoke-DscResource, it could be substituted by creating the resources manually and calling their get/set/test methods. Example:
        $block = @"
        using module @{
            ModuleName = $ModuleName
            RequiredVersion = $RequiredVersion
        }
    
        [$resourceName]::new()
       "@
    
        # create object
        $dscObj = . ([ScriptBlock]::create($block))
    
        # set dsc key properties to object
        $dscObj.Key = $propValue
    
        # call method
        $dscObj.$method # test/get/set
    

KristiyanGK avatar Dec 18 '20 12:12 KristiyanGK