2023-01-05 14:43:18 -0500 Puppet (debug): dsc_virtualmemory: retrieving {:name=>"set_page_file_size_of_24576", :dsc_type=>"customsize", :dsc_drive=>"c", :dsc_initialsize=>24576, :dsc_maximumsize=>24576}
2023-01-05 14:43:18 -0500 Puppet (debug): dsc_virtualmemory: invocable_resource: {:parameters=>{:dsc_type=>{:value=>"customsize", :mof_type=>"String", :mof_is_embedded=>false}, :dsc_drive=>{:value=>"c", :mof_type=>"String", :mof_is_embedded=>false}}, :name=>"dsc_virtualmemory", :dscmeta_resource_friendly_name=>"VirtualMemory", :dscmeta_resource_name=>"DSC_VirtualMemory", :dscmeta_resource_implementation=>"MOF", :dscmeta_module_name=>"ComputerManagementDsc", :dscmeta_module_version=>"8.5.0", :dsc_invoke_method=>"get", :vendored_modules_path=>"C:/ProgramData/PuppetLabs/puppet/cache/lib/puppet_x/computermanagementdsc/dsc_resources", :attributes=>nil}
2023-01-05 14:43:18 -0500 Puppet (debug): dsc_virtualmemory: Script:
 function new-pscredential {
    [CmdletBinding()]
    param (
        [parameter(Mandatory = $true,
            ValueFromPipelineByPropertyName = $true)]
        [string]
        $user,

        [parameter(Mandatory = $true,
            ValueFromPipelineByPropertyName = $true)]
        [string]
        $password
    )

    $secpasswd = ConvertTo-SecureString $password -AsPlainText -Force
    $credentials = New-Object System.Management.Automation.PSCredential ($user, $secpasswd)
    return $credentials
}

Function ConvertTo-CanonicalResult {
  [CmdletBinding()]
  param(
      [Parameter(Mandatory, Position = 1)]
      [psobject]
      $Result,

      [Parameter(DontShow)]
      [string]
      $PropertyPath,

      [Parameter(DontShow)]
      [int]
      $RecursionLevel = 0
  )

  $MaxDepth = 5
  $CimInstancePropertyFilter = { $_.Definition -match 'CimInstance' -and $_.Name -ne 'PSDscRunAsCredential' }

  # Get the properties which are/aren't Cim instances
  $ResultObject = @{ }
  $ResultPropertyList = $Result | Get-Member -MemberType Property | Where-Object { $_.Name -ne 'PSComputerName' }
  $CimInstanceProperties = $ResultPropertyList | Where-Object -FilterScript $CimInstancePropertyFilter

  foreach ($Property in $ResultPropertyList) {
      $PropertyName = $Property.Name
      if ($Property -notin $CimInstanceProperties) {
          $Value = $Result.$PropertyName
          if ($PropertyName -eq 'Ensure' -and [string]::IsNullOrEmpty($Result.$PropertyName)) {
              # Just set 'Present' since it was found /shrug
              # If the value IS listed as absent, don't update it unless you want flapping
              $Value = 'Present'
          }
          else {
              if ([string]::IsNullOrEmpty($value)) {
                  # While PowerShell can happily treat empty strings as valid for returning
                  # an undefined enum, Puppet expects undefined values to be nil.
                  $Value = $null
              }

              if ($Value.Count -eq 1 -and $Property.Definition -match '\\[\\]') {
                  $Value = @($Value)
              }
          }
      }
      elseif ($null -eq $Result.$PropertyName) {
          if ($Property -match 'InstanceArray') {
              $Value = @()
          }
          else {
              $Value = $null
          }
      }
      elseif ($Result.$PropertyName.GetType().Name -match 'DateTime') {
          # Handle DateTimes especially since they're an edge case
          $Value = Get-Date $Result.$PropertyName -UFormat "%Y-%m-%dT%H:%M:%S%Z"
      }
      else {
          # Looks like a nested CIM instance, recurse if we're not too deep in already.
          $RecursionLevel++

          if ($PropertyPath -eq [string]::Empty) {
              $PropertyPath = $PropertyName
          }
          else {
              $PropertyPath = "$PropertyPath.$PropertyName"
          }

          if ($RecursionLevel -gt $MaxDepth) {
              # Give up recursing more than this
              return $Result.ToString()
          }

          $Value = foreach ($item in $Result.$PropertyName) {
              ConvertTo-CanonicalResult -Result $item -PropertyPath $PropertyPath -RecursionLevel ($RecursionLevel + 1) -WarningAction Continue
          }

          # The cim instance type is the last component of the type Name
          # We need to return this for ruby to compare the result hashes
          # We do NOT need it for the top-level properties as those are defined in the type
          If ($RecursionLevel -gt 1 -and ![string]::IsNullOrEmpty($Value) ) {
              # If there's multiple instances, you need to add the type to each one, but you
              # need to specify only *one* name, otherwise things end up *very* broken.
              if ($Value.GetType().Name -match '\[\]') {
                  $Value | ForEach-Object -Process {
                      $_.cim_instance_type = $Result.$PropertyName.CimClass.CimClassName[0]
                  }
              } else {
                  $Value.cim_instance_type = $Result.$PropertyName.CimClass.CimClassName
                  # Ensure that, if it should be an array, it is
                  if ($Result.$PropertyName.GetType().Name -match '\[\]') {
                      $Value = @($Value)
                  }
              }
          }
      }

      if ($Property.Definition -match 'InstanceArray') {
          If ($null -eq $Value -or $Value.GetType().Name -notmatch '\[\]') { $Value = @($Value) }
      }

      $ResultObject.$PropertyName = $Value
  }

  # Output the final result
  $ResultObject
}
$script:ErrorActionPreference = 'Stop'
$script:WarningPreference = 'SilentlyContinue'

$response = @{
    indesiredstate = $false
    rebootrequired = $false
    errormessage   = ''
}




$InvokeParams = @{Name = 'VirtualMemory'; Method = 'get'; Property = @{type = 'customsize'; drive = 'c'}; ModuleName = @{ModuleName = 'C:/ProgramData/PuppetLabs/puppet/cache/lib/puppet_x/computermanagementdsc/dsc_resources/ComputerManagementDsc/ComputerManagementDsc.psd1'; RequiredVersion = '8.5.0'}}
Try {
  $Result = Invoke-DscResource @InvokeParams
} catch {
  $Response.errormessage   = $_.Exception.Message
  return ($Response | ConvertTo-Json -Compress)
} Finally {
  If (![string]::IsNullOrEmpty($UnmungedPSModulePath)) {
    # Reset the PSModulePath
    [System.Environment]::SetEnvironmentVariable('PSModulePath', $UnmungedPSModulePath, [System.EnvironmentVariableTarget]::Machine)
    $env:PSModulePath = [System.Environment]::GetEnvironmentVariable('PSModulePath', 'machine')
  }
}

# keep the switch for when Test passes back changed properties
Switch ($invokeParams.Method) {
  'Test' {
    $Response.indesiredstate = $Result.InDesiredState
    return ($Response | ConvertTo-Json -Compress)
  }
  'Set' {
    $Response.indesiredstate = $true
    $Response.rebootrequired = $Result.RebootRequired
    return ($Response | ConvertTo-Json -Compress)
  }
  'Get' {
    $CanonicalizedResult = ConvertTo-CanonicalResult -Result $Result
    return ($CanonicalizedResult | ConvertTo-Json -Compress -Depth 10)
  }
}
2023-01-05 14:43:20 -0500 Puppet (debug): dsc_virtualmemory: raw data received: {"ResourceId"=>nil, "PsDscRunAsCredential"=>nil, "Type"=>"CustomSize", "InitialSize"=>24576, "ModuleVersion"=>"8.5.0", "SourceInfo"=>nil, "ConfigurationName"=>nil, "Drive"=>"C:\\", "MaximumSize"=>24576, "ModuleName"=>"C:/ProgramData/PuppetLabs/puppet/cache/lib/puppet_x/computermanagementdsc/dsc_resources/ComputerManagementDsc/ComputerManagementDsc.psd1", "DependsOn"=>nil}
2023-01-05 14:43:20 -0500 Puppet (debug): dsc_virtualmemory: Returned to Puppet as {:dsc_drive=>"C:\\", :dsc_initialsize=>24576, :dsc_maximumsize=>24576, :dsc_type=>"CustomSize", :name=>"set_page_file_size_of_24576"}
2023-01-05 14:43:20 -0500 Puppet (debug): dsc_virtualmemory: Canonicalized Resources: [{:dsc_drive=>"c", :dsc_initialsize=>24576, :dsc_maximumsize=>24576, :dsc_type=>"customsize", :name=>"set_page_file_size_of_24576"}]
2023-01-05 14:43:21 -0500 Puppet (debug): Creating default schedules
2023-01-05 14:43:21 -0500 Puppet (debug): Loaded state in 0.02 seconds
2023-01-05 14:43:21 -0500 Puppet (info): Using environment 'production'
2023-01-05 14:43:21 -0500 Puppet (debug): Loaded state in 0.01 seconds
2023-01-05 14:43:21 -0500 Puppet (info): Applying configuration version '1672947798'
2023-01-05 14:43:21 -0500 Puppet (debug): dsc_virtualmemory: Collecting data from the DSC Resource
2023-01-05 14:43:21 -0500 Puppet (debug): dsc_virtualmemory: retrieving {:name=>"set_page_file_size_of_24576", :dsc_drive=>"c", :dsc_type=>"customsize"}
2023-01-05 14:43:21 -0500 Puppet (debug): dsc_virtualmemory: invocable_resource: {:parameters=>{:dsc_drive=>{:value=>"c", :mof_type=>"String", :mof_is_embedded=>false}, :dsc_type=>{:value=>"customsize", :mof_type=>"String", :mof_is_embedded=>false}}, :name=>"dsc_virtualmemory", :dscmeta_resource_friendly_name=>"VirtualMemory", :dscmeta_resource_name=>"DSC_VirtualMemory", :dscmeta_resource_implementation=>"MOF", :dscmeta_module_name=>"ComputerManagementDsc", :dscmeta_module_version=>"8.5.0", :dsc_invoke_method=>"get", :vendored_modules_path=>"C:/ProgramData/PuppetLabs/puppet/cache/lib/puppet_x/computermanagementdsc/dsc_resources", :attributes=>nil}
2023-01-05 14:43:21 -0500 Puppet (debug): dsc_virtualmemory: Script:
 function new-pscredential {
    [CmdletBinding()]
    param (
        [parameter(Mandatory = $true,
            ValueFromPipelineByPropertyName = $true)]
        [string]
        $user,

        [parameter(Mandatory = $true,
            ValueFromPipelineByPropertyName = $true)]
        [string]
        $password
    )

    $secpasswd = ConvertTo-SecureString $password -AsPlainText -Force
    $credentials = New-Object System.Management.Automation.PSCredential ($user, $secpasswd)
    return $credentials
}

Function ConvertTo-CanonicalResult {
  [CmdletBinding()]
  param(
      [Parameter(Mandatory, Position = 1)]
      [psobject]
      $Result,

      [Parameter(DontShow)]
      [string]
      $PropertyPath,

      [Parameter(DontShow)]
      [int]
      $RecursionLevel = 0
  )

  $MaxDepth = 5
  $CimInstancePropertyFilter = { $_.Definition -match 'CimInstance' -and $_.Name -ne 'PSDscRunAsCredential' }

  # Get the properties which are/aren't Cim instances
  $ResultObject = @{ }
  $ResultPropertyList = $Result | Get-Member -MemberType Property | Where-Object { $_.Name -ne 'PSComputerName' }
  $CimInstanceProperties = $ResultPropertyList | Where-Object -FilterScript $CimInstancePropertyFilter

  foreach ($Property in $ResultPropertyList) {
      $PropertyName = $Property.Name
      if ($Property -notin $CimInstanceProperties) {
          $Value = $Result.$PropertyName
          if ($PropertyName -eq 'Ensure' -and [string]::IsNullOrEmpty($Result.$PropertyName)) {
              # Just set 'Present' since it was found /shrug
              # If the value IS listed as absent, don't update it unless you want flapping
              $Value = 'Present'
          }
          else {
              if ([string]::IsNullOrEmpty($value)) {
                  # While PowerShell can happily treat empty strings as valid for returning
                  # an undefined enum, Puppet expects undefined values to be nil.
                  $Value = $null
              }

              if ($Value.Count -eq 1 -and $Property.Definition -match '\\[\\]') {
                  $Value = @($Value)
              }
          }
      }
      elseif ($null -eq $Result.$PropertyName) {
          if ($Property -match 'InstanceArray') {
              $Value = @()
          }
          else {
              $Value = $null
          }
      }
      elseif ($Result.$PropertyName.GetType().Name -match 'DateTime') {
          # Handle DateTimes especially since they're an edge case
          $Value = Get-Date $Result.$PropertyName -UFormat "%Y-%m-%dT%H:%M:%S%Z"
      }
      else {
          # Looks like a nested CIM instance, recurse if we're not too deep in already.
          $RecursionLevel++

          if ($PropertyPath -eq [string]::Empty) {
              $PropertyPath = $PropertyName
          }
          else {
              $PropertyPath = "$PropertyPath.$PropertyName"
          }

          if ($RecursionLevel -gt $MaxDepth) {
              # Give up recursing more than this
              return $Result.ToString()
          }

          $Value = foreach ($item in $Result.$PropertyName) {
              ConvertTo-CanonicalResult -Result $item -PropertyPath $PropertyPath -RecursionLevel ($RecursionLevel + 1) -WarningAction Continue
          }

          # The cim instance type is the last component of the type Name
          # We need to return this for ruby to compare the result hashes
          # We do NOT need it for the top-level properties as those are defined in the type
          If ($RecursionLevel -gt 1 -and ![string]::IsNullOrEmpty($Value) ) {
              # If there's multiple instances, you need to add the type to each one, but you
              # need to specify only *one* name, otherwise things end up *very* broken.
              if ($Value.GetType().Name -match '\[\]') {
                  $Value | ForEach-Object -Process {
                      $_.cim_instance_type = $Result.$PropertyName.CimClass.CimClassName[0]
                  }
              } else {
                  $Value.cim_instance_type = $Result.$PropertyName.CimClass.CimClassName
                  # Ensure that, if it should be an array, it is
                  if ($Result.$PropertyName.GetType().Name -match '\[\]') {
                      $Value = @($Value)
                  }
              }
          }
      }

      if ($Property.Definition -match 'InstanceArray') {
          If ($null -eq $Value -or $Value.GetType().Name -notmatch '\[\]') { $Value = @($Value) }
      }

      $ResultObject.$PropertyName = $Value
  }

  # Output the final result
  $ResultObject
}
$script:ErrorActionPreference = 'Stop'
$script:WarningPreference = 'SilentlyContinue'

$response = @{
    indesiredstate = $false
    rebootrequired = $false
    errormessage   = ''
}




$InvokeParams = @{Name = 'VirtualMemory'; Method = 'get'; Property = @{drive = 'c'; type = 'customsize'}; ModuleName = @{ModuleName = 'C:/ProgramData/PuppetLabs/puppet/cache/lib/puppet_x/computermanagementdsc/dsc_resources/ComputerManagementDsc/ComputerManagementDsc.psd1'; RequiredVersion = '8.5.0'}}
Try {
  $Result = Invoke-DscResource @InvokeParams
} catch {
  $Response.errormessage   = $_.Exception.Message
  return ($Response | ConvertTo-Json -Compress)
} Finally {
  If (![string]::IsNullOrEmpty($UnmungedPSModulePath)) {
    # Reset the PSModulePath
    [System.Environment]::SetEnvironmentVariable('PSModulePath', $UnmungedPSModulePath, [System.EnvironmentVariableTarget]::Machine)
    $env:PSModulePath = [System.Environment]::GetEnvironmentVariable('PSModulePath', 'machine')
  }
}

# keep the switch for when Test passes back changed properties
Switch ($invokeParams.Method) {
  'Test' {
    $Response.indesiredstate = $Result.InDesiredState
    return ($Response | ConvertTo-Json -Compress)
  }
  'Set' {
    $Response.indesiredstate = $true
    $Response.rebootrequired = $Result.RebootRequired
    return ($Response | ConvertTo-Json -Compress)
  }
  'Get' {
    $CanonicalizedResult = ConvertTo-CanonicalResult -Result $Result
    return ($CanonicalizedResult | ConvertTo-Json -Compress -Depth 10)
  }
}
2023-01-05 14:43:22 -0500 Puppet (debug): dsc_virtualmemory: raw data received: {"ResourceId"=>nil, "PsDscRunAsCredential"=>nil, "Type"=>"CustomSize", "InitialSize"=>24576, "ModuleVersion"=>"8.5.0", "SourceInfo"=>nil, "ConfigurationName"=>nil, "Drive"=>"C:\\", "MaximumSize"=>24576, "ModuleName"=>"C:/ProgramData/PuppetLabs/puppet/cache/lib/puppet_x/computermanagementdsc/dsc_resources/ComputerManagementDsc/ComputerManagementDsc.psd1", "DependsOn"=>nil}
2023-01-05 14:43:22 -0500 Puppet (debug): dsc_virtualmemory: Returned to Puppet as {:dsc_drive=>"C:\\", :dsc_initialsize=>24576, :dsc_maximumsize=>24576, :dsc_type=>"CustomSize", :name=>"set_page_file_size_of_24576"}
2023-01-05 14:43:22 -0500 Puppet (debug): Current State: {:name=>"set_page_file_size_of_24576", :dsc_drive=>"c", :dsc_type=>"customsize"}
2023-01-05 14:43:22 -0500 Puppet (debug): dsc_virtualmemory: Canonicalized Resources: [{:name=>"set_page_file_size_of_24576", :dsc_drive=>"c", :dsc_type=>"customsize", :dsc_initialsize=>24576, :dsc_maximumsize=>24576, :validation_mode=>"property"}]
2023-01-05 14:43:22 -0500 /Stage[main]/Main/Dsc_virtualmemory[set_page_file_size_of_24576]/dsc_initialsize (notice): dsc_initialsize changed  to 24576
2023-01-05 14:43:22 -0500 /Stage[main]/Main/Dsc_virtualmemory[set_page_file_size_of_24576]/dsc_maximumsize (notice): dsc_maximumsize changed  to 24576
2023-01-05 14:43:22 -0500 Puppet (debug): Target State: {:name=>"set_page_file_size_of_24576", :dsc_drive=>"c", :dsc_type=>"customsize", :dsc_initialsize=>24576, :dsc_maximumsize=>24576, :validation_mode=>"property"}
2023-01-05 14:43:22 -0500 Puppet (debug): dsc_virtualmemory[{:name=>"set_page_file_size_of_24576", :dsc_drive=>"c", :dsc_type=>"customsize"}]: Updating: Start
2023-01-05 14:43:22 -0500 Puppet (debug): dsc_virtualmemory[{:name=>"set_page_file_size_of_24576", :dsc_drive=>"c", :dsc_type=>"customsize"}]: Updating: Updating '{:name=>"set_page_file_size_of_24576", :dsc_drive=>"c", :dsc_type=>"customsize"}' with {:name=>"set_page_file_size_of_24576", :dsc_drive=>"c", :dsc_type=>"customsize", :dsc_initialsize=>24576, :dsc_maximumsize=>24576, :validation_mode=>"property"}
2023-01-05 14:43:22 -0500 Puppet (debug): dsc_virtualmemory[{:name=>"set_page_file_size_of_24576", :dsc_drive=>"c", :dsc_type=>"customsize"}]: Updating: Invoking Set Method for '{:name=>"set_page_file_size_of_24576", :dsc_drive=>"c", :dsc_type=>"customsize"}' with {:name=>"set_page_file_size_of_24576", :dsc_drive=>"c", :dsc_type=>"customsize", :dsc_initialsize=>24576, :dsc_maximumsize=>24576, :validation_mode=>"property"}
2023-01-05 14:43:22 -0500 Puppet (debug): dsc_virtualmemory[{:name=>"set_page_file_size_of_24576", :dsc_drive=>"c", :dsc_type=>"customsize"}]: Updating: invocable_resource: {:parameters=>{:dsc_drive=>{:value=>"c", :mof_type=>"String", :mof_is_embedded=>false}, :dsc_type=>{:value=>"customsize", :mof_type=>"String", :mof_is_embedded=>false}, :dsc_initialsize=>{:value=>24576, :mof_type=>"SInt64", :mof_is_embedded=>false}, :dsc_maximumsize=>{:value=>24576, :mof_type=>"SInt64", :mof_is_embedded=>false}}, :name=>"dsc_virtualmemory", :dscmeta_resource_friendly_name=>"VirtualMemory", :dscmeta_resource_name=>"DSC_VirtualMemory", :dscmeta_resource_implementation=>"MOF", :dscmeta_module_name=>"ComputerManagementDsc", :dscmeta_module_version=>"8.5.0", :dsc_invoke_method=>"set", :vendored_modules_path=>"C:/ProgramData/PuppetLabs/puppet/cache/lib/puppet_x/computermanagementdsc/dsc_resources", :attributes=>nil}
2023-01-05 14:43:22 -0500 Puppet (debug): dsc_virtualmemory[{:name=>"set_page_file_size_of_24576", :dsc_drive=>"c", :dsc_type=>"customsize"}]: Updating: Script:
 function new-pscredential {
    [CmdletBinding()]
    param (
        [parameter(Mandatory = $true,
            ValueFromPipelineByPropertyName = $true)]
        [string]
        $user,

        [parameter(Mandatory = $true,
            ValueFromPipelineByPropertyName = $true)]
        [string]
        $password
    )

    $secpasswd = ConvertTo-SecureString $password -AsPlainText -Force
    $credentials = New-Object System.Management.Automation.PSCredential ($user, $secpasswd)
    return $credentials
}

Function ConvertTo-CanonicalResult {
  [CmdletBinding()]
  param(
      [Parameter(Mandatory, Position = 1)]
      [psobject]
      $Result,

      [Parameter(DontShow)]
      [string]
      $PropertyPath,

      [Parameter(DontShow)]
      [int]
      $RecursionLevel = 0
  )

  $MaxDepth = 5
  $CimInstancePropertyFilter = { $_.Definition -match 'CimInstance' -and $_.Name -ne 'PSDscRunAsCredential' }

  # Get the properties which are/aren't Cim instances
  $ResultObject = @{ }
  $ResultPropertyList = $Result | Get-Member -MemberType Property | Where-Object { $_.Name -ne 'PSComputerName' }
  $CimInstanceProperties = $ResultPropertyList | Where-Object -FilterScript $CimInstancePropertyFilter

  foreach ($Property in $ResultPropertyList) {
      $PropertyName = $Property.Name
      if ($Property -notin $CimInstanceProperties) {
          $Value = $Result.$PropertyName
          if ($PropertyName -eq 'Ensure' -and [string]::IsNullOrEmpty($Result.$PropertyName)) {
              # Just set 'Present' since it was found /shrug
              # If the value IS listed as absent, don't update it unless you want flapping
              $Value = 'Present'
          }
          else {
              if ([string]::IsNullOrEmpty($value)) {
                  # While PowerShell can happily treat empty strings as valid for returning
                  # an undefined enum, Puppet expects undefined values to be nil.
                  $Value = $null
              }

              if ($Value.Count -eq 1 -and $Property.Definition -match '\\[\\]') {
                  $Value = @($Value)
              }
          }
      }
      elseif ($null -eq $Result.$PropertyName) {
          if ($Property -match 'InstanceArray') {
              $Value = @()
          }
          else {
              $Value = $null
          }
      }
      elseif ($Result.$PropertyName.GetType().Name -match 'DateTime') {
          # Handle DateTimes especially since they're an edge case
          $Value = Get-Date $Result.$PropertyName -UFormat "%Y-%m-%dT%H:%M:%S%Z"
      }
      else {
          # Looks like a nested CIM instance, recurse if we're not too deep in already.
          $RecursionLevel++

          if ($PropertyPath -eq [string]::Empty) {
              $PropertyPath = $PropertyName
          }
          else {
              $PropertyPath = "$PropertyPath.$PropertyName"
          }

          if ($RecursionLevel -gt $MaxDepth) {
              # Give up recursing more than this
              return $Result.ToString()
          }

          $Value = foreach ($item in $Result.$PropertyName) {
              ConvertTo-CanonicalResult -Result $item -PropertyPath $PropertyPath -RecursionLevel ($RecursionLevel + 1) -WarningAction Continue
          }

          # The cim instance type is the last component of the type Name
          # We need to return this for ruby to compare the result hashes
          # We do NOT need it for the top-level properties as those are defined in the type
          If ($RecursionLevel -gt 1 -and ![string]::IsNullOrEmpty($Value) ) {
              # If there's multiple instances, you need to add the type to each one, but you
              # need to specify only *one* name, otherwise things end up *very* broken.
              if ($Value.GetType().Name -match '\[\]') {
                  $Value | ForEach-Object -Process {
                      $_.cim_instance_type = $Result.$PropertyName.CimClass.CimClassName[0]
                  }
              } else {
                  $Value.cim_instance_type = $Result.$PropertyName.CimClass.CimClassName
                  # Ensure that, if it should be an array, it is
                  if ($Result.$PropertyName.GetType().Name -match '\[\]') {
                      $Value = @($Value)
                  }
              }
          }
      }

      if ($Property.Definition -match 'InstanceArray') {
          If ($null -eq $Value -or $Value.GetType().Name -notmatch '\[\]') { $Value = @($Value) }
      }

      $ResultObject.$PropertyName = $Value
  }

  # Output the final result
  $ResultObject
}
$script:ErrorActionPreference = 'Stop'
$script:WarningPreference = 'SilentlyContinue'

$response = @{
    indesiredstate = $false
    rebootrequired = $false
    errormessage   = ''
}




$InvokeParams = @{Name = 'VirtualMemory'; Method = 'set'; Property = @{drive = 'c'; type = 'customsize'; initialsize = 24576; maximumsize = 24576}; ModuleName = @{ModuleName = 'C:/ProgramData/PuppetLabs/puppet/cache/lib/puppet_x/computermanagementdsc/dsc_resources/ComputerManagementDsc/ComputerManagementDsc.psd1'; RequiredVersion = '8.5.0'}}
Try {
  $Result = Invoke-DscResource @InvokeParams
} catch {
  $Response.errormessage   = $_.Exception.Message
  return ($Response | ConvertTo-Json -Compress)
} Finally {
  If (![string]::IsNullOrEmpty($UnmungedPSModulePath)) {
    # Reset the PSModulePath
    [System.Environment]::SetEnvironmentVariable('PSModulePath', $UnmungedPSModulePath, [System.EnvironmentVariableTarget]::Machine)
    $env:PSModulePath = [System.Environment]::GetEnvironmentVariable('PSModulePath', 'machine')
  }
}

# keep the switch for when Test passes back changed properties
Switch ($invokeParams.Method) {
  'Test' {
    $Response.indesiredstate = $Result.InDesiredState
    return ($Response | ConvertTo-Json -Compress)
  }
  'Set' {
    $Response.indesiredstate = $true
    $Response.rebootrequired = $Result.RebootRequired
    return ($Response | ConvertTo-Json -Compress)
  }
  'Get' {
    $CanonicalizedResult = ConvertTo-CanonicalResult -Result $Result
    return ($CanonicalizedResult | ConvertTo-Json -Compress -Depth 10)
  }
}
2023-01-05 14:43:22 -0500 Puppet (debug): dsc_virtualmemory[{:name=>"set_page_file_size_of_24576", :dsc_drive=>"c", :dsc_type=>"customsize"}]: Updating: raw data received: {"rebootrequired"=>true, "indesiredstate"=>true, "errormessage"=>""}
2023-01-05 14:43:22 -0500 Puppet (notice): dsc_virtualmemory[{:name=>"set_page_file_size_of_24576", :dsc_drive=>"c", :dsc_type=>"customsize"}]: Updating: Finished in 0.871321 seconds
2023-01-05 14:43:22 -0500 /Stage[main]/Main/Dsc_virtualmemory[set_page_file_size_of_24576] (debug): The container Class[Main] will propagate my refresh event
2023-01-05 14:43:22 -0500 /Stage[main]/Main/Dsc_virtualmemory[set_page_file_size_of_24576] (debug): The container Class[Main] will propagate my refresh event