Monday, September 11, 2017

OSD Computer Name Prompt

I work with a lot of Microsoft products, one of my favorite is Microsoft Deployment Toolkit and System Center Configuration Manager, otherwise known as MDT and SCCM (Sick-em boy). My favorite part is customizing the Windows Operating System. In my company, I work with the latest. Windows 10/SCCM 2012 R2 (1511)...yes there is a later one.

What I enjoy is customizing Task Sequences. Writing PowerShell GUI's to control variables. Yes I know SCCM with MDT integrated and using its built in UDI wizard does all this for you, but what fun is that?

Here is a PowerShell I wrote to prompt for a computer name.



I have tested this against most of our Dell Systems and it does come back with the correct information. The cool thing is I loaded all the images as binary so it will load the proper image when prompted. Obviously as newer models come out; they too would need to be added.

Here are some things it checks
  • Chassis types
  • Check current name if MININT (prompt)
  • Name Validation check

To get SCCM to prompt the computer name correctly, you will need a few prerequisites.
  • If your using the SCCM (1511) and its latest ADK, be sure to provision a new Boot image so that the WinPE is matched and apply the hotfix: 3143760
  • To allow this script to be interactive, copy the ServiceUI.exe and TSProgressUI.exe from the MDT's <DeploymentShare>\tools\x64 folder (can also be found under the MDT installation folder in Templates). Add it as part of the script package. 
  • Add Run Command line in Task sequence. Add the package to is and run the command like this: ServiceUI.exe -process:TSProgressUI.exe %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -File Set-OSDComputerName.ps1

The script can be found here: Set-OSDComputerName.ps1

This is very basic script but it has potential to be more...

6 comments:

  1. Wow very potential tool, would be nice if this can run stand alone.

    ReplyDelete
    Replies
    1. It can run stand-alone. All the images are inbedded in base64 encoding. If you don't want it to runn in a Task Sequence, you could just change the this section of Set-OSDComputerName function:

      $TSEnv = New-Object -COMObject Microsoft.SMS.TSEnvironment
      $TSEnv.Value("OSDComputerName") = "$($OSDComputerName)"

      to

      $computername = (Get-WmiObject Win32_ComputerSystem)
      $computername.Rename($OSDComputerName)

      Delete
  2. Script looks great. Is there a place that would show any errors? It ran the task but my machine still joined with a MIN-INT name.

    ReplyDelete