Skip to content

Instantly share code, notes, and snippets.

@bateskevin
Created February 10, 2020 07:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bateskevin/ad7640d3ce95b8bbeb87dc3e1dd2014d to your computer and use it in GitHub Desktop.
Save bateskevin/ad7640d3ce95b8bbeb87dc3e1dd2014d to your computer and use it in GitHub Desktop.
Demo code for splatting problem
$SplatParam = @()
$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.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.Property = $Properties2
$SplatParam += $Param2
$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