dsc file resource query

This topic contains 2 replies, has 2 voices, and was last updated by  Mike 5 months ago.

  • Author
    Posts
  • #73301

    Mike
    Participant

    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

  • #73304

    Don Jones
    Keymaster

    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.

    • #73307

      Mike
      Participant

      Thank you for your response. Really appreciate it.

You must be logged in to reply to this topic.