is a module used to streamline the installation of Windows applications.
It includes a Redstone class, which is the core building block for the included functions.
It is designed to be lightweight and easy to deploy.
While I use MECM for my CM tool, you should be able to use PSRedstone with whatever tool you choose.
Why did I name this module Redstone? It should go without saying that I'm a fan of Minecraft. The simplicity of the game and how far you can push things into automation, even without any mods, is quite enthralling. Obviously, mining redstone is the first step to building more elaborate creations in Minecraft. I believe that using PSRedstone will be a good first step to building more elaborate, yet simple, deployment packages.
Start with a settings.json file and a very basic configuration:
{
"Publisher": "Mozilla",
"Product": "Firefox RR",
"Version": "1.2.3",
"Installer": {
"UserName": "VertigoRay",
"CompanyName": "PSRedstone & Co.",
"SerialNumber": "bfa7409e-485c-45cf-bd42-1652c2c84e17"
}
}ℹ: The version should be injected/updated via automated processes, but we statically defined it for this example.
You just need a Redstone Block ( ͡° ͜ʖ ͡°) at the top of your script to use the module:
#region Redstone Block
#Requires -Modules PSRedstone
$redstone, $settings = New-Redstone
#endregion Redstone BlockUsing that, we can create a simple install.ps1 for the installer:
<#
MECM Install Command:
powershell.exe -Exe Bypass -Win Hidden -NoP -NonI -File install.ps1
#>
#Requires -Modules PSRedstone
$redstone, $settings = New-Redstone
Write-Information ('{3}ing {0} {1} {2} ...' -f $redstone.Publisher, $redstone.Product, $redstone.Version, (Get-Culture).TextInfo.ToTitleCase($redstone.Action))
$invokeMSI = @{
'Action' = 'Install'
# Obviously, Firefox doesn't require these advanced install options.
# This is just for show ...
'Parameters' = @(
"USERNAME=`"$($settings.Installer.UserName)`"",
"COMPANYNAME=`"$($settings.Installer.CompanyName)`"",
"SERIALNUMBER=`"$($settings.Installer.SerialNumber)`""
)
}
if ([System.Environment]::Is64BitOperatingSystem) {
Invoke-RedstoneMsi @invokeMSI -Path 'FirefoxSetup32and64Bit.msi'
} else {
Invoke-RedstoneMsi @invokeMSI -Path 'FirefoxSetup32Bit.msi'
}ℹ: Redstone will automatically parse the
settings.jsonfile, because it exists. Thesettings.jsondata is in the class, but we create you a$settingsvariable as well.
$Redstone.Publisher: taken directly from the root key in thesettings.json.$Redstone.Product: taken directly from the root key in thesettings.json.$Redstone.Version: taken directly from the root key in thesettings.json; this would normally be injected into the file during the set up of the MECM Package Source files.$Redstone.Action: taken directly from the filename of the script; in this case the Action is"install"taken frominstall.ps1.
- We use
Get-Cultureto capitalize the first letter and make it"Install".Given the above details, the output of
Write-Informationwill be:Installing Mozilla Firefox RR 1.2.3 ...The
Invoke-RedstoneMsiwill call themsiexecsilently by default and provide a standardized location for the MSI log file underC:\Windows\Logs.
The goal has been achieved: a simplified install script with predictable results.
ℹ: Check out the Advanced Start wiki for more assistance getting started.