Admin Login for batch file?
I was originally trying to use a registry edit to have a batch file run print migrator with out have to exit and separately run it as admin. I am trying to use runas /user:mymachine\administrator "c:\lprtmp\printmig /r printer.cab" However, no matter what I put there, it wont run correctly. Every time I enter the correct password if throws out the error "1326: Logon Failure: unkown user name or bad password". How do I solve this error and is there a way to have an login box pop up to log in as your admin instead of trusting that the users will understand the command propmt?
January 22nd, 2010 9:54pm

Hi there, Since this is a authentication error, not sure if you have input the correct password when got the prompting pop-up for password (have you check CapsLock?) 1. I’ve noticed that there is another thread http://social.technet.microsoft.com/Forums/en-US/w7itprogeneral/thread/33a78e28-1289-45ae-9657-557482b88997/ Please let us know the steps you have completed before encountered this error 1326.2. I suggest you use a domain admin account to run this command as a test as printmig requires so.3. Do you have the same error when try to launch other programs?I’ve use the following command as a test and there is no error message encountered.runas /user:mymachine\gordon7 "d:\download\test.exe"
Free Windows Admin Tool Kit Click here and download it now
January 25th, 2010 10:18am

No, I am looking to how to create the password popup (requiring user name and password and then use them in variables for the command) and do I have the syntax of the command right? As far as the other thread, I am creating a batch file to be used on other peoples laptops and turning off the UAC wasnt the greatest idea I had. This will require them to enter their password and user name to run it as administrator. Basically, I want to run the printmig.exe as admin via the command prompt.
January 25th, 2010 6:50pm

Yes, the syntax is correct but the current error is more user/password related. I’m still wondering if you have the same error when try to launch other programs or use another domain admin account/password. Meanwhile, you can consider use lsrunase.exe which allows you to provide a password in the command and that would help you bypass Password requests prompting:Method 3 in http://www.404techsupport.com/2008/01/09/run-as-trick-to-work-as-an-admin-without-logging-somebody-off/
Free Windows Admin Tool Kit Click here and download it now
January 26th, 2010 8:27am

I do get the same with other programs, not sure why but I am looking into it. This batch file will be running on multiple users laptops so I can not know their passwords. This is why I was wanting to know how to create a message box that will ask for username/password and then I can use them as variables in the command or if there was (IE:sometimes leaving the username blank) that the command could force the user to type it in.
January 27th, 2010 4:54pm

Pls understand that Runas need an account name as parameter and you have to find another method/command to pop-up password window with changeable account name. you mentioned “get the same with other programs”, do you have any error even when right click (+press Shift) and click “run as different user” and input the password for same account?
Free Windows Admin Tool Kit Click here and download it now
January 28th, 2010 10:10am

as far as the other programs, it was that the account I was using wasnt set as admin. Fixed that. do you know if there is a way to use msgbox command to ask for the username and password?
January 28th, 2010 5:23pm

UPDATE: Decided to somewhat abandon the normal login popup look. Using vbscript to get the user name that the user is logged in as but still asks for the password. Here it is: Dim objNetwork Set objNetwork = CreateObject("WScript.Network") strUserName = objNetwork.UserName strPasswrd = InputBox("Enter password for " &strUserName) Set fs = CreateObject("Scripting.FileSystemObject") strFileName = fs.BuildPath(Wscript.ScriptFullName & "\..", "~userin.bat") strFileName = fs.GetAbsolutePathName(strFileName) Set ts = fs.OpenTextFile(strFileName, 2, True) ts.WriteLine "set usrname=" & strUserName ts.WriteLine "set passwrd=" & strPasswrd ts.Close However the password is readable to anyone who looks over the shoulder. I want to mask it, however I can not get [code] Set objPassword = CreateObject("ScriptPW.Password") [/code] to work. It says it can not create the object. Any Ideas?
Free Windows Admin Tool Kit Click here and download it now
January 28th, 2010 9:51pm

Hi, As you may know, VBScript dose not supports password masking. Refer to:http://blogs.technet.com/heyscriptingguy/archive/2005/02/04/how-can-i-mask-passwords-using-an-inputbox.aspx The good news is that you can consider use other dll or ocx support this feature, there is a useful link for this discussion:http://www.tek-tips.com/viewthread.cfm?qid=637366&page=396
January 29th, 2010 7:15am

As you may know, VBScript dose not supports password masking. Refer to: http://blogs.technet.com/heyscriptingguy/archive/2005/02/04/how-can-i-mask-passwords-using-an-inputbox.aspx I did know that, but I just wanted to make sure that was one of the best ways. I somewhat got it to work, kinda. I had to download the DLL file and then register it to be able to use it. However, where I am having issue still is inside the inputbox itself. how do I get strPassword = objPassword.GetPassword() to work inside strPasswrd = InputBox("Enter password for " &strUserName) ? any ideas?
Free Windows Admin Tool Kit Click here and download it now
January 29th, 2010 11:46pm

Hi, I assume that you using the dll file from http://www.tek-tips.com/viewthread.cfm?qid=637366&page=396 Since the current issue you need to fix is more related to script coding, I suggest you open a thread in the Official Scripting Guys Forum in TechNet so someone who is more familiar with scripting can provide helpful suggestions, and you can have the issue resolved in a timely manner.http://social.technet.microsoft.com/Forums/en/ITCG/threads what do you think about it?
February 1st, 2010 4:18am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics