HTA application queries to AD in windows PE
Hi all, i have created a hta application which checks for users in a specific OU and sets a TS variable to true if the user exist in that OU and false if they don't.The script is running in win-PE mode but when i am using my username to login it looks like it's not able to query ad for the user and always sets the TS variable to false. rest of the TS runs only when the variable is set to true else it shutdowns the machine. Script is working fine when executed manually. how to make HTA to connect to AD in Win-pe mode.(this hta script is calling a vb function to connect to AD). Thanks Pranay.
August 6th, 2012 8:52am

Are you specifying the Domain Controller to query. Since it's running in WinPE you will need to specify the DC to query. Take a look at this sample query from WinPE http://www.deployvista.com/Home/tabid/36/EntryID/127/language/sv-SE/Default.aspxJustin | http://patchmypc.net
Free Windows Admin Tool Kit Click here and download it now
August 6th, 2012 9:43am

This is the script i am using :- <HEAD> <style type="text/css"> @import url("pos.css"); </style> <TITLE> Login : </TITLE> <hta:application id="objAD" applicationname="AD Query" icon="Graphics\title.ico" Border="thin" Scroll="NO" Maximizebutton="no"/> </HEAD> <SCRIPT LANGUAGE="VBScript"> sub Window_onLoad window.resizeTo 400,400 End sub function fnCheckAccess() strDomain = "Server" strUserID=Username.value strUserPWD=password.value MsgBox strDomain MsgBox strUserID MsgBox strUserPWD const ADS_SECURE_AUTHENTICATION = &h0001 const ADS_CHASE_REFERRALS_ALWAYS = &H60 dim objDSO dim objUser dim strPath strPath = "LDAP://" & strDomain & "/OU=Users,DC=" & strDomain On Error Resume Next set objDSO = GetObject("LDAP:") set objUser = objDSO.OpenDSObject (strPath, strUserID, strUserPWD, ADS_SECURE_AUTHENTICATION OR ADS_CHASE_REFERRALS_ALWAYS) if Err.Number <> 0 then MsgBox "Incorrect Password for " & g_strDomain & "\" & g_strUserID & "." & vbCRLF & vbCRLF & "Error " & Err.Number & ": " & Err.Description, 16, "Access Denied" fnCheckAccess = False else fnCheckAccess = True end if Err.Clear On Error Goto 0 Set env = CreateObject("Microsoft.SMS.TSEnvironment") set oTSProgressUI = CreateObject("Microsoft.SMS.TSProgressUI") oTSProgressUI.CloseProgressDialog() env("ALLOWOSDBUILD") = "NO" If fnCheckAccess = "True" then env("ALLOWOSDBUILD") = "YES" End If set objDSO = Nothing set objUser = Nothing end function function Clear() Username.value = "" password.value = "" end function </SCRIPT> <BODY Background="Graphics\sheet2.jpg" text="#000000" > <font face="segoe ui light"><H3><center>To Start Deployment enter username password</center></H3></font> <div id=T1> Username: <input type="text" name="Username"> </div> <div id=T2> Password: <input type="password" name="password"> </div> <input id=add type="button" value="Login"_name="run_button" onClick="fnCheckAccess"> <input id=Clear type="button" value="Clear"_name="run_button" onClick="Clear"> </p> </BODY> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Script is running fine when executed in deployed os but in win pe mode it's failing to connect with ad. Please help. Thanks Pranay.
August 7th, 2012 7:01am

is your boot image the stock 32 or 64 bit image that are created with an initial sccm install? .Hta support is not supported in these, you have to create a separate boot image with MDT, open it with imagex, insert your scripts, files and have the .ini file call them........ Also, make sure you inject the needed nic drivers so your new boot image has network connectivity...........
Free Windows Admin Tool Kit Click here and download it now
August 8th, 2012 10:34am

I am working with VM's...so the drivers are fine & i have inserted the script and mshta.cab package in the boot image with an ini file to run the script. I am able to run the script but my script is not able to connect to AD in this phase. Thanks Pranay.
August 13th, 2012 12:17am

Hi Justin, the sample script and my script have almost the same code of connection to AD. Thanks Pranay.
Free Windows Admin Tool Kit Click here and download it now
August 13th, 2012 12:20am

Hi Bhai, I saw that ADSI support is not available in WinPE which you could add if you want. Please go through the below link for help. http://social.technet.microsoft.com/Forums/en-US/w7itproinstall/thread/6c5173bf-5b30-4bce-86a3-eb5c876c98a5/ http://windowsmasher.wordpress.com/2011/12/19/getting-started-with-sccm-2007-and-windows-7-osd-part-1/ What Justin suggested is a good suggestion as it includes all the ADSIx86.inf file which is needed to run AD query in WinPE. Just download the file and go to ADSI_WINPE30_Plugin>ADSIx86 folder then read the readme.txt file to execute the command. Hope it works for you :) Thanks Sumit sumit
August 14th, 2012 7:52am

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

Other recent topics Other recent topics