Author Posts

September 5, 2016 at 1:35 pm

I've enclosed two registry 'splats' inside an array. I really like the way it looks.

Although it works fine, is it best practice ?

# New build tattoo Registry Settings in Array     
$nestedRegKeys = @(
    # Registry Value 1 Splatted
    @{    
        Path  = $path
        name  = "Task Sequence"
        Value = '$TSeq'
     }
    # Registry Value 2 Splatted
    @{ 
        Path  = $path
        name  = "Build Completed"
        Value = $(Get-Date -Format s)
     }
)

# Run in new keys
$nestedRegKeys | foreach { New-ItemProperty @_ -Force }

September 5, 2016 at 3:09 pm

Seems fine to me. Looks a lot like DSC configuration data.

September 5, 2016 at 9:45 pm

Funky..but heck why not?😀

September 6, 2016 at 12:30 am

I don't see a different between this method and storing the data in an xml file and importing the xml doing the foreach against that data structure.

September 6, 2016 at 6:18 am

That's a cool idea Jonathan using XML to parse in registry keys !
Just cool to experiment with different styles of powershell code. Nice to be different ! ☺