Last active
February 24, 2020 11:22
-
-
Save bateskevin/c0bb0ce33047d9a9b2c13bb5b0850a6a to your computer and use it in GitHub Desktop.
Demo code for splatting problem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Array for Hashtables that are going to be passed to Invoke-DSCResource | |
$SplatParam = @() | |
#Defining Hashtables | |
$Param1 = @{} | |
$Properties1 = @{} | |
$Properties1.ValueName = "EnumerateAdministrators" | |
$Properties1.Key = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\CredUI\EnumerateAdministrators" | |
$Properties1.ValueType = "Dword" | |
$Properties1.ValueData = 0 | |
$Param1.Name = "Registry" | |
$Param1.Method = "Test" | |
$Param1.ModuleName = "PSDesiredStateConfiguration" | |
$Param1.Property = $Properties1 | |
$SplatParam += $Param1 | |
$Param2 = @{} | |
$Properties2 = @{} | |
$Properties2.ValueName = "NoAutorun" | |
$Properties2.Key = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoAutorun" | |
$Properties2.ValueType = "Dword" | |
$Properties2.ValueData = 1 | |
$Param2.Name = "Registry" | |
$Param2.Method = "Test" | |
$Param2.ModuleName = "PSDesiredStateConfiguration" | |
$Param2.Property = $Properties2 | |
$SplatParam += $Param2 | |
#Slatting | |
$SplatParam | Foreach-Object -Parallel { | |
Invoke-DscResource @_ | |
} -Throttlelimit 5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment