Author Posts

June 20, 2017 at 2:17 pm

Hi all,

Trying to learn some DSC basics here. Below is my configuration:

Configuration lcmconfig
{
    Node $env:COMPUTERNAME
    {
        LocalConfigurationManager
        {
            ConfigurationMode = "ApplyAndAutocorrect"
        }
    }
}

lcmconfig

Set-DscLocalConfigurationManager -Path .\lcmconfig

configuration labconfig 
{
    node $env:COMPUTERNAME
    {
        File sysinternalssuite
        {
            Ensure = "Present"
            SourcePath = '\\cm1.corp.contoso.com\Software\SysinternalsSuite'
            DestinationPath = 'C:\Program Files (x86)\SysinternalsSuite'
            Type = "Directory"
            Recurse = $true
            
        }       
    }
}

labconfig

Start-DscConfiguration -Path .\labconfig

Seems to work fine but I wondered why the SourcePath and Recurse parameter values from the configuration above aren't shown when running Get-DscConfiguration?

PS C:\Windows\system32> Get-DscConfiguration

ConfigurationName : labconfig
DependsOn :
ModuleName : PSDesiredStateConfiguration
ModuleVersion :
PsDscRunAsCredential :
ResourceId : [File]sysinternalssuite
SourceInfo :
Attributes : {directory}
Checksum :
Contents :
CreatedDate : 20/06/2017 13:22:28
Credential :
DestinationPath : C:\Program Files (x86)\SysinternalsSuite
Ensure : present
Force :
MatchSource :
ModifiedDate : 20/06/2017 13:25:49
Recurse :
Size : 0
SourcePath :
SubItems :
Type : directory
PSComputerName :
CimClassName : MSFT_FileDirectoryConfiguration

June 20, 2017 at 2:18 pm

Honestly? It's likely a bug. The File resource – which is the only binary resource, so we can't look at its code to confirm – was written under PowerShell v4, when "Get" really didn't do anything. It's entirely likely all the properties just aren't wired up inside.

June 20, 2017 at 2:21 pm

Thank you for your response. Really appreciate it.