HTA to Select UDA Users

Hey Guys

Im trying to create a HTA with a multiple select Roles to deploy software based on this roles.

Lets say, the HTA will show during the TasK sequence 10 diferent roles within checkboxes..

The engineer will select (sometimes more than 1) the roles needed and click submit

then all this roles will add users to UDA (lets say role_t1 add user lab\role_t1, role_t3 add user lab\role_t3) and on)

then I got apps advertised as required and pre deploy for primary devices. then when the machine boots up, will start to install the required apps for that/those roles.

So far I got this script..

 <title>User Device Affinity Set</title>

 <script language="vbscript" type="text/vbscript">

 ' Set objects and declare global variables
 Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")

Sub Window_onLoad
     window.resizeTo 400,550 ' Resize the HTA window on first load
     window.moveTo 100, 10 ' Move the window to the center
 End Sub

Set ProgressUI = CreateObject("Microsoft.SMS.TsProgressUI")

 Sub ButtonFinishClick
     ' ButtonFinishClick is executed by the "Finish" button.
     ' Set value of variable to true/false based on whether the checkbox is selected or not
     If Role_JASOL_T1.Checked Then
         UDACHECK = "lab\Role_T1"
     		If Role_JASOL_T2.Checked Then
         	UDACHECK = UDACHECK + "," + "lab\Role_T2"
     			If Role_JASOL_T3.Checked Then
         		UDACHECK = UDACHECK + "," + "lab\Role_T3"
     End If
     ' Set value of variables that will be used by the task sequence, then close the window and allow the task sequence to continue.
     env("OSDFullImage") = strFullImage
Dim env
set env = CreateObject("Microsoft.SMS.TSEnvironment")
env("SMSTSUdaUsers") = UDACHECK
 End Sub

MsgBox "SMSTSUdaUsers variable set to " & env("SMSTSUdaUsers") & " within the Task Sequence."


 <body STYLE="font:14 pt arial; color:white; background-color: #000000">
 <span id = "List"></span>
 <p>Select Business Roles<br>
 <input type="checkbox" name="Role_T1"> T1 <br>
 <input type="checkbox" name="Role_T2"> T2 <br>
 <input type="checkbox" name="Role_T3"> T3 <br>
 <button accesskey=N type=submit id=buttonFinish onclick=ButtonFinishClick >DONE</button>
Can anyone help me please?? T
February 25th, 2014 10:30pm

the HTA below allows you to enter a username and that user is added as the UDA user in the task sequence, maybe that will help you

Free Windows Admin Tool Kit Click here and download it now
February 26th, 2014 4:11am

I have not found any wmi classes for setting UDA. Anyway, you may refer to the script below to set UDA.

SMSTSAssignUserMode= auto

The affinity between a user and the target device is established, and approval is automatically performed.

UDAUser = Inputbox("Specify your username in DOMAIN\USERNAME FORMAT")

SMSTSAssignUserMode = Auto

set env = CreateObject("Microsoft.SMS.TSEnvironment")

env("SMSTSUdaUsers") = UDAUser

env("SMSTSAssignUsersMode") = SMSTSAssignUserMode

'End of Script

February 26th, 2014 4:32am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics