Monthly Archives: October 2017

  • 0

Splatting To #PowerShell Job

Category : Uncategorized

A while back I found a smart way to pass parameter to scripts in PowerShell background jobs.

Initially I was driven by the ambition to use Splatting and my first attempt looked like this:

It works, but in my view that approach reduces Splatting to absurdity. Therefore I continued trying different approaches and finally ended up with this surprisingly easy result:

If you like to use this approach please take into account:
– You need to pipe a PSCustomObject to Start-Job (rather than a hash table)
– For each parameter the Job script needs ValueFromPipelineByPropertyName set to $true such as below:

Hope this helps


  • 0

Update Password in Unattend.xml #PowerShell

Category : Uncategorized

Today I share a small PowerShell function that helps to update/change the password in an Unattend.xml file. This might be useful in case you have to meet a strict password changing policy in your company.

Update-UnattendXmlPassword

The function suppports both, plain-text and, more particularly, base64 encoded passwords. The function reads the given unattend.xml file and alters the value element of the section below:

Please note that the file will overwrite the original file w/o asking for confirmation!

By the way, my Base64 PowerShell Module helps to convert from / to base64 encoded strings.