Mask Input

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
User avatar
ayth
Posts: 10
Joined: Fri May 18, 2007 3:59 am

Mask Input

Post by ayth »

Hello,

I have a situation that is a Systems Admin nightmare. I have three separate domains, separate forests, that are connected through a site to site VPN.

Users in one office have to connect to shares on a server in another office, separate domain. They have user accounts in the remote domain. I'm scripting something that will prompt them for their password and map the drives. I want to know if it's possible to mask the input they type into the input box. I haven't found a way so far but thought to post the question. My code is at the bottom(it's a work in progress so no cracks about error trapping at the moment :) ). Thanks.

Cheers,

Ayth

Code: Select all

'==========================================================================
'
' VBScript Source File -- Created with SAPIEN Technologies PrimalScript 2007
'
' NAME: Map OC Bermuda drive.
'
' AUTHOR: Darrin Henshaw , Ignition Bermuda
' DATE  : 1/24/2008
'
' COMMENT: Created so that users can create mapped drives to OC BDA shares.
'
'==========================================================================
Option Explicit
' Initialize and create variables.
Dim strUser, objNetwork, strPassword, strRemote, arrShares, arrDrives, strProfile, strDrive, strDrives, objDrives, i, strAnswer
arrDrives = Array("T:","M:","V:")
strRemote = "10.1.1.134"
arrShares = Array("OCI_NY_BDA_data","Documents","Cash Reports")
strProfile = "False"

'Create Network object, to get the local username, and to map the drive later on.
Set objNetwork = CreateObject("WScript.Network")
Set objDrives = objNetwork.EnumNetworkDrives
For i = 0 to objDrives.Count - 1 Step 2
 For Each strDrives In arrDrives
 If objDrives.Item(i) = strDrives Then
  objNetwork.RemoveNetworkDrive objDrives.Item(i)
 End If
 Next
Next

' Get the local username, and append the Bermuda domain name to it.
strUser = objNetwork.Username
'WScript.Echo strUser
strUser = "olympiabda" & strUser
strPassword = InputBox("Please input password for Bermuda account:")
' map the network drive to the correct server.
i = 0
For Each strDrives In arrDrives
objNetwork.MapNetworkDrive strDrives, strRemote & arrShares(i), strProfile, strUser, strPassword
i = i + 1
Next
' Destroy variables from memory.
Set objNetwork = Nothing

User avatar
jdelatorre@hfinc.com
Posts: 54
Joined: Mon Sep 10, 2007 2:26 am

Mask Input

Post by jdelatorre@hfinc.com »

Your probably going to have to look at an HTA, or possibly Powershell. Have you checked the ScriptingVault?

User avatar
jglessner
Posts: 16
Joined: Thu Jan 10, 2008 7:42 am

Mask Input

Post by jglessner »

If your users are all on Windows XP you can do it using the technique discussed in this Technet article. If not, I believe jdelatorre is right, and you're going to want to look at using an HTA.Hope this helps!- Joe

User avatar
jdelatorre@hfinc.com
Posts: 54
Joined: Mon Sep 10, 2007 2:26 am

Mask Input

Post by jdelatorre@hfinc.com »

wow, didnt know about that object Joe. Looks like it got tossed in vista however. 8(Good to know though.

User avatar
jglessner
Posts: 16
Joined: Thu Jan 10, 2008 7:42 am

Mask Input

Post by jglessner »

They removed it in Vista?!?! GAH! One more reason for me to never install it. I wonder if there is an equivalent or something better maybe (or is that too much to hope for)?- Joe

User avatar
jdelatorre@hfinc.com
Posts: 54
Joined: Mon Sep 10, 2007 2:26 am

Mask Input

Post by jdelatorre@hfinc.com »

no, the DLL doesnt exist on my vista machine. So the script bombs

User avatar
jglessner
Posts: 16
Joined: Thu Jan 10, 2008 7:42 am

Mask Input

Post by jglessner »

Hmm do you have the dotNET framework installed? The page mentioned that it was required.- Joe

User avatar
jglessner
Posts: 16
Joined: Thu Jan 10, 2008 7:42 am

Mask Input

Post by jglessner »

Odd, the .dll is a component of the .NET framework (maybe only v2). I've found a couple pages where people say you can copy the .dll from an XP or WS2003 machine to Vista, register it, and it works.The file is in %SYSTEMROOT%system 32 on those systems, and can be registered on Vista by running "C:WindowsSystem32> regsvr32 scriptpw.dll" at a command prompt (remember to elevate if UAC is turned on).Seems reasonable to me, though disappointing that Microsoft did not include this with Vista.- Joe

User avatar
jdelatorre@hfinc.com
Posts: 54
Joined: Mon Sep 10, 2007 2:26 am

Mask Input

Post by jdelatorre@hfinc.com »

I agree. PowerShell seems to be the preferred way for me though.

Locked