@@ -42,7 +42,7 @@ function Get-TargetResource
4242 MaximumSize = 0
4343 }
4444
45- [bool ] $isSystemManaged = (Get-CimInstance - ClassName ' Win32_ComputerSystem' ).AutomaticManagedPagefile
45+ [System.Boolean ] $isSystemManaged = (Get-CimInstance - ClassName ' Win32_ComputerSystem' ).AutomaticManagedPagefile
4646
4747 if ($isSystemManaged )
4848 {
@@ -58,21 +58,22 @@ function Get-TargetResource
5858 if (-not $existingPageFileSetting )
5959 {
6060 $returnValue.Type = ' NoPagingFile'
61- return $returnValue
62- }
63-
64- if ($existingPageFileSetting.InitialSize -eq 0 -and $existingPageFileSetting.MaximumSize -eq 0 )
65- {
66- $returnValue.Type = ' SystemManagedSize'
6761 }
6862 else
6963 {
70- $returnValue.Type = ' CustomSize'
71- }
64+ if ($existingPageFileSetting.InitialSize -eq 0 -and $existingPageFileSetting.MaximumSize -eq 0 )
65+ {
66+ $returnValue.Type = ' SystemManagedSize'
67+ }
68+ else
69+ {
70+ $returnValue.Type = ' CustomSize'
71+ }
7272
73- $returnValue.Drive = $existingPageFileSetting.Name.Substring (0 , 3 )
74- $returnValue.InitialSize = $existingPageFileSetting.InitialSize
75- $returnValue.MaximumSize = $existingPageFileSetting.MaximumSize
73+ $returnValue.Drive = $existingPageFileSetting.Name.Substring (0 , 3 )
74+ $returnValue.InitialSize = $existingPageFileSetting.InitialSize
75+ $returnValue.MaximumSize = $existingPageFileSetting.MaximumSize
76+ }
7677
7778 return $returnValue
7879}
@@ -382,6 +383,20 @@ function Get-PageFileSetting
382383 - Filter " SettingID='pagefile.sys @ $Drive '"
383384}
384385
386+ <#
387+ . SYNOPSIS
388+ Sets a new page file name.
389+
390+ . PARAMETER Drive
391+ The letter of the drive containing the page file
392+ to change the settings of.
393+
394+ . PARAMETER InitialSize
395+ The initial size to set the page file to.
396+
397+ . PARAMETER MaximumSize
398+ The maximum size to set the page file to.
399+ #>
385400function Set-PageFileSetting
386401{
387402 [CmdletBinding ()]
0 commit comments