Add a password to task sequence ConfigMgr #rdproud


 

Hello,

Say you want to add a password to a task sequence ?

Yes, you can do that starting from PXE but not starting from the OS (out-of-the-box) so let’s modify.

First create a simple posh Script ,

# Script can be used in order to ask a password in SCCM task sequence

# Requries vPassword to be created in TS , if input equals then vContinue will be set to OK

#

# Gino D’hoker

#

# 4/05/2015

$password = Read-host “Please enter the password.” -AsSecureString

# Prompt for input

$password = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($password))

$tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment

If ($password -eq $tsenv.Value(“vPassword”))

{

$tsenv.Value(“vContinue”)=”OK”

}

clip_image002

This will ask for input, check if the answer is identical to a ts variable called vPassword and then set a variable called vContinue to OK.

Now let’s create the ts, you’ll need the MDT package for Serviceui.exe in order to allow interaction with the ts

clip_image004

Step 1 will only be applied if not in WinPE

clip_image006

Now use the mdt package and perform a custom action for asking input

clip_image008

Because we’ll use the same ts from PXE and from OS we’ll need to set the vContinue to OK if started from PXE

clip_image010

clip_image012

And now just continue the rest of the ts only of the vContinue is OK

clip_image014

So what does this look like ? Step 1 you receive the default warning

clip_image016

Step 2 the script asks for the password.

clip_image018

If incorrect it will not perform the reinstallation.

P.S I know the dos box isn’t state of the art, I’ll check into the Powershell forms the next time to get a more fancy request for input

The rest you know.

Enjoy.

Gino D

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s