Jump to content




anyweb

The CM12 BitLocker FrontEnd HTA



Recommended Posts

ok I made two downloads available, one for SP1 and one for R2, which one did you use ?

Share this post


Link to post
Share on other sites


the one for SP1, as my SCCM 2012 is still on the SP1 release (we are not yet deploying Windows 8 in our enterprise, waiting for Windows 10 to get to RTM version)

Share this post


Link to post
Share on other sites

What is the best way to get an OU selection into this HTA? I have everything down to a science but still cannot get the variables to pass. I am using OSDDomainOUName when creating the objects in tsENV.

Has anyone gotten this to work before?

Share this post


Link to post
Share on other sites
Hi,
First off, I'd like to thank and commend you for creating such a great tool :)
I'm getting desperate now as I'm so close to having this implemented at my workplace. As we are looking to name our computers according to a number of parameters (specifically depending on the office location and the department), I decided to extend Niehaus' RIS Naming webservice. In short I simply modified it to take two new parameters, department and office.
The WebService by itself works absolutely fine, i.e. triggering through a SOAP action (e.g. .NET WEbService Studio) or directly from a browser, it returns a correct value:
Y3ybiB7.png
5dYR4W7.png
As you can see, the actual webservice appears to be working correctly. However, when I try to connect it using the mdt scripts, with the following settings, I get a 500 Internal error response:
[ChangeComputerName]
WebService=http://sesccm01/risnaming/risnaming.asmx?op=GenerateName
Parameters=dnsDomain,prefix,uuid,dptValue,officeValue
<![LOG[CHECKING the [ChangeComputerName] section]LOG]!><time="14:45:25.000+000" date="03-06-2015" component="changecomputername" context="" type="1" thread="" file="changecomputername">
<![LOG[No value specified for parameter 'PREFIX', web service results could be unpredictable.]LOG]!><time="14:45:25.000+000" date="03-06-2015" component="changecomputername" context="" type="1" thread="" file="changecomputername">
<![LOG[Unexpected response from web service: 500 Internal Server Error
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><soap:Code><soap:Value>soap:Receiver</soap:Value></soap:Code><soap:Reason><soap:Text xml:lang="en">Server was unable to process request. ---> Data at the root level is invalid. Line 1, position 1.</soap:Text></soap:Reason><soap:Detail /></soap:Fault></soap:Body></soap:Envelope>]LOG]!><time="14:45:25.000+000" date="03-06-2015" component="changecomputername" context="" type="3" thread="" file="changecomputername">
<![LOG[Unable to call ChangeComputername WebService.]LOG]!><time="14:45:25.000+000" date="03-06-2015" component="changecomputername" context="" type="2" thread="" file="changecomputername">

The above is from a virtual machine. this is what I get from a desktop:

<![LOG[CHECKING the [ChangeComputerName] section]LOG]!><time="14:39:32.000+000" date="03-06-2015" component="changecomputername" context="" type="1" thread="" file="changecomputername">
<![LOG[Unexpected response from web service: 500 Internal Server Error
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><soap:Code><soap:Value>soap:Receiver</soap:Value></soap:Code><soap:Reason><soap:Text xml:lang="en">Server was unable to process request. ---> Data at the root level is invalid. Line 1, position 1.</soap:Text></soap:Reason><soap:Detail /></soap:Fault></soap:Body></soap:Envelope>]LOG]!><time="14:39:32.000+000" date="03-06-2015" component="changecomputername" context="" type="3" thread="" file="changecomputername">
<![LOG[Unable to call ChangeComputername WebService.]LOG]!><time="14:39:32.000+000" date="03-06-2015" component="changecomputername" context="" type="2" thread="" file="changecomputername">

The Prefix, interestingly enough, should be set during the TS (this is unchanged from when I imported it), but since we're seeing the 500 error regardless I doubt it's the problem:

PFrq6UP.png

(Options > Conditions is still set to e.g. IsDesktop equals "True")

 

I've added dptValue and officeValue info gathering to the HTA, and the values are populated, e.g:

dptValue = dptDrop.options[dptDrop.selectedIndex].value;
officeValue = offDrop.options[offDrop.selectedIndex].value;

jOKKhep.png

Can anyone help me figure out what is going wrong?
(I should probably mention that I also added some logging functionality to the WebService, should it fail for some reason e.g. exceptions, but nothing is logged)

Share this post


Link to post
Share on other sites

open a cmd prompt at the HTA and cd to the folder where the scripts for contacting the webserver are located

 

then, execute the cmdline to run the ChangeComputerName.wsf script to do the computernaming, the first time you try it don't include any parameters, what output do you see ?

 

next time you run it include the parameters it expects, what output do you see ?

to add more logging in cmtrace (make sure it's open with the ChangeComputerName.log in view) then execute the script in debug mode like so

 

ChangeComputerName.wsf /debug:true

 

this should reveal the source of your issues but for a pointer, from you error above it's not finding the prefix as you are either calling the wrong URL or the parameters speficied are not correct, which could be true as the webservice you show in your screenshot has different parameter names to the one in your customsettings.ini

Share this post


Link to post
Share on other sites

Hi anyweb,

 

Thanks for replying, really appreciate it!

 

I think you may be onto something. In the webService, I had defined the input variables as "office" and "department" respectively, so my first idea was to change those from:

[WebMethod]
        public String GenerateName(String dnsDomain, String prefix, String uuid, String department, String office)

to

[WebMethod]
        public String GenerateName(String dnsDomain, String prefix, String uuid, String dptValue, String officeValue)

To match those that are configured in CustomSettings.ini:

[ChangeComputerName]
WebService=http://sesccm01/risnaming/risnaming.asmx?op=GenerateName
Parameters=dnsDomain,prefix,uuid,dptValue,officeValue

This didn't help, unfortunately.

 

The Prefix is only acting up on the virtual machine (which is odd, the TS step is skipping because as IsVirtual is considered false). On the desktop, however, we can see all the values being pulled through:

<![LOG['debug' parameter was specified.]LOG]!><time="09:49:40.000+000" date="03-09-2015" component="changecomputername" context="" type="1" thread="" file="changecomputername">
<![LOG[Property debug is now = TRUE]LOG]!><time="09:49:40.000+000" date="03-09-2015" component="changecomputername" context="" type="1" thread="" file="changecomputername">
<![LOG[Microsoft Deployment Toolkit version: 6.1.2373.0]LOG]!><time="09:49:40.000+000" date="03-09-2015" component="changecomputername" context="" type="1" thread="" file="changecomputername">
<![LOG[The task sequencer log is located at X:\WINDOWS\TEMP\SMSTSLog\SMSTS.LOG.  For task sequence failures, please consult this log.]LOG]!><time="09:49:40.000+000" date="03-09-2015" component="changecomputername" context="" type="1" thread="" file="changecomputername">
<![LOG[Using specified INI file = C:\_SMSTaskSequence\WDPackage\CustomSettings.ini]LOG]!><time="09:49:40.000+000" date="03-09-2015" component="changecomputername" context="" type="1" thread="" file="changecomputername">
<![LOG[CHECKING the [ChangeComputerName] section]LOG]!><time="09:49:40.000+000" date="03-09-2015" component="changecomputername" context="" type="1" thread="" file="changecomputername">
<![LOG[About to execute web service call using method POST to http://sesccm01/risnaming/risnaming.asmx?op=GenerateName: dnsDomain=euse&prefix=DT&uuid=4C4C4544-0038-5810-8053-B2C04F563432&dptValue=DEV&officeValue=SE]LOG]!><time="09:49:40.000+000" date="03-09-2015" component="changecomputername" context="" type="1" thread="" file="changecomputername">
<![LOG[Unexpected response from web service: 500 Internal Server Error
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><soap:Code><soap:Value>soap:Receiver</soap:Value></soap:Code><soap:Reason><soap:Text xml:lang="en">Server was unable to process request. ---> Data at the root level is invalid. Line 1, position 1.</soap:Text></soap:Reason><soap:Detail /></soap:Fault></soap:Body></soap:Envelope>]LOG]!><time="09:49:40.000+000" date="03-09-2015" component="changecomputername" context="" type="3" thread="" file="changecomputername">
<![LOG[Unable to call ChangeComputername WebService.]LOG]!><time="09:49:40.000+000" date="03-09-2015" component="changecomputername" context="" type="2" thread="" file="changecomputername">

It might be worth mentioning that the boot image I'm using is x64, although that shouldn't matter. We can clearly see that it's POSTing the correct values, yet it appears as if the VBScript can't invoke the WebService properly.

 

EDIT:

I noted the following in the IIS log, which shows us that it might be something with the WebService afterall:

172.16.20.12 POST /risnaming/risnaming.asmx op=GenerateName 80 - 172.16.7.138 Mozilla/4.0+(compatible;+Win32;+WinHttp.WinHttpRequest.5) - 500 0 0 759 53

I'm digging through the error codes and hopefully I can nail down the issue. Any other ideas?

Share this post


Link to post
Share on other sites

So, I decided to try a workaround, using PowerShell instead, as I think something is happening with how the VBScript calls the webservice.

 

I got the PowerShell script to run successfully in the TS environment, but when triggering it through the TS it fails:

XXSJk3q.png

 

2qOheFD.png

 

 

So I decided to try to invoke the PowerShell command in a few different ways, but all of them fail.

 

ev6ANY1.png

 

cythch4.png

 

RG0vWjR.png

 

So neither package or calling the script through MDT works:

oZYBZHe.png

 

The script itself isn't exactly rocket-science, but in this case it appears to be failing because it fails to start the PS host shell?

# Script to call WebService to change computername
Import-Module %scriptroot%\wnb\ZTIUtility.psm1
#$env:PSExecutionPolicyPreference  = "Unrestricted"

# Determine where to do the logging 
$TSENV = New-Object -COMObject Microsoft.SMS.TSENVironment 
$logPath = $TSENV:LogPath
$logFile = "$logPath\GenerateComputerName.log"
 
# Start the logging 
Start-Transcript $logFile
Write-Output "Logging to $logFile"

#Get TSENV stuff:
$dnsDomain = $TSENV:dnsDomain
$prefix = $TSENV:prefix
$uuid = $TSENV:UUID
$dptValue = $TSENV:dptValue
$officeValue = $TSENV:officeValue

# Load up the WebService, and call the function
Try
{
	$ADWebS = New-WebServiceProxy -Uri http://sesccm01/risnaming/risnaming.asmx?WSDL
	$ComputerName = $ADWebS.GenerateName($dnsDomain, $prefix, $uuid, $dptValue, $officeValue)

	$TSENV:OSDCOMPUTERNAME = "$ComputerName"
	Write-Output "INFO: Set ComputerName to $ComputerName" 
}
Catch
{
	Write-Output "ERROR: $ErrorMessage"
}

Stop-Transcript

Ideas why the PowerShell would fail?

Share this post


Link to post
Share on other sites

did you update your boot wim to the dp's AFTER you added the optional components ?

Share this post


Link to post
Share on other sites

Finally got this to work! :D

(It wasn't the boot wim that was the issue)

I'll post it here if anyone else runs into the same issue, they can do the following:

  • Replace the "Call ChangeComputerName webservice" step in the Task Sequence with the following:
    • A Run Command Line step with the following:
    • powershell.exe -ExecutionPolicy Bypass -file "%SCRIPTROOT%\wnb\GenerateComputerName.ps1"
    • 5IOjPg8.png
  • In the wnb folder (where the old "changecomputername.wsf" resides), create a new file named "GenerateComputerName.ps1". It should contain the following (change as you deem necessary):
  • # Script to call WebService to change computername
    
    $scriptPath = split-path -parent $MyInvocation.MyCommand.Definition
    
    $toolsPath = ($scriptPath | Split-Path | Split-Path) + "\Tools\Modules\ZTIUtility"
    
    Import-Module "$toolsPath\ZTIUtility.psm1"
    #$env:PSExecutionPolicyPreference  = "Unrestricted"
    
    # Determine where to do the logging 
    $TSENV = New-Object -COMObject Microsoft.SMS.TSENVironment 
    $logPath = $TSENV:LogPath
    $logFile = "$logPath\GenerateComputerName.log"
     
    # Start the logging 
    Start-Transcript $logFile
    Write-Output "Logging to $logFile"
    
    #Get TSENV stuff:
    $dnsDomain = $TSENV:dnsDomain
    $prefix = $TSENV:prefix
    $uuid = $TSENV:UUID
    
    # Load up the WebService, and call the function
    Try
    {
    	$ADWebS = New-WebServiceProxy -Uri http://SCCMSERVER/risnaming/risnaming.asmx?WSDL
    	$ComputerName = $ADWebS.GenerateName($dnsDomain, $prefix, $uuid)
    
    	$TSENV:OSDCOMPUTERNAME = "$ComputerName"
    	Write-Output "INFO: Set ComputerName to $ComputerName" 
    }
    Catch
    {
    	Write-Output "ERROR: $ErrorMessage"
    }
    
    Stop-Transcript
    
  • Example; in my case, I also have variables for office and departments. I added the and modified the following:
$dptValue = $TSENV:dptValue
$officeValue = $TSENV:officeValue

# Change $ComputerName = $ADWebS.GenerateName($dnsDomain, $prefix, $uuid) to:
$ComputerName = $ADWebS.GenerateName($dnsDomain, $prefix, $uuid, $dptValue, $officeValue)

Cheers!

  • Like 1

Share this post


Link to post
Share on other sites

What is the difference between this HTA and The CM12 UEFI BitLocker Frontend HTA?

Share this post


Link to post
Share on other sites

glad you got it working,

 

(It wasn't the boot wim that was the issue)

 

 

what was the issue then seeing as others may also have that issue,

 

the UEFI version handles refreshes to UEFI as well as legacy hardware, so it's more future resiliant, plus it has the new HTA design..

Share this post


Link to post
Share on other sites

glad you got it working,

 

 

what was the issue then seeing as others may also have that issue,

 

I'm not sure. All I know is that the VBScript fails, whilst the PowerShell script doesn't. It might be something in ZTIDataAccess.vbs (WebService class section). All I can tell that the call to the webservice doesn't work, but doing it the same way using PowerShell works fine - could there be a missing reference somewhere?

 

9tzSus8.png

 

If time permits, I'll try to recreate the issue and see if I can nail down the root cause.

Share this post


Link to post
Share on other sites

well if you are getting iis 500 errors in the webservice then make sure web.config is allowed to POST and that UUID = correct value

 

and you were...

 

<![LOG[unexpected response from web service: 500 Internal Server Error

 

Share this post


Link to post
Share on other sites

Well, the web.config file remained unchanged during this time, and it doesn't explain why it would be possible to POST using PowerShell yet not with VBScript.

 

The specific part of the web.config I believe you're referring to is:

<add name="WSDL" path="*.wsdl" verb="GET,HEAD,POST,DEBUG" modules="ProtocolSupportModule" resourceType="Unspecified" />

As you can see, it allows for both POST and GET. It's odd, because you are right in that IIS 500 errors point us to the webservice - but maybe the VBScript added something to the "payload" (i.e. content) which the webservice couldn't handle?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×