Task Sequence – Gather User Text Input – Command Line

Ok, why would you need this? I don’t know. But today I saw a request from someone on Reddit who wanted a way to prompt for a computer name, but wanted it really simple, no Front ends, and didn’t want to set the variable on the collection to be gathered.

NOTE, this works in WinPE. If you want this to work in the Full OS, you have to modify the command line to leverage ServiceUI, which I’m not going to cover here.

Similar Community Posts: Prompting for Input During a Task Sequence (smsagent.blog)

My Solution: Run Command Line Step:

cmd.exe /c start /wait cmd.exe /c PowerShell $Input = Read-Host -Prompt 'Favorite TV Show' ; $tsenv = new-object -comobject Microsoft.SMS.TSEnvironment; $tsenv.Value('UserInput') = $Input

In Action

After I enter my answer, and hit return, the variable is created with my input.

Now, what are you going to do with that? Who knows… maybe customize a welcome message based on their input, maybe use bing to download a custom background based on their input?

So, now if you find yourself with a reason to prompt for user input, you have a super simple way to get it.

Related Reading: Task Sequence Com Objects and End User Prompts:
Details on Task Sequence COM Objects – Recast Software

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.