Jump to content


taylorblakeharris

Established Members
  • Content Count

    5
  • Joined

  • Last visited

Community Reputation

1 Neutral

About taylorblakeharris

  • Rank
    Newbie

Recent Profile Visitors

498 profile views
  1. That's a good idea. I'm just going to do a "run command line" step that runs only if ExitTaskSequence notequals "false" that runs a batch file displaying a WShell popup saying that the menu exited incorrectly and then running a fake command at the end that will throw an "incorrect function" error. Good idea. Thanks.
  2. Oh wow that's cool.... I didn't even consider that. It's kind of a big deal I get it working because if for some reason connecting to the network share with the image fails, the powershell script will not launch the menu and the task sequence step will therefore complete and move on to the next which is partitioning the hard drive! Hopefully most of my colleagues that will be using this know before they select the task sequence that they want to wipe the drive but I have a warning/confirmation in the menu anyways, just in case.
  3. I have a question about an issue I've been having with task sequence variables.... I have multiple PowerShell scripts throughout my task sequence that both create TS variables and retrieve them, and all of them work just fine, except for one PowerShell script that I am running with a specified service account instead of the default. Is there any reason that running a script as a different user would affect the ability to interact with the variables in the task sequence environment? I have scripts in the early phases of the sequence in WinPE that set variables and scripts at the end after being booted into the new Windows install and all the variables are working fine. It's just the one script run as a service account that can't seem to create or read TS variables. Any advice? In the meantime, I'm having to write results of the code to a file on C:\ and read the results back in! Very messy...
  4. That's intellectual property for you!! I started looking at HTA's initially but they're too messy for me... I'm also not much of an HTML person either and I couldn't find any good software for designing the HTML interface that I could find directly compatible with an HTA "document" so I just went with Visual Studio for designing the interface and copied and pasted the code into a single variable in PowerShell and with .NET loaded, that's all you need! No other files, or libraries, or scripts or assemblies necessary. just one, compact PS1 file you can throw into a task sequence step. The only thing I'm trying to figure out is how to use relative paths to resources, like a JPG for a logo, for example, inside of the XAML. If I put an absolute path to a logo file on a mapped network drive, and map the drive just before the script step runs for the menu in the task sequence, the logo will show up. But I can't put a relative path in the img source field of the XML. It won't work. If I put the PNG file in the same package as the script and set the image source as 'logo.png' or '/logo.png' I can't get the image to show up. Any ideas?
  5. Hello everyone! 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. Requirements: 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. For example: 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: DeploymentMenu.zip
×
×
  • Create New...