EmilyLove Posted February 25, 2016 Posted February 25, 2016 (edited) So here's the setup. I have 2 users, one being my personal Microsoft account, the other being a Local account called "Visitor" with a password of "Guest". I want to switch to the user "Visitor" automatically. I have a function that will execute code now all I need is the code that actually switches users. Unfortunately, after spending an hour searching AutoIt forums and Google for various synonyms for "switch user" I have run into a wall and need to ask the community. I've tried Send/MouseClick to automate it but after I get the the point where I am past the Windows 10 Lockscreen (foreground image) and can select another user, it stops accepting these commands. Edit: Loving the enthusiasm, but everyone is missing what I'm trying to do. Let me clarify. On this Visitor user, I have it load a custom shell I wrote that loads a program and, when it closes, logs the user out. I want to be able to use this shell but I cannot do so unless I can switch users. I also want to remain logged into whatever account I am logged in atm when I activate the code I'm looking for. So If I am currently logged into an account named User then I just want it to switch from User to Visitor and leave User still logged in but no longer active. If I have music running in the background of user, I should not hear it on Visitor. Visitor should be the active session. Edited February 26, 2016 by BetaLeaf clarification
InunoTaishou Posted February 26, 2016 Posted February 26, 2016 Hopefully this helps. Maybe one of the old AutoIt gods can help write up the appropriate dllstructs to login.
EmilyLove Posted February 26, 2016 Author Posted February 26, 2016 On 2/26/2016 at 12:09 AM, InunoTaishou said: Hopefully this helps. Maybe one of the old AutoIt gods can help write up the appropriate dllstructs to login. Expand That is also well outside my area of knowhow.
bluebearr Posted February 26, 2016 Posted February 26, 2016 Maybe Runas? BlueBearrOddly enough, this is what I do for fun.
kylomas Posted February 26, 2016 Posted February 26, 2016 Search the forum for "logonuser"... Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
jdelaney Posted February 26, 2016 Posted February 26, 2016 There are also registry keys you can use to autologon. Keep in mind that the credentials on anything less than windows 10 will be unencrypted. Set those registry values (google them), then execute a restart command, and it will auto login as that user. IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
EmilyLove Posted February 26, 2016 Author Posted February 26, 2016 (edited) Loving the enthusiasm, but everyone is missing what I'm trying to do. Let me clarify. On this Visitor user, I have it load a custom shell I wrote that loads a program and, when it closes, logs the user out. I want to be able to use this shell but I cannot do so unless I can switch users. I also want to remain logged into whatever account I am logged in atm when I activate the code I'm looking for. So If I am currently logged into an account named User then I just want it to switch from User to Visitor and leave User still logged in but no longer active. If I have music running in the background of user, I should not hear it on Visitor. Visitor should be the active session. Edited February 26, 2016 by BetaLeaf
JohnOne Posted February 26, 2016 Posted February 26, 2016 So what you basically want to do is automate "Switch User"? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
EmilyLove Posted February 26, 2016 Author Posted February 26, 2016 On 2/26/2016 at 5:51 AM, JohnOne said: So what you basically want to do is automate "Switch User"? Expand Pretty much. I have no clue as to even how to approach this.
JohnOne Posted February 26, 2016 Posted February 26, 2016 I'm not sure you can, it means you need to interact with the logon screen, which for obvious security reasons is forbidden. Search the web, you'll find the basic same answer everywhere. That's probably why you were getting the answers you were earlier, there are correct and safe ways to do tasks in the context pf another user. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
rudi Posted February 26, 2016 Posted February 26, 2016 (edited) Hello. You could try to *ABUSE* the autologon function: When this is activated, a logoff will re-logon immediately with the credetials saved in the registry. See Microsoft kb324737 A logoff can be done by autoit. When you want to prevent windows from doing an immediate, automatic re-logon, (so that the regular user has a chance to logon using his accountwhen you did a logoff, then press and hold CTRL (or was it SHIFT?) while logging off, until the regular logon screen will show up. Then you can login as the "regular user". Regards, Rudi. Edited February 26, 2016 by rudi Earth is flat, pigs can fly, and Nuclear Power is SAFE!
EmilyLove Posted February 28, 2016 Author Posted February 28, 2016 How do I abuse the autologon function? Do I have to restart my computer for this to work?
PACaleala Posted February 29, 2016 Posted February 29, 2016 Last year this has worked for me: (User to visitor switch) >runas /user:visitor "explorer /separate"
EmilyLove Posted February 29, 2016 Author Posted February 29, 2016 On 2/29/2016 at 12:00 AM, PACaleala said: Last year this has worked for me: (User to visitor switch) >runas /user:visitor "explorer /separate" Expand You misunderstand what im trying to do. 1. While staying logged in, go to Window's Login Screen. 2. Select the User "Visitor". (from a Windows 10 Computer) 3. Enter the User's password. 4. Login as Visitor. What I'm looking for is the Visitor should be the active session and the previous one should remain logged in but inactive. This way I can have a friend over and let them check their email on a Visitor User Account while still protecting my session. I'm aware of the Guest account but that isn't what I'm looking for. I just want to switch users while remaining logged in the the previous session, but the previous session should not be accessible to Visitor. Do you all understand what I'm trying to do?
JohnOne Posted February 29, 2016 Posted February 29, 2016 Do you and your friend have no fingers? Seriously, I really doubt this is possible, unless perhaps you make a custom keyboard driver and able to instruct it to send real keystrokes. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
EmilyLove Posted February 29, 2016 Author Posted February 29, 2016 On 2/29/2016 at 2:07 AM, JohnOne said: Do you and your friend have no fingers? Seriously, I really doubt this is possible, unless perhaps you make a custom keyboard driver and able to instruct it to send real keystrokes. Expand The idea is to have a key on my keyboard (Pause/Break) that has a label on it that says "Visitor Access". Pressing this key would load them into the Visitor User Account where they could check their email or play games or w/e.
InunoTaishou Posted February 29, 2016 Posted February 29, 2016 (edited) Win+L or use the lockworkstation function and click the other account? We know what you want but I don't know how to do it and the code to do it is complex and sounds almost unnecessary for what you are trying to accomplish. Maybe you'll get lucky and one of the more experienced members might know how to do this but at this point your best bet is probably researching how to do it on msdn and seeing if you can convert it to autoit or pack it up into a dll and use a dllcall. Edited February 29, 2016 by InunoTaishou
EmilyLove Posted February 29, 2016 Author Posted February 29, 2016 On 2/29/2016 at 6:38 AM, InunoTaishou said: Win+L or use the lockworkstation function and click the other account? We know what you want but I don't know how to do it and the code to do it is complex and sounds almost unnecessary for what you are trying to accomplish. Expand That's why I have asked for help. This is well outside my area of know-how. If anyone has code that can get this done, please post it.
InunoTaishou Posted February 29, 2016 Posted February 29, 2016 http://stackoverflow.com/search?page=1&tab=relevance&q=unlock%20workstation It looks like after Vista something like this isn't even possible without rewriting the credential module used to log in users.
JohnOne Posted February 29, 2016 Posted February 29, 2016 On 2/29/2016 at 6:23 AM, BetaLeaf said: The idea is to have a key on my keyboard (Pause/Break) that has a label on it that says "Visitor Access". Pressing this key would load them into the Visitor User Account where they could check their email or play games or w/e. Expand I know what the idea is, I don't see the point of it since you can just click on "switch user" manually if your friend is there and let him type his password. But there is no confusion about you wanting to automate this process. Do you understand why you are not able to do it? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Recommended Posts