I'm brand new to PowerShell and SCCM but have been working to build my own frontend/GUI for SCCM's Operating System Deployment features in the Task Sequence Wizard inside of WinPE for my company. I wanted something elegant that was easy to implement and didn't require a lot of dependencies/libraries, but that was easy to customize and expand, and aesthetics were important too. That's why I decided to use XAML to utilize a WPF visual application and integrate it with PowerShell by reading the XAML into PowerShell and creating object variables for each object inside the XAML.The end result looks like this:
If any of you are interested in using this as a frontend or at least starting with it in your environment, please let me know and I'll provide anything I can to help you tailor it to your needs. I'm also open to suggestions from much more experienced users on ways to improve this.
In WinPE boot image:
-.NET Framework add-in
-PowerShell CmdLets add-in
That's really it!
Implementing the menu:
To implement the menu, simply add a new "Run PowerShell Script" step at the beginning of your Task Sequence and point it to the attached PowerShell ps1 file in this post. You may want to put it in a package and reference the package. The only other step is setting Task Sequence Variable conditions on each of your other steps that correspond with the variable names inside of the PowerShell script. The currently created task sequence variables are all defined in one section at the end of the code so you can change them/review them as needed to fit your environment. Here's a list of the current Task Sequence Variable declarations that correspond to the items you see in the above menu example:
$TSEnv.Value("OSDComputerName") = $HostNameBox.Text
$TSEnv.Value("ApplyBIOSSettings") = $BIOSCheckBox.IsChecked
$TSEnv.Value("EnableBitLocker") = $BitLockerCheckBox.IsChecked
$TSEnv.Value("SendDeploymentEmail") = $SendEmailCheckBox.IsChecked
$TSEnv.Value("InstallVPN") = $VPNCheckBox.IsChecked
$TSEnv.Value("InstallFlash") = $FlashCheckBox.IsChecked
$TSEnv.Value("InstallReader") = $ReaderCheckBox.IsChecked
$TSEnv.Value("InstallJava") = $JavaCheckBox.IsChecked
$TSEnv.Value("InstallBloomberg") = $BloombergCheckBox.IsChecked
$TSEnv.Value("InstallAcctSys") = $AcctSysCheckBox.IsChecked
$TSEnv.Value("InstallMarketAxess") = $MarketAxessCheckBox.IsChecked
$TSEnv.Value("InstallTradeweb") = $TradewebCheckBox.IsChecked
Customizing it for yourself:
The entirety of the graphical element of this menu is simply a here-string of XAML stored in one variable!! To make changes to the graphical components of this menu, you can simply open the XAML contained in the $InputXAML variable into Visual Studio and design away. Simply paste your updated XAML code from Visual Studio back into the PowerShell script file between the @" "@ symbols of $InputXAML and you're ready to go!. Keep in mind, if you add new objects and controls to the XAML, such as a new CheckBox, drop-down, etc, you'll want to make sure to create a corresponding task sequence variable at the end of the script to set a TS variable to hold the user selected option for that control.
If you add a new XAML check box and name it "CheckBox1", like so:
<CheckBox x:Name="CheckBox1" Content="CheckBox1 Label Here"/>
You'll want to create a new Task Sequence variable to hold the result of that checkbox object, like so:
$TSEnv.Value("CheckBox1WasChecked") = $CheckBox1.IsChecked
Now you can reference "CheckBox1WasChecked" within your task sequence to determine whether or not to run a certain step!
Let me know what you think!
**NOTE** To test the appearance of the menu and interact with it, you can simply run the PowerShell file and it will work just fine (aside from a few initial errors returned from the PS console if you're outside of a task sequence environment, such as on your desktop). If you click the "Exit" button though, it will restart your computer!! So right-click on the taskbar icon for the app and click "Close" instead of using the button. I removed the window border and normal window buttons (close, minimize, etc) because I thought the borderless made more sense for a task sequence environment and looked sleeker with a customized company logo wallpaper.
The script file is attached in the ZIP below: