How can I get my task sequence to prompt for a password ?

Ever wanted to prompt a user for a password prior to the Task Sequence doing it’s job, well you can and this is how I do it [in WinPE]

create a blank text file in notepad called promptforpassword.wsf

paste the following into it

<job id="PromptForPassword">

<script language="VBScript" >

Dim env,oTSProgressUI,MyPass
Set env = CreateObject("Microsoft.SMS.TSEnvironment")

set oTSProgressUI = CreateObject("Microsoft.SMS.TSProgressUI")


MyPass=Inputbox("Please enter the Password to continue")

If MyPass = "password" then
End If


create a package called Prompt for Password and place that file in the package, distribute it to distribution points.

Once done, add a Run Command Line step to your task sequence at the beginning and the step should call the wsf file in the package you’ve just created, like so

Command line:

cscript "promptforpassword.wsf"

Prompt For Password

The next step in the task sequence will check for the variable called

if ALLOWOSDBUILD = no then the Task Sequence will run another
script called shutdown.wsf otherwise the Task Sequence will continue as normal.

So for the shutdown step click on the options tab and set it as follows
This group/step will run if the following conditions are met:
Task Sequence Variable ALLOWOSDBUILD not equals “YES”

The Shutdown.wsf file should look like this, note that it depends on the MDT toolkit files package to be loaded prior to running.

<job id="setEnv">
<script language="VBScript" src="ZTIUtility.vbs"/>
<script language="VBScript">

Dim oTSProgressUI
set oTSProgressUI = CreateObject("Microsoft.SMS.TSProgressUI")

On error resume next
Dim fso, WShell, oFile
Set WShell = CreateObject("WScript.Shell")
Set fso = CreateObject("scripting.filesystemobject")

= oEnvironment.Item("SCRIPTROOT")

MsgBox "Please click OK to shutdown the computer.",0, "Task Sequence Aborted"
WShell.Run "wpeutil shutdown",0, True


so long story short, if someone enters the right password, they are
allowed to continue, if they don’t the task sequence shuts down.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

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

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