No announcement yet.

Connecting to Mapped Drives within HTA and Error Trapping

  • Filter
  • Time
  • Show
Clear All
new posts

  • Connecting to Mapped Drives within HTA and Error Trapping

    Hello everyone,

    I am using an HTA on a boot media to prompt for credentials to gain access to a network resource via mapped drives from an XML file. Once the drives are mapped, the HTA closes and another opens which allows the user to deploy a workstation image.

    The HTA prompts for username and password and then maps drive letters accordingly. As long as the Username and Password are valid, everything works just fine.
    Problems I am facing:
    1. If the user incorrectly enters their username or password, i would like to clear all values set through the script, close the HTA and open it again. I want them to be prompted again for credentials and not receive VBS errors. I have tried to work around the different scenarios (wrong username, wrong password, invalid path for drive mapping, etc) but it is not working. If I exit the Logon HTA, when I open it a second time, it seems to be retaining information about Username, Password, error codes, etc., so I get different results each time I run the Logon HTA within the same boot session.

    2. If the user enters credentials properly, the Logon HTA will close and then take them to a second HTA. If they exit the second HTA for whatever reason and need to run the Logon HTA again. I want to prompt for credentials again but once the drives are mapped the first time, any credentials entered on the initial HTA logon screen will take them directly to the second HTA. Again, values are being retained which I do not know how to clear.
    3. Some users have 1 drive mapping, others have 2, others have 3 which is completed via the XML file. If they enter incorrect credentials and have 3 drive mappings, their account will become locked out as their credentials fail on all 3 mapped drive attempts. I have tried to avoid this through trapping the first error and then closing the HTA and opening it again, but I am not doing something correct.

    So I have been trying to add error trapping (clueless at this to say the least) to prevent the user account from becoming locked out and to allow the HTA to close, and then reopen and have the user to enter credentials again and try to connect. I am lost at this point adn would greatly appreciate any assistance, recommendations, criticisms, etc that anyone can provide. I am humbled by all the knowledge on this forum.

    I have attached the code as I exceeded the total character posting limit

    Thank you all for any help
    Attached Files