Please Read: Significant Update Planned, Migrating Forum Software This Month

See more
See less

Is it possible to mask password in InputBox without using HTA application?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Is it possible to mask password in InputBox without using HTA application?

    I came across one of Rems previous post in 2007 on VB Script mapping a drive with a username and password.

    Could anyone please advise how do I put a password mask in the code that was provided by Rems below without using HTA:

    ================================================== =========================

    on Error Resume Next

    ' *** variables
    mDrive = "K:"
    strRemoteShare = "\\server\share"
    strUPNsuffix = ""

    strPer = "FALSE"

    minUSRnamelength = 2
    minPASSwrdlength = 3

    ' *** InputBox(prompt[,title][,default][,xpos][,ypos][,helpfile,context])
    ' *** & Map drive using the entered credentials

    Set objNetwork = WScript.CreateObject("WScript.Network")
    Set oShell = CreateObject("Shell.Application")

    strUsr = InputBox(vbcrlf& vbcrlf& "Confirm your Username","Enter Your Username",objNetwork.username)
    If Not Len(strUsr) < minUSRnamelength then
    strUsr = Ucase(strUsr) & strUPNsuffix '<--- adds the UPNsuffix to the account
    strPas = InputBox(vbcrlf& "Please enter " & vbcrlf& strUsr & "'s" & vbcrlf& vbcrlf& "email Password:")
    if Not Len(strPas) < minPASSwrdlength then
    objNetwork.MapNetworkDrive mDrive, strRemoteShare, strPer, strUsr, strPas
    If Err.Number = 0 Then
    oShell.NameSpace(mDrive).Self.Name = "share name"
    End If
    End If
    End If

    Set oShell = Nothing
    wscript.quit 0

    ' *** How can I mask Passwors Using an InputBox?
    ' *** How Can I Specify a Window Size for My HTA?
    ================================================== =========================

    Thank you.

  • #2
    As far as i know there is no way of doing this. InputBox doesn't allow for it hence the workarounds.


    • #3
      Is it possible for you to convert the script to powershell? You can then either use Get-Credential or Read-Host -AsSecureString.

      Network Consultant/Engineer
      Baltimore - Washington area and beyond