From 129a35b6c153b4570a393db41b413a070cb3908c Mon Sep 17 00:00:00 2001 From: Ryan Bushe Date: Mon, 4 Apr 2016 16:54:15 -0400 Subject: [PATCH] Updated Pagefile Resource to fix test/set when passed a size not divisible by 1MB --- .../StackExchange_Pagefile/StackExchange_Pagefile.psm1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/DSCResources/StackExchange_Pagefile/StackExchange_Pagefile.psm1 b/DSCResources/StackExchange_Pagefile/StackExchange_Pagefile.psm1 index 9d7d7c3..1355774 100644 --- a/DSCResources/StackExchange_Pagefile/StackExchange_Pagefile.psm1 +++ b/DSCResources/StackExchange_Pagefile/StackExchange_Pagefile.psm1 @@ -93,8 +93,8 @@ function Set-TargetResource if ($Ensure -like 'Present') { $PageFileSetting = Get-WmiObject Win32_PageFileSetting - $PageFileSetting.InitialSize = $InitialSize / 1MB - $PageFileSetting.MaximumSize = $MaximumSize / 1MB + $PageFileSetting.InitialSize = [int]($InitialSize / 1MB) + $PageFileSetting.MaximumSize = [int]($MaximumSize / 1MB) $PageFileSetting.put() | Out-Null Write-Verbose ($LocalizedData.PageFileStaticallyConfigured -f $InitialSize, $MaximumSize) @@ -143,13 +143,13 @@ function Test-TargetResource if ($PageFileSetting -ne $null) { - if (-not ($PageFileSetting.InitialSize -eq ($InitialSize / 1MB))) + if (-not ($PageFileSetting.InitialSize -eq [int]($InitialSize / 1MB))) { Write-Verbose ($LocalizedData.InitialSizeDifferent -f ($PageFileSetting.InitialSize * 1mb), $InitialSize) $Valid = $Valid -and $false } - if (-not ($PageFileSetting.MaximumSize -eq ($MaximumSize / 1MB))) + if (-not ($PageFileSetting.MaximumSize -eq [int]($MaximumSize / 1MB))) { Write-Verbose ($LocalizedData.MaximumSizeDifferent -f ($PageFileSetting.MaximumSize * 1mb), $MaximumSize) $Valid = $Valid -and $false