BetaLeaf

How do I Switch to a Specific User on the local machine?

23 posts in this topic

#1 ·  Posted (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 by BetaLeaf
clarification

False Positive Reporter - Mass email all anti virus vendors with an attachment of your program for fast and easy whitelisting.

PortableApps.com App Creation Wizard  - A simple GUI-based Wizard for creating PortableApps.

SoundBoard - Play any song or sound you want at the press of a hotkey.

My GitHub Page: https://github.com/BetaLeaf

Share this post


Link to post
Share on other sites



 

Hopefully this helps. Maybe one of the old AutoIt gods can help write up the appropriate dllstructs to login.

Share this post


Link to post
Share on other sites
25 minutes ago, InunoTaishou said:

 

Hopefully this helps. Maybe one of the old AutoIt gods can help write up the appropriate dllstructs to login.

That is also well outside my area of knowhow.


False Positive Reporter - Mass email all anti virus vendors with an attachment of your program for fast and easy whitelisting.

PortableApps.com App Creation Wizard  - A simple GUI-based Wizard for creating PortableApps.

SoundBoard - Play any song or sound you want at the press of a hotkey.

My GitHub Page: https://github.com/BetaLeaf

Share this post


Link to post
Share on other sites

Maybe Runas?


BlueBearrOddly enough, this is what I do for fun.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#7 ·  Posted (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 by BetaLeaf

False Positive Reporter - Mass email all anti virus vendors with an attachment of your program for fast and easy whitelisting.

PortableApps.com App Creation Wizard  - A simple GUI-based Wizard for creating PortableApps.

SoundBoard - Play any song or sound you want at the press of a hotkey.

My GitHub Page: https://github.com/BetaLeaf

Share this post


Link to post
Share on other sites
1 hour ago, JohnOne said:

So what you basically want to do is automate "Switch User"?

Pretty much. I have no clue as to even how to approach this.


False Positive Reporter - Mass email all anti virus vendors with an attachment of your program for fast and easy whitelisting.

PortableApps.com App Creation Wizard  - A simple GUI-based Wizard for creating PortableApps.

SoundBoard - Play any song or sound you want at the press of a hotkey.

My GitHub Page: https://github.com/BetaLeaf

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#11 ·  Posted (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 by rudi

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites

How do I abuse the autologon function? Do I have to restart my computer for this to work?


False Positive Reporter - Mass email all anti virus vendors with an attachment of your program for fast and easy whitelisting.

PortableApps.com App Creation Wizard  - A simple GUI-based Wizard for creating PortableApps.

SoundBoard - Play any song or sound you want at the press of a hotkey.

My GitHub Page: https://github.com/BetaLeaf

Share this post


Link to post
Share on other sites

Last year this has worked for me:

(User to visitor switch) >runas /user:visitor "explorer /separate"

Share this post


Link to post
Share on other sites
35 minutes ago, PACaleala said:

Last year this has worked for me:

(User to visitor switch) >runas /user:visitor "explorer /separate"

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?


False Positive Reporter - Mass email all anti virus vendors with an attachment of your program for fast and easy whitelisting.

PortableApps.com App Creation Wizard  - A simple GUI-based Wizard for creating PortableApps.

SoundBoard - Play any song or sound you want at the press of a hotkey.

My GitHub Page: https://github.com/BetaLeaf

Share this post


Link to post
Share on other sites
4 hours ago, 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.

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.


False Positive Reporter - Mass email all anti virus vendors with an attachment of your program for fast and easy whitelisting.

PortableApps.com App Creation Wizard  - A simple GUI-based Wizard for creating PortableApps.

SoundBoard - Play any song or sound you want at the press of a hotkey.

My GitHub Page: https://github.com/BetaLeaf

Share this post


Link to post
Share on other sites

#17 ·  Posted (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 by InunoTaishou

Share this post


Link to post
Share on other sites
Just now, 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.

 

 

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.


False Positive Reporter - Mass email all anti virus vendors with an attachment of your program for fast and easy whitelisting.

PortableApps.com App Creation Wizard  - A simple GUI-based Wizard for creating PortableApps.

SoundBoard - Play any song or sound you want at the press of a hotkey.

My GitHub Page: https://github.com/BetaLeaf

Share this post


Link to post
Share on other sites
3 hours ago, 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.

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.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.