PowerShell OSD Frontend 2.0!

I have made fairly constant updates to my original OSD Frontend and I found it time to share among the community again. I had hoped to make this available a few months ago but wanted something a little more polished and a little less clunky than my first release.

FrontEnd1

As I played (and learned!) more with Windows Forms I made it a goal to be functional but also try out as many different aspects as I could. Progress bars, combo boxes, text colors, etc. You will see some of this playing around in the new updates I have.

Tabs!

 

The biggest addition in my opinion is definitely the tabs! No more pop-up windows or loss of screen real estate when you need to do something.

FrontEnd2

FrontEnd3

Tooltips

 

Another very useful feature is tooltips on the majority of the buttons and fields. These add a pop-up that appears when you hover the mouse over a certain text area or button.

Tooltip1Tooltip2

Other functionality

 

  • Customizable logo and icon (just replace OSDLogo.png and Powershell.ico)
  • Management of ConfigMgr unknown computer records, delete records, search for records, and show task sequence deployments (my personal favorite, showing the list of deployments before you click continue is a major time-saver. Until the product team hopefully adds that functionality.)
  • Bullet list as needed
  • Drop down to choose timezone
  • Format disk utility
  • Migration support
    • Specify computer name to migrate from (can be used for side by side migration, application mapping, etc)
    • Specify user name to migrate from (can be used for side by side migration, User-Device affinity, etc)
    • Specify user to add to local admin
  • Button to quickly open smsts.log with CMTrace (a favorite among our techs)
  • Stand-alone media support (not sure why these two cause the Frontend to freeze for SA media, but they do)
    • AD prompt to authenticate is skipped
    • Confirmation prompt is skipped
  • Button to restart the computer
  • Confirmation prompt after clicking continue

FrontEnd4

Script improvements

 

This time around I made some improvements to the script to make it more usable.

  • Modular functions, easily enable/disable features by commenting out the call to the function

  • Most sections commented for basic functionality
  • Attached readme.txt for reference

Requirements

 

  • WinPE 4.0+
  • PowerShell 3.0+
  • .NET Framework 4.0+
  • Just check the below boxes on your boot image to add this functionality

BootImage2

Files

 

Full script: FrontEnd_2.0.zip

 

68 thoughts on “PowerShell OSD Frontend 2.0!

  1. Earthcoder

    Very good script Tested on our system and works fine, but im not sure how to get Text Files into TSvars to use them in the task sequence

    Im using SCCM 2012R2 there is a Run Powershell Script option in Task sequence do i use this and if so how.

    • Thanks! You can use a run PowerShell script task, I prefer Run Command Line. Check out the original OSD Frontend, it goes over reading in the text files and converting them to task sequence variables.

      • Earthcoder

        many Thanks I worked it out using Run command line.
        using:

        powershell.exe -executionpolicy bypass -command “”

        Seems to work ok.
        I did come across problems using this, as i was using ” marks for names like you have in other version $tsenv.Value(“OSDComputerName”) = $compname
        soon as i changed them to ‘ makrs it worked fine.

  2. Earthcoder

    is there a way of running it from server unC path, instead of adding to pre-command on boot disk, so then i can edit the Powershell without re-creating Bootimage everytime there is a change?

    e.g.
    powershell.exe -executionpolicy bypass -windowstyle hidden -file frontend.ps1

    can it be
    powershell.exe -executionpolicy bypass -windowstyle hidden -file \\serversccm\scripts\frontend.ps1

    • Calling a file from a UNC path will not work with powershell.exe but you could use the -command switch and map a drive first. I just tested it in WinPE and it works, just prompts for credentials, which you could also specify if you like. You will have to weigh the risk yourself.

      powershell.exe -executionpolicy bypass -command “& {net use z: \\server\share; z:\frontend.ps1}”

  3. chris

    Hello

    Still using your form and very good, But got a question

    I have now added to Task Sequence instead of the boot cd.

    when i run task sequence it brings up the form but i am unable to click continue

    i have changed code a little
    Removed Get creds pop up at start

    and changed button code too
    [code]
    $ContButton.Add_Click({
    #Gather computer name
    $computername=$objTextBox.Text
    $ownersname =$objOwnerBox.Text
    #Gather Bulleted list choices
    $global:blchoice = “Computer”

    If ($global:blcheck2.Checked) {
    $global:blchoice = “Laptop”
    }
    If ($global:blcheck3.Checked) {
    $global:blchoice = “Choice3”
    }
    If ($global:blcheck4.Checked) {
    $global:blchoice = “Choice4”
    }

    #Gather TimeZone choices
    If ($global:tzcombobox.SelectedItem -ne $null) {
    $global:tzchoice = $global:tzcombobox.SelectedItem.ToString()
    } else {
    $global:tzchoice = “Eastern”
    }

    #If confirm is YES, save all choices to .txt files
    $computername.toupper() | out-file c:\computername.txt
    $ownersname.toupper() | out-file c:\OwnersName.txt
    $username.toupper() | out-file c:\username.txt
    $global:blchoice.ToUpper() | Out-File c:\bulletlist.txt
    $global:tzchoice.ToUpper() | Out-File c:\timezone.txt
    $objForm.Close()

    })
    $objForm.Controls.Add($ContButton)

    $objForm.Add_Shown({$objForm.Activate()})
    [void] $objForm.ShowDialog()
    [/code]

    so it will write the code to the c: drive on the machine im imaging then the task sequence will collect the data from here.

    but the button just wont click.

    • Hey chris, your code looks good. If you click the Continue button and nothing is happening you may have to compare the rest of your code to see if you have a syntax error, an unclosed parenthesis/bracket or something like that. The $objform.close should be closing the FrontEnd when you click the button.

      A good way to test would be boot up to WinPE, hit F8 and call your script manually from x:\sms\pkgs\SMS10000 and see if you get any errors when you click Continue that way.

      • chris

        if i test the code via powershell from bootcd when i click button it closes the form and adds the files, but if i do it via a task sequence to run the script the button does not work.

        im guessing you can run ftom task sequence

        • You should be able to. I have not personally tested it though. What command are you running to call the script from the task sequence?

          • chris

            powershell.exe -executionpolicy bypass -windowstyle hidden -file frontend.ps1

            as i test i just changed it to Close and worked fine. must be 1 line of code somwhere ill keep debugging

  4. Lucas

    Any chance you will be adding options to select OU?

    • This has actually been a long standing request. WinPE has very limited options for LDAP queries and AD authentication.

      I am however working on it though! I am using Orchestrator to do the heavy lifting and SCOJobRunner to call the run book. I hope to have something functional in the next month or two and will definitely add it to the next FrontEnd release.

      • Don Lynch

        Code I used with your script to add computer to OU

        [array]$DropDownArray = “Orlando”, “Grand Prairie”

        function Return-DropDown {
        $script:Choice = $global:sourcecompbox.SelectedItem.ToString()
        $Form.Close()
        }

        function selectProfile {
        $sourcecomptxt = New-Object System.Windows.Forms.Label
        $sourcecomptxt.Location = New-Object System.Drawing.Size(5,20)
        $sourcecomptxt.Size = New-Object System.Drawing.Size(100,15)
        $sourcecomptxt.Font = New-Object System.Drawing.Font(“Arial”,8,[System.Drawing.FontStyle]::Bold)
        $sourcecomptxt.Text = “Location:”
        $DataTab.Controls.Add($sourcecomptxt)

        $global:sourcecompbox = new-object System.Windows.Forms.ComboBox
        $global:sourcecompbox.Location = New-Object System.Drawing.Size(105,17)
        $global:sourcecompbox.Size = New-Object System.Drawing.Size(130,20)
        $global:sourcecompbox.MaxLength = 15
        $DataTab.Controls.Add($global:sourcecompbox)

        $sourcecompdesc = New-Object System.Windows.Forms.Label
        $sourcecompdesc.Location = New-Object System.Drawing.Size(240,20)
        $sourcecompdesc.Size = New-Object System.Drawing.Size(500,20)
        $sourcecompdesc.Text = “- Please select a Location for the computer”
        $DataTab.Controls.Add($sourcecompdesc)

        ForEach ($Item in $DropDownArray) {
        [void] $global:sourcecompbox.Items.Add($Item)
        }

        $Form.Controls.Add($DropDown)

        $DropDownLabel = new-object System.Windows.Forms.Label
        $DropDownLabel.Location = new-object System.Drawing.Size(10,10)
        $DropDownLabel.size = new-object System.Drawing.Size(150,40)
        $DropDownLabel.Text = “Select Profile”
        $Form.Controls.Add($DropDownLabel)

        $Button = new-object System.Windows.Forms.Button
        $Button.Location = new-object System.Drawing.Size(100,50)
        $Button.Size = new-object System.Drawing.Size(125,20)
        $Button.Text = “Select a Profile”
        $Button.Add_Click({Return-DropDown})
        $form.Controls.Add($Button)

        $Form.Add_Shown({$Form.Activate()})
        [void] $Form.ShowDialog()

        return $script:choice

        }

        $DataTab.Controls.Add($DataButton)

        Clear-Host

        $ou = selectProfile

        $validate = $false
        if ($ou -eq “” -or $ou -eq “Orlando”) { $ou = “OU=Workstations_Win7,OU=OR,OU=US,OU=NA,DC=cqb,DC=chiknet,DC=com”; $validate = $true }
        if ($ou -eq “Grand Prairie”) { $ou = “OU=Workstations_Win7,OU=GP,OU=US,OU=NA,DC=cqb,DC=chiknet,DC=com”; $validate = $true }
        if ($ou -eq “3”) { $ou = “OU=Computers,OU=Sydney,DC=your,DC=domain,DC=here”; $validate = $true }
        if ($ou -eq “4”) { $ou = “OU=Computers,OU=Toronto,DC=your,DC=domain,DC=here”; $validate = $true }

        $credentials = New-Object System.Management.Automation.PsCredential(“”, (ConvertTo-SecureString “” -AsPlainText -Force))
        Write-Host “Adding $computername to the domain”
        Add-Computer -DomainName “cqb.chiknet.com” -Credential $credentials -OUPath $ou

  5. […] very specific features that are important to understand and it comes with a general disclaimer. It lacks a lot of the features that Daniel’s has but is a good start. If you were a TechEd 2014 in Houston this year, you may have seen a similar […]

  6. Interested

    Just stumbled across this and I’m putting into test as we speak. I do have one question though…How can I restrict who can logon? The way its set now is that anyone with AD credentials can get to the frontend. I would like to restrict it to specific security groups of possible.

  7. Still Interested

    One more question – I have everything working except the Show Deployments button. I know the account I’m using is missing some permission in SCCM but I can’t narrrow it down. If I run the script as a full admin then it works. Thanks for the script – It’s so much better than what we had before.

    • Still

      Scratch that last comment. I was over thinking the issue. It is working great now.

  8. Nathan

    So I’m trying to get going. For some reason I can’t get the variables in the TS to populate.

    So, the front end pops up, but from what I can tell, its not storing any variables after the wizard.

    Is there something im missing? thanks in advance.

  9. Nathan

    If I understand correctly, the script is supposed to store its variables in the text files on the root of the script folder…

    I created the blank text files hoping to see them populate but am not seeing that.

    is the wizard supposed to create those text files ?

    I am also not seeing that. Any help would me much appreciated.

  10. Nathan

    Upon further inspection just seems like the front end is not outputting the text files into the script folder., Any tips would be appreciated…

    • Hmm, are you checking x:\sms\pkg\sms10000? You might try hitting F8 and manually running the FrontEnd so you get the output of any errors, etc.

      Version 3.0 is almost ready and a huge win is that is writes directly to the SMSTS variables, so no more text files!

      • Nathan

        Thanks for your rapid reply Daniel! I can’t wait for version 3!

        So when i check the sms10000 folder i just dont see the text files created…

        a caveat is that I’m using MDT boot media for this within config mgr, and not the built in SCCM boot media.

        Shouldn’t matter. I’ll keep playing around and let you know.

        Looking forward to version 3!

        • All our boot images are MDT as well. The files get created after you click Continue, so make sure you are moving past the FrontEnd before checking for them.

          If there are no errors in the UI, and everything else is functional I would definitely try to open it manually using the cmd prompt. See what errors are thrown.

          • Nathan

            sound like a plan I will give that a try. I appreciate it.

  11. Nathan

    so looks like the problem i was having was specifying the boot media files twice!

    so, within the sccm console on the actual boot media, AND when creating the boot media files.

    so when creating the boot media iso, i just add the prestrart command and leave out the packge and that does the trick. I now see the text files writing

    i EAGERLY await version 3!

  12. Thank you for all your work on this! Do you have a beta/test frontend? Maybe we (community) can collaborate on your awesome project!

    • Glad to help Jose. I don’t have anything shared or sourced. I have had a few people request something on say github and placed like that. I will think about it for version 3.0!

  13. Nathan

    so, having an issue. Was wondering what you suggested. For some reason the script is not creating the text files when called via the prestart command. However if I pull up f8 and call the script manually it creates them just fine. Any suggestions? Thanks and appreciate the help.

    • How are you calling the frontend.ps1 within the task sequence? Is it MDT or SCCM?

      I had similar issues but I ended up creating 3 command line task sequences

      1st copy down the frontend to x:\frontend and required files
      2nd set execution policy
      3rd to finally launch x:\frontend\frontend.ps1

      Maybe this was a round about way but it worked for me since I had added other changes to the frontend.ps1 and prereq files.

      • Nathan

        so, its an SCCM TS, MDT Integrated, with MDT Boot Media.

        I am calling it via a prestart command in the boot media.

        I am specifying the files in the boot image and the command.

        Then again specifying the prestart command in the Boot iso while leaving out the files.

        Not creating the text files currently.

    • A quick test would be to mimic exactly what the pre-start command is doing. This way you can see any errors thrown.

      1. F8 to open cmd prompt
      2. Change directory to X:\SMS\PKG\SMS10000
      3. Call PowerShell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -File FrontEnd.ps1

      • Nathan

        So I’m actually able to pull up F8, and change to the SMS10000 Directory
        and call the frontend with the PowerShell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -File FrontEnd.ps1

        it works.

        But I am not able to get it to create the text files via the prestart.

        • You mentioned above you are specifying the pre-start command in both your boot image and boot media. I would take it out of the boot media, and just do the boot image. See if that makes a difference.

          You can also check your smsts.log to see if any errors are thrown there, but it doesn’t usually.

          • Nathan

            Ok I’ll try that. Cheers

  14. Nathan

    ok so I specified the source UNC folder in the boot image and the prestart command.

    i build the boot iso without specifying anything additional and it is now creating the text files again….

    Thanks alot for the suggestions.

    Eagerly awaiting version 3 BTW! 🙂

  15. Jaime Robledo

    I’m currently working with a client with no configmgr and they want to use MDT. will this process work for MDT 2013

    • As long as you have .NET and PowerShell added to your boot image it should work. The ConfigMgr pieces obviously wont work, but everything else should!

  16. Arovbukay

    Hi Daniel, was v3.0 released?

  17. Twp

    How is it going with version 3.0?

    I do not understand why you are using text files that are saved on X: \ … and then reads out the variables using the standalone PS script. Would it not be easier and more convenient to have this functionality embedded in the script. Why use text files at all?

    Do not understand how and where in the TS the independent sctipten are supposed to be run?

  18. Mark

    Any news on the new version ?

    • Still having a little trouble with one piece. I really don’t want to release it without this feature, but it may be time to reconsider. It’s well overdue.

      • Jose

        Hey Daniel,

        If you do not mind. What feature or piece are you working on? I know I have made significant changes to allow adding to computer groups within AD (using persitant variables) and applying environmental variables for school/site “customizations”.

        On another note I have to give you a ton of credit. This project has upped my PS skills once I realized how much you can manipulate with it. Now I am excited for the release of Server 2016 (nano/core/containers) and future SCCM installments because of what I have learned. So thank you 😀

        • The feature I am struggling on is high-DPI support. On newer models like the ThinkPad T560, WinPE has a very high resolution and therefor high DPI. This causes the OSD FrontEnd to shrink and collapse a lot of buttons and labels onto itself because the locations of each object is hardcoded.

          Thanks for the kudos, that is exactly why I released this publically. Be careful, once you see all that can be done with PowerShell and GUIs, lots of folks will want you to write GUIs for them!

  19. Don Lynch

    Thanks for the project it has helped me with what I want for my front end specific to my enviornment. I went back to the your original OSD post in regards to applying the task sequence variables using txt files and a package or packages… I am unclear on this step within the actual task sequence to apply the variables from the text files. Does anyone have a example task sequence they could show with these final steps by chance?

  20. Kishore

    Hi Daniel,

    First, Thank you very much for this front end. I took your script as a reference point and changed as per our company requirement. Big Thanks to you.

    I have a question, I have added primary user text box in my front end and want to validate the value against AD and get the department of the user. I want to utilize the department value in Task Sequence conditions. when I run the script in windows 7 machine I am getting the result what I’m after. But the problem is running the same script in Boot image. I have added PowerShell and imported Active directory module in boot image.

    Import-module Activedirectory command is working fine. But when I try to use Get-AdDuser I am running into issues… Is there any way I can achieve validating user details in Boot image ? I don’t want Help desk people entering the incorrect primary user and continuing with the build process …

    Appreciate your help.

    • Thanks for the kinds words Kishore. Unfortunately doing any AD or LDAP work via WinPE is not supported by Microsoft. I think a lot of teams leverage web services or Orchestrator to accomplish this. We use Orchestrator personally.

      There are ways to get it to work though, such as loading the ADSI tools. http://deploymentresearch.com/Research/Post/331/ADSI-plugin-for-WinPE-5-0

      Good luck!

      • Kishore

        Thank you for your reply, I will give that a try and let you know how it goes…

  21. Denis

    Hello!
    With your permission, I slightly changed the function get-creds:

    function get-creds {
    ##### Customize authentication message #####
    Remove-PSDrive Test -ErrorAction SilentlyContinue -WarningAction SilentlyContinue
    $global:creds = $host.ui.PromptForCredential("Need AD credentials", "Need AD creds", "", "local")
    New-PSDrive -Name Test -PSProvider FileSystem -Root \\server\test\test -Credential $creds

    if (-not (Get-ChildItem Test:))
    {
    get-creds
    }
    $global:UserName = $creds.username
    $encPassword = $creds.password
    Remove-PSDrive Test -ErrorAction SilentlyContinue -WarningAction SilentlyContinue
    }

    Thus, you can use authentication by AD group. It is enough to configure access rights to the folder \\server\test\.

  22. Don Lynch

    I do have one question.. even though I have -windowsstyle hidden added I still seem to get the powershell blue window popup during PE boot… If I test it outside of PE it doesnt show up. Any suggestions? My syntax is this: powershell.exe -executionpolicy bypass -windowstyle hidden -file

    • Straight from our production boot image.

      powershell.exe -executionpolicy bypass -windowstyle hidden -file frontend.ps1

      Once the boot image loads up, check tsconfig.ini (I think), and confirm it has the proper command.

  23. Don Lynch

    Ok this was great work and used the framework for my own front end.. Our naming convention is based on location so I leveraged the computer name as a variable and added to the script AD/OU locations . It works fantastic!! My own note I noticed is removing SCCM objects in the boot is a great feature however I noticed that I had to add a reboot as it appears the policy was already in progress if I removed it and the task would fail as it still seen the object during the initial policy check. How did you get around this ?

    Thanks!!

    • Good to hear Don. We used to have that issue when we had a CAS because the computer downloads policy from the Primary. We deleted the record from the CAS, so it had to replicate first. Our techs just knew to give it 1-2 minutes before hitting continue. Now that we have a single primary, it is instant. If you have a CAS, I would say its expected, but if you only have a single primary you shouldn’t see a delay.

      One of the long-standing features I would like to add is to check to ensure some policy is received when hitting continue. One day!

      • Don Lynch

        No sooner did I send this off I thought about our CAS and the delay it could cause depending on which primary server location was being utlized. With that in mind perhaps I will add just a windows pop up for techs with a countdown of sorts… Ill think on that. I love your idea of a policy indicator. I would think tapping into the SMSTS logs could be the start of adding that feature. Thanks for all your help!!

  24. Drew

    This looks amazing – I looked through your documentation and I am quite confused as to how this should be installed and implemented. Any chance of a step-by-step implementation guide?

  25. Blake

    Just wondering, is there any chance to add the ability to search AD and delete old computer accounts? Currently we have a script that does this, finds all computer names that contain the serial number and removes them. I’m hoping to use your frontend and be able to remove this script (the script also does naming for the systems). Any thoughts would be appreciated.

    • Blake

      I just saw your recommendation in a post up above, using the ADSI plugins or webservices. We currently use the ADSI, but would like to get away from that. I guess it’s time to read up on web services. I just don’t want to have two scripts to do this, or the need to push out a whole new boot image (200 locations)

      • Well, you dont have to go with a web service specifically, you just need a backend. We do all our backend work with Orchestrator. You could use something as simple as a network share with scripts running against that to monitor and process anything that comes in. Not hard to do at all. The big considerations are how much you process, keeping up, network bandwidth, and ofcourse a share or NAS to hold them.

        You will have to make one change to your boot image, so plan accordingly to make it modular and not need any further modification.

  26. kevin

    Anyone successfully update this for High DPI / High Resolution devices?

    • Ah no luck yet. At this point I am looking at redeveloping in WPF. I will probably use Visual Studio or PowerShell Studio. Looking to start up on it again after MMS.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">