none
HTA; Vbscript‎ to get AD security group properties and diplay it on HTA application RRS feed

  • Question

  • HTA; Vbscript‎ to get AD security group properties and display it on HTA application
    When the HTA application is run I want the it to display the AD security group properties on the application.

    Below is my script, it not display any thing. Thank you for your help.  


    <html>
    <head>
    <title>My Application</title>
    <HTA:APPLICATION
      APPLICATIONNAME="My Application"
      ID="MyApplication"
      VERSION="1.0"/>
    </head>

    <script language="VBScript">

    Sub Window_OnLoad
     
    End Sub

    Sub Get_GroupInfo
         
        Const ADS_GROUP_TYPE_GLOBAL_GROUP = &h2
        Const ADS_GROUP_TYPE_LOCAL_GROUP = &h4
        Const ADS_GROUP_TYPE_UNIVERSAL_GROUP = &h8
        Const ADS_GROUP_TYPE_SECURITY_ENABLED = &h80000000

        Set objShell = CreateObject("WScript.Shell")

    Set objGroup = GetObject _
    ("LDAP://CN=IT-Systems,OU=Security Groups,OU=OU    Administration,DC=kua,DC=ds,DC=kuat,DC=com")
     
        objGroup.GetInfo
        strInfo = objGroup.Get("info")
        WScript.Echo "" & strInfo
        
    End Sub

    </script>

    <body bgcolor="white">

    </body>
    </html>
    • Moved by Bill_Stewart Monday, July 30, 2018 9:25 PM Unanswerable drive-by question
    Wednesday, June 13, 2018 9:28 PM

All replies

  • You cannot use WScript.Echo in an HTA.  You must assign output to a control or use the "document.write" method.

    document.write(strinfo)

    This will write to the body of the document.


    \_(ツ)_/

    Wednesday, June 13, 2018 9:48 PM
  • I don't really know how to use document.write(strinfo) method in practice. Please, you modify the script I post. Thank you for the help.

    Thursday, June 14, 2018 12:16 PM
  • Start by taking the time to learn how to write a script.  Where and how you use this all depends on what you want to output.

    I recommend that you not use VBScript or an HTA as these technologies are obsolete.  Use PowerShell if you are going to try to learn scripting.


    \_(ツ)_/

    Thursday, June 14, 2018 12:19 PM
  • I have already started learning PowerShell scripting. I need to HTA for this particular information. If you can please help.
    Thursday, June 14, 2018 12:40 PM
  • Here is a tutorial on HTA writing.  It will help you understand your issues.

    http://www.itprotoday.com/software-development/how-learn-and-even-master-art-writing-htas


    \_(ツ)_/

    Thursday, June 14, 2018 1:04 PM
  • Here is a quick example:

    <html>
    <head>
    <title>My Application</title>
    <HTA:APPLICATION
       APPLICATIONNAME="My Application"
       ID="MyApplication"
       VERSION="1.0"/>
    </head>
    
    <script language="VBScript">
     Sub Window_OnLoad
        document.write "<h1>hello world</h1>"
     End Sub
    </script>
    
    <body>
    
    </body>
    </html>


    \_(ツ)_/

    Thursday, June 14, 2018 1:16 PM
  • Still not able to display the AD security group properties formation I need.
    Thursday, June 14, 2018 1:37 PM
  • What have you tried?


    \_(ツ)_/

    Thursday, June 14, 2018 2:01 PM
  • I can use hta to display information hand coded into script.

    If run just VBS  without hta code, I can get the AD security group to display the information i need on command prompt. However, I want display the information on hta application. Please help me if you know how?
    Thursday, June 14, 2018 2:26 PM