Skip to content

Commit 46f7b68

Browse files
committed
Formatting
1 parent 67b96b3 commit 46f7b68

1 file changed

Lines changed: 41 additions & 23 deletions

File tree

DSCResources/MSFT_xVirtualMemory/MSFT_xVirtualMemory.psm1

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
function Get-TargetResource {
1+
function Get-TargetResource
2+
{
23
[CmdletBinding()]
34
[OutputType([System.Collections.Hashtable])]
45
param
@@ -7,7 +8,7 @@ function Get-TargetResource {
78
[System.String]
89
$Drive,
910

10-
[ValidateSet("AutoManagePagingFile","CustomSize","SystemManagedSize","NoPagingFile")]
11+
[ValidateSet("AutoManagePagingFile", "CustomSize", "SystemManagedSize", "NoPagingFile")]
1112
[parameter(Mandatory = $true)]
1213
[System.String]
1314
$Type
@@ -52,23 +53,24 @@ function Get-TargetResource {
5253
$returnValue.Type = "CustomSize"
5354
}
5455

55-
$returnValue.Drive = $virtualMemoryInstance.Name.Substring(0,3)
56+
$returnValue.Drive = $virtualMemoryInstance.Name.Substring(0, 3)
5657
$returnValue.InitialSize = $virtualMemoryInstance.InitialSize
5758
$returnValue.MaximumSize = $virtualMemoryInstance.MaximumSize
5859

5960
$returnValue
6061
}
6162

6263

63-
function Set-TargetResource {
64+
function Set-TargetResource
65+
{
6466
[CmdletBinding()]
6567
param
6668
(
6769
[parameter(Mandatory = $true)]
6870
[System.String]
6971
$Drive,
7072

71-
[ValidateSet("AutoManagePagingFile","CustomSize","SystemManagedSize","NoPagingFile")]
73+
[ValidateSet("AutoManagePagingFile", "CustomSize", "SystemManagedSize", "NoPagingFile")]
7274
[parameter(Mandatory = $true)]
7375
[System.String]
7476
$Type,
@@ -84,7 +86,7 @@ function Set-TargetResource {
8486

8587
$SystemInfo = Get-CimInstance -Class Win32_ComputerSystem
8688

87-
switch($Type)
89+
switch ($Type)
8890
{
8991
"AutoManagePagingFile"
9092
{
@@ -198,7 +200,8 @@ function Set-TargetResource {
198200
$global:DSCMachineStatus = 1
199201
break
200202
}
201-
"NoPagingFile" {
203+
"NoPagingFile"
204+
{
202205
if ($SystemInfo.AutomaticManagedPageFile)
203206
{
204207
$setParams = @{
@@ -238,7 +241,8 @@ function Set-TargetResource {
238241
}
239242

240243

241-
function Test-TargetResource {
244+
function Test-TargetResource
245+
{
242246
[CmdletBinding()]
243247
[OutputType([System.Boolean])]
244248
param
@@ -247,7 +251,7 @@ function Test-TargetResource {
247251
[System.String]
248252
$Drive,
249253

250-
[ValidateSet("AutoManagePagingFile","CustomSize","SystemManagedSize","NoPagingFile")]
254+
[ValidateSet("AutoManagePagingFile", "CustomSize", "SystemManagedSize", "NoPagingFile")]
251255
[parameter(Mandatory = $true)]
252256
[System.String]
253257
$Type,
@@ -262,71 +266,85 @@ function Test-TargetResource {
262266
$SystemInfo = Get-CimInstance -Class Win32_ComputerSystem
263267
$result = $false
264268

265-
switch($Type) {
266-
"AutoManagePagingFile" {
269+
switch ($Type)
270+
{
271+
"AutoManagePagingFile"
272+
{
267273
$result = $SystemInfo.AutomaticManagedPagefile
268274
break
269275
}
270-
"CustomSize" {
271-
if ($SystemInfo.AutomaticManagedPageFile) {
276+
"CustomSize"
277+
{
278+
if ($SystemInfo.AutomaticManagedPageFile)
279+
{
272280
$result = $false
273281
break
274282
}
275283

276284
$driveInfo = [System.IO.DriveInfo] $Drive
277285
$PageFile = Get-CimInstance -Class Win32_PageFileSetting -Filter "SettingID='pagefile.sys @ $($driveInfo.Name.Substring(0,2))'"
278-
if (-not $PageFile) {
286+
if (-not $PageFile)
287+
{
279288
$result = $false
280289
break
281290
}
282291

283-
if (-not ($PageFile.InitialSize -eq $InitialSize -and $PageFile.MaximumSize -eq $MaximumSize)) {
292+
if (-not ($PageFile.InitialSize -eq $InitialSize -and $PageFile.MaximumSize -eq $MaximumSize))
293+
{
284294
$result = $false
285295
break
286296
}
287297

288298
$result = $true
289299
break
290300
}
291-
"SystemManagedSize" {
292-
if ($SystemInfo.AutomaticManagedPageFile) {
301+
"SystemManagedSize"
302+
{
303+
if ($SystemInfo.AutomaticManagedPageFile)
304+
{
293305
$result = $false
294306
break
295307
}
296308

297309
$driveInfo = [System.IO.DriveInfo] $Drive
298310
$PageFile = Get-CimInstance -Class Win32_PageFileSetting -Filter "SettingID='pagefile.sys @ $($driveInfo.Name.Substring(0,2))'"
299-
if (-not $PageFile) {
311+
if (-not $PageFile)
312+
{
300313
$result = $false
301314
break
302315
}
303316

304-
if (-not ($PageFile.InitialSize -eq 0 -and $PageFile.MaximumSize -eq 0)) {
317+
if (-not ($PageFile.InitialSize -eq 0 -and $PageFile.MaximumSize -eq 0))
318+
{
305319
$result = $false
306320
break
307321
}
308322

309323
$result = $true
310324
break
311325
}
312-
"NoPagingFile" {
313-
if ($SystemInfo.AutomaticManagedPageFile) {
326+
"NoPagingFile"
327+
{
328+
if ($SystemInfo.AutomaticManagedPageFile)
329+
{
314330
$result = $false
315331
break
316332
}
317333

318334
$driveInfo = [System.IO.DriveInfo] $Drive
319335
$PageFile = Get-CimInstance -Class Win32_PageFileSetting -Filter "SettingID='pagefile.sys @ $($driveInfo.Name.Substring(0,2))'"
320336

321-
if ($PageFile) {
337+
if ($PageFile)
338+
{
322339
$result = $false
323340
break
324341
}
325342

326343
$result = $true
327344
break
328345
}
329-
default {
346+
default
347+
{
330348
break
331349
}
332350
}

0 commit comments

Comments
 (0)