none
.hta Application & Task Sequence Variable RRS feed

  • Frage

  • Hi,

    i created a .hta Application to enter a computer description and to set the computer description to an own task sequence variable (belong to http://msdn.microsoft.com/en-us/library/cc145669).

    About end of task sequence i run a command line with a vb script (with Domain Admin credentials and not from WinPE) which read the task sequence variable (also belong to MSDN Article above) and write it to Active Directory and the computer account.

    However, after OSD the computer description isn't set. Do you able to help me?

    I test .hta Application and vb script manually (without the Task Sequence Variable), it works.

    Code and picture of the task sequence step are attached.

    .hta application

    
    
    <html>
    <head>
    <title>Windows 7 Deployment - Computer Description</title>
    
    <HTA:APPLICATION
        APPLICATIONNAME="OSD GATHER"
        SCROLL="no"
        SINGLEINSTANCE="yes"       
        WINDOWSTATE="normal"
        BORDER="thin"
    >
    
    </head>
    
    <script language="vbscript" type="text/vbscript">
    
    Sub Window_onLoad
        window.resizeTo 750,450
    End Sub
    
    Sub ButtonFinishClick
    
        dim compdescription
        compdescription = ComputerDescription.Value
    
    	dim osd: set env = CreateObject("Microsoft.SMS.TSEnvironment")
        env("OSDComputerDescription") = compdescription
      
        window.Close
          
    End Sub
    
    Sub ValidateComputerDescription
    	if Len(ComputerDescription.Value) = 0 then
    		NoDescription.style.display = "inline"
    		DescTooLong.style.display = "none"
    		ButtonFinish.disabled = true
    	elseif Len(ComputerDescription.value) > 60 then
    		NoDescription.style.display = "none"
    		DescTooLong.style.display = "inline"
    		ButtonFinish.disabled = true
    	Else
    		NoDescription.style.display = "none"
    		DescTooLong.style.display = "none"
    		ButtonFinish.disabled = false
    	End if
    
    End sub
    
    Sub InitializeCompDescription
    	DescToolong.style.display = "none"
    	Buttonfinish.disabled = true
    End sub
    
    </script>
    
    <body language=vbscript onload=InitializeCompDescription>
    
    	<font face="Calibri">
        <H1>Configure Computer Description.</H1>
    
            <!--  Computer Description Format -->
    
            <font color="#0000FF"><p><u><b>Specify the computer description.</u></b></p></font>
            <p>Add a computer description to computer AD account like %model name% %user%</p>
    
            <p><span class="Larger">Computer <u class=larger>d</u>escription:</span><br/>
            <input type=text id="Computer" name=ComputerDescription size=60 language=vbscript onpropertychange=ValidateComputerDescription AccessKey=d /></p>
    
            <p>&nbsp;
              <label class=ErrMsg id=NoDescription>* Required (MISSING)</label>
              <label class=ErrMsg id=DescTooLong>Maximum of 60 characters!</label>
            </p>
    		
    	</font>
    
    <button accesskey=N type=submit id=buttonFinish onclick=ButtonFinishClick ><U>F</U>inish</button>
    
    </body>
    </html>
    


    
    
    

    vb Script

    '-----Read Task Sequence Variable---
    
    dim osd: set env = CreateObject("Microsoft.SMS.TSEnvironment")
    dim strdesc
    strdesc = env("OSDComputerDescription")
    
    '----Get Computer DN------
    
    dim ComputerDN
    
    Set objADSysInfo = CreateObject("ADSystemInfo")
    
    ComputerDN = objADSysInfo.ComputerName
    
    Set objADSysInfo = Nothing
    
    '---Set Computer Description------
    
    Set objComputer = GetObject("LDAP://" & ComputerDN)
    objComputer.Put "Description", strdesc
    objComputer.SetInfo

    
    
    Dienstag, 4. September 2012 14:53

Antworten

  • Hi,

    nur noch zur Information: Wir haben uns aufgrund der vorherigen Vorgehensweise eines Deployments jetzt dazu entschieden ein "Import Computer Information" Feld bereit zustellen, wo dann Computername, Computerdescription und Mac-Adresse angegeben werden.

    Wenn jemand ähnliche Probleme hat, bin ich gerne bereit mir das nochmal anzuschauen bzw. jemand die Lösung weiß wäre ich trotz allem sehr interessiert.

    Gruß

    Montag, 24. September 2012 09:05

Alle Antworten