Skip to content

Commit 055319f

Browse files
authored
Merge pull request #643 from PlagueHO/Fix-Style
Fix style of hash tables
2 parents ea15160 + 5c3c73e commit 055319f

4 files changed

Lines changed: 112 additions & 97 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- Updated to meet HQRM style guidelines - Fixes [issue #623](https://github.com/PowerShell/PSDscResources/issues/623)
99
- Added MOF descriptions.
1010
- Corrected minor style issues.
11+
- Fix minor style issues in hashtable layout.
1112

1213
## 8.10.0.0
1314

DSCResources/MSFT_xMsiPackage/MSFT_xMsiPackage.psm1

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function Get-TargetResource
5252
if ($null -eq $productEntry)
5353
{
5454
$packageResourceResult = @{
55-
Ensure = 'Absent'
55+
Ensure = 'Absent'
5656
ProductId = $identifyingNumber
5757
}
5858

@@ -229,9 +229,9 @@ function Set-TargetResource
229229
if ($uri.IsUnc)
230230
{
231231
$psDriveArgs = @{
232-
Name = [System.Guid]::NewGuid()
232+
Name = [System.Guid]::NewGuid()
233233
PSProvider = 'FileSystem'
234-
Root = Split-Path -Path $localPath
234+
Root = Split-Path -Path $localPath
235235
}
236236

237237
if ($PSBoundParameters.ContainsKey('Credential'))
@@ -334,11 +334,14 @@ function Set-TargetResource
334334
Check if a reboot is required, if so notify CA. The MSFT_ServerManagerTasks provider is
335335
missing on some client SKUs (worked on both Server and Client Skus in Windows 10).
336336
#>
337-
$serverFeatureData = Invoke-CimMethod -Name 'GetServerFeature' `
338-
-Namespace 'root\microsoft\windows\servermanager' `
339-
-Class 'MSFT_ServerManagerTasks' `
340-
-Arguments @{ BatchSize = 256 } `
341-
-ErrorAction 'Ignore'
337+
$serverFeatureData = Invoke-CimMethod `
338+
-Name 'GetServerFeature' `
339+
-Namespace 'root\microsoft\windows\servermanager' `
340+
-Class 'MSFT_ServerManagerTasks' `
341+
-Arguments @{
342+
BatchSize = 256
343+
} `
344+
-ErrorAction 'Ignore'
342345

343346
$registryData = Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' -Name 'PendingFileRenameOperations' -ErrorAction 'Ignore'
344347

@@ -666,7 +669,7 @@ function Get-ProductEntryInfo
666669
{
667670
try
668671
{
669-
$installDate = '{0:d}' -f [System.DateTime]::ParseExact($installDate, 'yyyyMMdd',[System.Globalization.CultureInfo]::CurrentCulture).Date
672+
$installDate = '{0:d}' -f [System.DateTime]::ParseExact($installDate, 'yyyyMMdd', [System.Globalization.CultureInfo]::CurrentCulture).Date
670673
}
671674
catch
672675
{
@@ -692,13 +695,13 @@ function Get-ProductEntryInfo
692695
$installSource = Get-ProductEntryValue -ProductEntry $ProductEntry -Property 'InstallSource'
693696

694697
return @{
695-
Name = $displayName
696-
InstallSource = $installSource
697-
InstalledOn = $installDate
698-
Size = $estimatedSizeInMB
699-
Version = $displayVersion
698+
Name = $displayName
699+
InstallSource = $installSource
700+
InstalledOn = $installDate
701+
Size = $estimatedSizeInMB
702+
Version = $displayVersion
700703
PackageDescription = $comments
701-
Publisher = $publisher
704+
Publisher = $publisher
702705
}
703706
}
704707

@@ -823,7 +826,7 @@ function Get-WebRequestResponse
823826
}
824827
catch
825828
{
826-
New-InvalidOperationException -Message ($script:localizedData.CouldNotGetResponseFromWebRequest -f $uriScheme, $Uri.OriginalString) -ErrorRecord $_
829+
New-InvalidOperationException -Message ($script:localizedData.CouldNotGetResponseFromWebRequest -f $uriScheme, $Uri.OriginalString) -ErrorRecord $_
827830
}
828831
}
829832

@@ -1255,10 +1258,10 @@ function Invoke-PInvoke
12551258
[System.Int32] $exitCode = 0
12561259

12571260
$null = [Source.NativeMethods]::CreateProcessAsUser($CommandLine, `
1258-
$RunAsCredential.GetNetworkCredential().Domain, `
1259-
$RunAsCredential.GetNetworkCredential().UserName, `
1260-
$RunAsCredential.GetNetworkCredential().Password, `
1261-
[ref] $exitCode
1261+
$RunAsCredential.GetNetworkCredential().Domain, `
1262+
$RunAsCredential.GetNetworkCredential().UserName, `
1263+
$RunAsCredential.GetNetworkCredential().Password, `
1264+
[ref] $exitCode
12621265
)
12631266

12641267
return $exitCode

DSCResources/MSFT_xPackageResource/MSFT_xPackageResource.psm1

Lines changed: 52 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@ function Get-TargetResource
7272
$packageResourceResult = @{}
7373

7474
$getProductEntryParameters = @{
75-
Name = $Name
75+
Name = $Name
7676
IdentifyingNumber = $identifyingNumber
7777
}
7878

7979
$checkRegistryValueParameters = @{
80-
CreateCheckRegValue = $CreateCheckRegValue
81-
InstalledCheckRegHive = $InstalledCheckRegHive
82-
InstalledCheckRegKey = $InstalledCheckRegKey
80+
CreateCheckRegValue = $CreateCheckRegValue
81+
InstalledCheckRegHive = $InstalledCheckRegHive
82+
InstalledCheckRegKey = $InstalledCheckRegKey
8383
InstalledCheckRegValueName = $InstalledCheckRegValueName
8484
InstalledCheckRegValueData = $InstalledCheckRegValueData
8585
}
@@ -97,10 +97,10 @@ function Get-TargetResource
9797
if ($null -eq $productEntry)
9898
{
9999
$packageResourceResult += @{
100-
Ensure = 'Absent'
101-
Name = $Name
100+
Ensure = 'Absent'
101+
Name = $Name
102102
ProductId = $identifyingNumber
103-
Path = $Path
103+
Path = $Path
104104
Installed = $false
105105
}
106106

@@ -109,10 +109,10 @@ function Get-TargetResource
109109
elseif ($CreateCheckRegValue)
110110
{
111111
$packageResourceResult += @{
112-
Ensure = 'Present'
113-
Name = $Name
112+
Ensure = 'Present'
113+
Name = $Name
114114
ProductId = $identifyingNumber
115-
Path = $Path
115+
Path = $Path
116116
Installed = $true
117117
}
118118

@@ -134,7 +134,7 @@ function Get-TargetResource
134134
{
135135
try
136136
{
137-
$installDate = '{0:d}' -f [System.DateTime]::ParseExact($installDate, 'yyyyMMdd',[System.Globalization.CultureInfo]::CurrentCulture).Date
137+
$installDate = '{0:d}' -f [System.DateTime]::ParseExact($installDate, 'yyyyMMdd', [System.Globalization.CultureInfo]::CurrentCulture).Date
138138
}
139139
catch
140140
{
@@ -158,16 +158,16 @@ function Get-TargetResource
158158
$displayName = Get-LocalizedRegistryKeyValue -RegistryKey $productEntry -ValueName 'DisplayName'
159159

160160
$packageResourceResult += @{
161-
Ensure = 'Present'
162-
Name = $displayName
163-
Path = $Path
164-
InstalledOn = $installDate
165-
ProductId = $identifyingNumber
166-
Size = $estimatedSize
167-
Installed = $true
168-
Version = $displayVersion
161+
Ensure = 'Present'
162+
Name = $displayName
163+
Path = $Path
164+
InstalledOn = $installDate
165+
ProductId = $identifyingNumber
166+
Size = $estimatedSize
167+
Installed = $true
168+
Version = $displayVersion
169169
PackageDescription = $comments
170-
Publisher = $publisher
170+
Publisher = $publisher
171171
}
172172

173173
return $packageResourceResult
@@ -344,9 +344,9 @@ function Set-TargetResource
344344
if ($uri.IsUnc -and $PSCmdlet.ShouldProcess($script:localizedData.MountSharePath, $null, $null))
345345
{
346346
$psDriveArgs = @{
347-
Name = [System.Guid]::NewGuid()
347+
Name = [System.Guid]::NewGuid()
348348
PSProvider = 'FileSystem'
349-
Root = Split-Path -Path $uri.LocalPath
349+
Root = Split-Path -Path $uri.LocalPath
350350
}
351351

352352
# If we pass a null for Credential, a dialog will pop up.
@@ -414,8 +414,8 @@ function Set-TargetResource
414414
}
415415
catch
416416
{
417-
Write-Verbose -Message ($script:localizedData.ErrorOutString -f ($_ | Out-String))
418-
New-InvalidOperationException -Message ($script:localizedData.CouldNotGetHttpStream -f $uriScheme, $Path) -ErrorRecord $_
417+
Write-Verbose -Message ($script:localizedData.ErrorOutString -f ($_ | Out-String))
418+
New-InvalidOperationException -Message ($script:localizedData.CouldNotGetHttpStream -f $uriScheme, $Path) -ErrorRecord $_
419419
}
420420

421421
try
@@ -576,8 +576,8 @@ function Set-TargetResource
576576
}
577577
else
578578
{
579-
$process = Invoke-Process -Process $process -LogStream ($null -ne $logStream)
580-
$exitCode = $process.ExitCode
579+
$process = Invoke-Process -Process $process -LogStream ($null -ne $logStream)
580+
$exitCode = $process.ExitCode
581581
}
582582
}
583583
catch
@@ -669,8 +669,18 @@ function Set-TargetResource
669669
missing on some client SKUs (worked on both Server and Client Skus in Windows 10).
670670
#>
671671

672-
$serverFeatureData = Invoke-CimMethod -Name 'GetServerFeature' -Namespace 'root\microsoft\windows\servermanager' -Class 'MSFT_ServerManagerTasks' -Arguments @{ BatchSize = 256 } -ErrorAction 'Ignore'
673-
$registryData = Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' -Name 'PendingFileRenameOperations' -ErrorAction 'Ignore'
672+
$serverFeatureData = Invoke-CimMethod `
673+
-Name 'GetServerFeature' `
674+
-Namespace 'root\microsoft\windows\servermanager' `
675+
-Class 'MSFT_ServerManagerTasks' `
676+
-Arguments @{
677+
BatchSize = 256
678+
} `
679+
-ErrorAction 'Ignore'
680+
$registryData = Get-ItemProperty `
681+
-Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' `
682+
-Name 'PendingFileRenameOperations' `
683+
-ErrorAction 'Ignore'
674684

675685
if (($serverFeatureData -and $serverFeatureData.RequiresReboot) -or $registryData -or $exitcode -eq 3010 -or $exitcode -eq 1641)
676686
{
@@ -687,14 +697,14 @@ function Set-TargetResource
687697
elseif ($Ensure -eq 'Present')
688698
{
689699
$getProductEntryParameters = @{
690-
Name = $Name
700+
Name = $Name
691701
IdentifyingNumber = $identifyingNumber
692702
}
693703

694704
$checkRegistryValueParameters = @{
695-
CreateCheckRegValue = $CreateCheckRegValue
696-
InstalledCheckRegHive = $InstalledCheckRegHive
697-
InstalledCheckRegKey = $InstalledCheckRegKey
705+
CreateCheckRegValue = $CreateCheckRegValue
706+
InstalledCheckRegHive = $InstalledCheckRegHive
707+
InstalledCheckRegKey = $InstalledCheckRegKey
698708
InstalledCheckRegValueName = $InstalledCheckRegValueName
699709
InstalledCheckRegValueData = $InstalledCheckRegValueData
700710
}
@@ -821,14 +831,14 @@ function Test-TargetResource
821831
}
822832

823833
$getProductEntryParameters = @{
824-
Name = $Name
834+
Name = $Name
825835
IdentifyingNumber = $identifyingNumber
826836
}
827837

828838
$checkRegistryValueParameters = @{
829-
CreateCheckRegValue = $CreateCheckRegValue
830-
InstalledCheckRegHive = $InstalledCheckRegHive
831-
InstalledCheckRegKey = $InstalledCheckRegKey
839+
CreateCheckRegValue = $CreateCheckRegValue
840+
InstalledCheckRegHive = $InstalledCheckRegHive
841+
InstalledCheckRegKey = $InstalledCheckRegKey
832842
InstalledCheckRegValueName = $InstalledCheckRegValueName
833843
InstalledCheckRegValueData = $InstalledCheckRegValueData
834844
}
@@ -1198,7 +1208,7 @@ function Get-RegistryValueWithErrorsIgnored
11981208
try
11991209
{
12001210
$baseRegistryKey = [Microsoft.Win32.RegistryKey]::OpenBaseKey($RegistryHive, $RegistryView)
1201-
$subRegistryKey = $baseRegistryKey.OpenSubKey($Key)
1211+
$subRegistryKey = $baseRegistryKey.OpenSubKey($Key)
12021212

12031213
if ($null -ne $subRegistryKey)
12041214
{
@@ -1566,10 +1576,10 @@ function Invoke-PInvoke
15661576
[System.Int32] $exitCode = 0
15671577

15681578
[Source.NativeMethods]::CreateProcessAsUser($CommandLine, `
1569-
$Credential.GetNetworkCredential().Domain, `
1570-
$Credential.GetNetworkCredential().UserName, `
1571-
$Credential.GetNetworkCredential().Password, `
1572-
[ref] $exitCode
1579+
$Credential.GetNetworkCredential().Domain, `
1580+
$Credential.GetNetworkCredential().UserName, `
1581+
$Credential.GetNetworkCredential().Password, `
1582+
[ref] $exitCode
15731583
)
15741584

15751585
return $exitCode;
@@ -1710,7 +1720,7 @@ function Remove-RegistryValue
17101720
{
17111721
$baseRegistryKey = [Microsoft.Win32.RegistryKey]::OpenBaseKey($RegistryHive, [Microsoft.Win32.RegistryView]::Default)
17121722

1713-
$subRegistryKey = $baseRegistryKey.OpenSubKey($Key, $true)
1723+
$subRegistryKey = $baseRegistryKey.OpenSubKey($Key, $true)
17141724
$subRegistryKey.DeleteValue($Value)
17151725
$subRegistryKey.Close()
17161726
}

0 commit comments

Comments
 (0)