Gathering information during the DSC configuration phase

Welcome Forums DSC (Desired State Configuration) Gathering information during the DSC configuration phase

This topic contains 1 reply, has 2 voices, and was last updated by

 
Keymaster
1 year, 6 months ago.

  • Author
    Posts
  • #69973

    Participant
    Points: 0
    Rank: Member

    Hello,

    I'm fairly new to DSC and I'm trying to apply VSS storage size settings within my configuration. Is it possible to gather data from the node that is being configured with a WMI query and run that through a foreach loop? Or would I need to put this into a DSC script resource?

    $disk = Get-WmiObject -class win32_logicaldisk | where {$_.drivetype -eq '3'} | select DeviceID

    Foreach ($Item in $Disk) {
    VSS $item {
    Ensure = 'Present'
    Drive = '$Item'
    Size = '1Gb'

    }

    Thanks,

    JS

  • #70098

    Keymaster
    Points: 1,644
    Helping HandTeam Member
    Rank: Community Hero

    You would be best off building a custom resource – they're easier to debug and maintain than a Script resource. But yes, that's what you'd need to do – the MOF can't contain any executable code apart from a Script resource.

The topic ‘Gathering information during the DSC configuration phase’ is closed to new replies.