I am sure this will be very easy for you clever scripting guys out there, here's a couple of questions.
I have wrote this little script for some wireless laptops that we are not going to join our domain, but we'd likeour students toaccess to thier home drives, and shared resources.
===============================
echo off
net use z: /delete
net use t: /delete
echo Your Intake Year
echo Y7=2008 Y8=2007 Y9=2006 Y10=2005 Y11=2004
echo Please type your Intake Year below
set /p Group=
echo Please Type your Username (example astudent120589)
echo Please Type your Username
set /p usern=
echo "Please Type your Password"
set /p password=
echo Your username is %usern%
echo Your Group is %Group%
pause
net use Z: "\\Server\User Storage\Pupils\%Group%\%usern%" /User:ourdomaim\%usern% %password% /PERSISTENT:NO
net use T: "\\Server\student shared$" /User:ourdomain\%usern% %password% /PERSISTENT:NO
================================
1. It works but i'd prefer to hide the password as they type it? is it possible?
2. I'd also prefer to ask for thier year group, so they just type 7,8,9,10 or 11 instend of thier intake group, but I don't know how to script this?
3. Also what is the command to set the path of MY documents to Z: drive, so applications trying to save will pick z: as it's default location.
Anyhelp or suggestions on how to improve this script would be great.
Thank you.
Steve, Chaucer BEC, Sheffield UK
I am sure this will be very easy for you clever scripting guys out there, here's a couple of questions.
I have wrote this little script for some wireless laptops that we are not going to join our domain, but we'd likeour students toaccess to thier home drives, and shared resources.
===============================
echo off
net use z: /delete
net use t: /delete
echo Your Intake Year
echo Y7=2008 Y8=2007 Y9=2006 Y10=2005 Y11=2004
echo Please type your Intake Year below
set /p Group=
echo Please Type your Username (example astudent120589)
echo Please Type your Username
set /p usern=
echo "Please Type your Password"
set /p password=
echo Your username is %usern%
echo Your Group is %Group%
pause
net use Z: "\\Server\User Storage\Pupils\%Group%\%usern%" /User:ourdomaim\%usern% %password% /PERSISTENT:NO
net use T: "\\Server\student shared$" /User:ourdomain\%usern% %password% /PERSISTENT:NO
================================
1. It works but i'd prefer to hide the password as they type it? is it possible?
2. I'd also prefer to ask for thier year group, so they just type 7,8,9,10 or 11 instend of thier intake group, but I don't know how to script this?
3. Also what is the command to set the path of MY documents to Z: drive, so applications trying to save will pick z: as it's default location.
Anyhelp or suggestions on how to improve this script would be great.
Thank you.
Steve, Chaucer BEC, Sheffield UK
http://home7.inet.tele.dk/batfiles/monthly/jul2000.htm
Regards,
Salvador Manaois III
MCITP | Enterprise & Server Admin
MCSE MCSA MCTS CIWA C|EH
Bytes & Badz: http://badzmanaois.blogspot.com
but the script doesn't work, due to anerror withMEM.EXE, and I really can't see how to use the script for a password,
that could be any length and contain an character.
But thanks for the suggestion.
I am thinking of trying to write the script in vbs, but I don't know where to start.
Any other suggestions?
Thanks
Steve
Thank you
Ed Wilson
Microsoft Scripting Guy
This is possible with my copyrighted freeware editv32.exe (on 32-bit Windows) and editv64.exe (on 64-bit Windows) programs. For example:It works but i'd prefer to hide the password as they type it? is it possible?
editv32 -m -p "Enter the password: " PWD
This causes editv32.exe to display the prompt "Enter the password:" and pauses for input. The "-m" option masks the password with "*" characters. When you type something and press Enter, the input you typed is stored in the PWD environment variable.
You can download editv32.exe and editv64.exe from my web site:
http://www.westmesatech.com/editv.html
HTH,
Bill
Here's a quick HTA I wrote though which should do the trick.
<html> <head> <title>Drive Mapper</title> <HTA:APPLICATION APPLICATIONNAME="Drive Mapper" SCROLL="no" SINGLEINSTANCE="yes" WINDOWSTATE="normal" > <STYLE> body { padding-top:20px; text-align:center; } td,input { font-family:Verdana; font-size:12pt; } a { font-size:9pt; font-family:Verdana; } </STYLE> <SCRIPT LANGUAGE=VBScript> Set objNetwork = CreateObject("Wscript.Network") Set objFSO = CreateObject("Scripting.FileSystemObject") Sub Window_OnLoad Dim X, Y, strComputer, objWMIService, colItems, objItem, intHorizontal, strYear X=500 Y=300 window.resizeTo X,Y ' resize the HTA strComputer = "." Set objWMIService = GetObject("Winmgmts:\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery("Select * From Win32_DesktopMonitor") For Each objItem in colItems intHorizontal = objItem.ScreenWidth intVertical = objItem.ScreenHeight Next window.moveTo (intHorizontal - X) / 2, (intVertical - Y) / 2 ' centre it txtName.value=objNetwork.UserName txtName.focus End Sub Sub btnConfigure_OnClick If txtName.value="" Then MsgBox "Please enter your name",16,"ERROR" txtName.focus Exit Sub End If If txtPassword.value="" Then MsgBox "Please enter your password",16,"ERROR" txtPassword.focus Exit Sub End If MapDrive "Z:","\\Server\User Storage\Pupils\" & lisYear.value & "\" & txtName MapDrive "T:","\\Server\student shared$" MsgBox "Network resources have been mapped",64,"DONE" End Sub Sub MapDrive(DriveLetter,DrivePath) If objFSO.DriveExists(DriveLetter) Then objNetwork.RemoveNetworkDrive DriveLetter,true End If objNetwork.MapNetworkDrive DriveLetter, DrivePath, false, txtName.value,txtPassword.value End Sub </SCRIPT> </head> <body> <table> <tr> <td>What is your intake year?</td> <td><select size="1" name="lisYear" id="lisYear"> <option value="Y7">2008</option> <option value="Y8">2007</option> <option value="Y9">2006</option> <option value="Y10">2005</option> <option value="Y11">2004</option> </select></td> </tr> <tr> <td>What is your username?<br/><a>(example: astudent120589)</a></td> <td><input type="text" name="txtName" /></td> </tr> <tr> <td>What is your password?</td> <td><input type="password" name="txtPassword" /></td> </tr> <tr><td> </td><td> </td></tr> <tr><td> </td><td><input type="button" value="Configure resources" id=btnConfigure /></td></tr> </table> </body> </html>
- Marked as answer by Steve Audus Wednesday, January 13, 2010 8:33 AM
Thank you for your work that is brilliant.
Steve
I tried using editv32. When I issued the following command:
Editv32 -p "Password: " -m Passx
TrendMicro gave me a Program Library Injection warning so I blocked it. I just reproduced the situation. Here's the message:
Program Library Injection: EditV32.exe is attempting to configure Windows so that a program library (DLL) is automatically loaded by some or all of your applications. If the DLL is malicious, this change can drastically affect your computer's security and stability.
Perhaps the author could shed some light on what the program is doing that causes this, why the approach is necessary, and why in this case it isn't harmful? I'm a tad reluctant to use any unexamined third-party code to collect a real system password anyway - call me paranoid, no offense is intended but we live in dangerous times - and this warning isn't helping my confidence much...
Thanks,
Lupestro
This is possible with my copyrighted freeware editv32.exe (on 32-bit Windows) and editv64.exe (on 64-bit Windows) programs. For example:Exactly what I was looking for, thanks a million! I personally am using a script to shutdown my file server via putty, and didn't want to have the password sitting in a text file. It was also totally self defeating via 'normal input', when all one had to do was hit the 'up' arrow to view it. :P
editv32 -m -p "Enter the password: " PWD
Program Library Injection: EditV32.exe is attempting to configure Windows so that a program library (DLL) is automatically loaded by some or all of your applications. If the DLL is malicious, this change can drastically affect your computer's security and stability.
I'm the author of EditV32.exe and EditV64.exe. I don't know why TM would be giving you that message. What version are you running?
Bill
Exactly what I was looking for, thanks a million! I personally am using a script to shutdown my file server via putty, and didn't want to have the password sitting in a text file. It was also totally self defeating via 'normal input', when all one had to do was hit the 'up' arrow to view it. :P
You're welcome, and thanks for the feedback.
Bill
Hi The_Cat,
Used your HTA (with very minor tweaks) to solve essentially the same problem -- works a treat, many thanks!
Allan
@AbqBill:
Thank you a lot for EditV32/64, they are very useful! However, I use the following too to convert my bat files to exe and even though it seems to work, the script dies right after I've entered the password. Any clues what I can do to fix it? I would highly appreciate any help on this issue! :)
Screenshot: http://i.imgur.com/Nzp7P.png
http://download.cnet.com/Bat-To-Exe-Converter/3000-2069_4-10555897.html
Hi,
Glad you like the tool. Does your shell script (batch file) work if you don't use this tool to convert it to an EXE?
Bill
Hi,
FYI, I just tried using the "Bat to Exe" converter tool with a script that uses EditV32.exe v2.2 and it worked without problems for me.
Bill
I'd just like to throw my 2 cents in on this old thread:
I was having the same problem when having to mask the password input for mapping a drive. I was able to get around it without using any third party programs or scripts.
If you use the "net use" command and provide the username, the batch file will automatically ask you to enter the password; it doesn't echo any input.
@REM Get username set /P user=Enter your username: @REM Mount drive with provided username, without a variable for a password net use Z: "\\UNC_PATH" * /user:%user%@domain /PERSISTENT:NO
The response will be:
Enter your username: username Type the password for \\UNC_PATH:
I wrote a batch file that included this type of "masking" a few years ago. A situation came up where I needed it, but was unable to find the said batch file. I googled and could not find any information pertaining to this method.
Just thought I'd bring it up!
I use temp vbscript to do the trick. It save the masked password in a temp file
Set USER_=%temp%\user.lck
Set /P User=your account:
Set PwdVBS=%~dpn0-tmp.vbs
echo Set objPassword = CreateObject("ScriptPW.Password") > %PwdVBS%
echo WScript.StdOut.Write "Your password:" >> %PwdVBS%
echo strPassword = objPassword.GetPassword() >> %PwdVBS%
echo Set fso = CreateObject("Scripting.FileSystemObject") >> %PwdVBS%
echo Set LoginFile = fso.CreateTextFile(WScript.Arguments(0), True) >> %PwdVBS%
echo LoginFile.WriteLine(WScript.Arguments(1) ^& "~" ^& strPassword) >> %PwdVBS%
echo LoginFile.Close >> %PwdVBS%
cscript.exe %PwdVBS% //nologo %USER_% %User%
del /q %PwdVBS%
Hi STF1996,
Unfortunately, the ScriptPW.Password object only exists on Windows XP. Your script will not work on anything other than XP (unless you copy the dll file and register it first, of course). So I consider the ScriptPW.Password object a non-portable solution. This is one of the reasons I wrote my utility.
Bill
It seems you're right ;)
thanks for this information because we will migrate to windows 7 this year. As you know, an IT guy cannot avoid to learn about powershell. And after few research, I just test the sample here http://www.via-powershell.fr/index.php/2011/01/credentials/manipulation-des-credentials-via-powershell/ (french)
most of powershell cmd have a -credential parameter but if you want to use a legacy dos cmd you can get password
$Credential
= Get-Credential
$NetworkCredential
= $Credential.GetNetworkCredential()
$User =
"$($NetworkCredential.Domain)\$($NetworkCredential.UserName)"
$Password =
$NetworkCredential.Password
Schtasks.exe /QUERY /S $ComputerName /FO CSV /V /U
$User /P
$Password
I found another solution here: http://blog.magerquark.de/scriptpw-dll-on-windows-2008-and-windows-7-scriptpw-password/
- Proposed as answer by Alexandre Piva Saturday, December 15, 2012 3:09 PM
I found another solution here: http://blog.magerquark.de/scriptpw-dll-on-windows-2008-and-windows-7-scriptpw-password/
That doe nt do what was asked.
Never download exe programs from unknown sources. If this cod eis useful then download the source and compile it.
On Win 7 and Win 6 PowerShell is an easier and safer solution.
To Bill_Stewart:
Hi Bill, I'v seen many of your other comments regarding this same situation. I looked over your website a bit and tried using your method of masking characters. I'm 14 years old and trying to get well acquainted with Windows programming.
I couldn't find any instructions on how to work/use your file to better my education with batch scripts. I found the descriptions of the contents in the download to be lacking enough information to give me a well fit understanding of what the files are, and what they do.
I don't want you to see this as a threatening reply. If you could make these changes, more people could understand, use and enjoy the programs you've made without having to ask any questions on how to operate them.
If you could help that would be great!
This is my current project below. This script allows the user to hide and lock a folder they don't want anyone to get into. I did not come up with this script myself, I found it online. Right now I'm making edits to make it more suitable for me.
Like the main question above I would like to mask the password. If you can walk me through the process that would help a lot. Thanks.
-Konnor
cls @ECHO OFF title Private Folder if EXIST "HTG Locker" goto UNLOCK if NOT EXIST Private goto MDLOCKER :CONFIRM cls echo Are you sure you want to lock the folder(Y/N) set/p "cho=>" if %cho%==Y goto LOCK if %cho%==y goto LOCK if %cho%==n goto END if %cho%==N goto END cls echo Invalid choice. ping localhost -n 5 >nul goto CONFIRM :LOCK ren Private "HTG Locker" attrib +h +s "HTG Locker" cls echo Folder locked ping localhost -n 2 >nul goto End :UNLOCK cls echo Enter password to unlock folder set/p "pass=>" if NOT %pass%== YOUR-PASS-HERE goto FAIL attrib -h -s "HTG Locker" ren "HTG Locker" Private cls echo Folder Unlocked successfully ping localhost -n 2 >nul goto End :FAIL cls echo Invalid password ping localhost -n 3 >nul goto UNLOCK :MDLOCKER md Private cls echo Private created successfully ping localhost -n 1 >nul goto End :End
- Edited by Konman5 Wednesday, June 18, 2014 5:05 PM Needed Directory to Specific User
Here is a sample that uses editv32.exe (you must use editv64.exe if you are running 64-bit Windows):
This is the UNIX way of reading keyboard input without echo:
stty -echo; read PASSWORD; stty echo; echo ""
I have confirmed this syntax to work in Cygwin under Windows.
Microsoft offers an environment that likely includes this capability in their "Services For UNIX" product.