Powershell script to login with a specific user - powershell

I am looking for a script that will help me "lock" a computer with a specific username.
To give an example, John works in a company where every employee can use any computer to login, but John is tired to clean up the mess and leftovers from his colleagues at the office, so, he decided to run a powershell script in Gpedit.msc --> User Configuration --> Windows Settings --> Scripts (Logon/Logoff), or a generic script on the computer to, whenever the computer is rebooted, turned off or, logged off, only his username will ask for credentials. Basically, what I need is to "lock" that computer with a specific user ID, even if it's turned off, rebooted or logged off, only that user ID will show and prompt for password. The computer is always within the network, the user ID does not have administrator rights as the only thing is used on the computer is Internet Explorer to login to a webpage, but my point is the script that I need. A script that enables the "lock" with the specific user ID and a script that disables the "lock", as, I leave on long periods and the place at the computer is free for carnage. And no, I cannot just simply hit Win+Del keys because with a simple reboot, the computer will not remain with the user ID.
Also, I just need the computer to show up with the specific user and always ask for password. I do not need to automatically login.
I tried to search on the internet the specific script or some commands that I can play with, but I did not find something. Can someone help me shed some light on this please?
Thank you!

I'm not sure how an actual script would look, but I know you can lock certain users to only be able to log into certain computers (assuming its an AD domain). Does that help at all?

Related

Log off multiple users and then log them back in at a specific time in powershell

So we have a system that seems to keep producing errors around a specific time each day. We are in the process of working with the vendor to resolve the issue, but for the time being I am looking for a solution that might be a work around. I know that you can logoff a user with Powershell, but I would like to try and login a user. Is there a way to login a user with an encrypted password? Also, I would like to run this script at a specific time each day.

RDP MSTSC no logon screen?

Good day to you all!
Guys tell me what I can not find, in short, there is a domain theme - right-click on the account = change password, check the box: The user must change the password... Type a temporary password for example 123456
Ideally and on many DC machines with mstsc or other client, type in the address of the RDS machine, 1. A logon window appears and then you are asked to enter your login and password, we enter our login and password 123456, then in the same logon it asks you to change your password... This is configured in the GPO and so on, but here's the thing, there are controllers or PCs which terminal server is configured so that the logon window is not issued and immediately at the above request to change the password this window is issued: https://i.stack.imgur.com/PAk4V.jpg
In short! Here's the solution!
Make an account that will not be in any group of the domain, or rather make the group empty and put it the main user, removing even from the group domain users.
We add this user to the remote desktop group on the farm gateway only.
Then we write in ANY client properties of this user together with login, password, domain, ONLY in the gateway section.
In the same connection settings write the PC (usually the 1st PC in the farm), which needs to connect.
Everything. Profit. Thank you all. The solution was found by the collective mind of my team, for which she and I, including a BIG THANK YOU!

remote change a network drive location - powershell

i got tasked with decommissioning an old file server.
so now i would like to move user files from it to another server.
however i need to change the user's home drive without logging them off (desktops in locked state).
a few assumptions can be made for the of this question.
1)i know the user's computer name
2)the user does not have any files in a locked/open state
3)i have powershell v4
4)i have access over AD
5)i do not have the user's password
an idea i had was to try and make a credential object based on a user's AD entry and then use New-PSDrive to make a persistent remap of the drive. i don't need to see a user's clear-text password if i can make a credential object from an encrypted password.
might i be on the right track or did i derail somewhere?
It's usually much easier to make the new server answer to multiple netbios names so the old drive mappings still work with the new server.
http://windowsitpro.com/networking/how-can-i-define-multiple-netbios-names-machine

AHK script to login into Windows 7 system

I run a small internet cafe of 15 computers (Windows 7). I have created an admin account and a user account on all of them.
From my own machine at the cash counter, I wish to control login to user accounts on the above machines. (Customer comes, says will sit on system 5, i click a shortcut and system 5 logins with necc. details and customer goes and starts his work). How do I go about doing this?
I have explored Sendkeys, nirsoft's nircmd, powershell calls etc. Nothing seems to work. There are two screens involved. First is the MS logon pictures that need to be clicked, then the password screen followed by 'Enter'.
I am assuming I wish to send something like: AHK_myscript \system1 "user" "password"
Please let me what I need to get past these two screens. (Also have uVNC running, if it helps). Thanks in advance.

Use Powershell to change password on login

At the moment I'm building a login Script on powershell basis.
This login script should be able to change the users Password on login and change it back to the original on logout.
Problem here being that I want to change a Password of a domain user, the same user as the one who is logged in obviously
Now I found some neat stuff like the old, net.exe. but it all says I don't have the rights to change the password in the Domain.
I really can't believe that this is something impossible cause the user himself can change the password too.
Otherwise I'd have to find out how to run a login script with a domain admin...
Edit:
ok I'll try to explain our setup we have a so called VMware View environment, in which every user can login once. now we have the problem that there are accounts with generally known passwords, and some people find it highly amusing to steal others sessions. I've thought about it and making a little script that changes and then resets the password would be a neat little solution. I hope I was of help^^
It would be really helpfull if I could get some thoughts on this
Thanks in advance
This link might help you.
Also, according to the link above, you need to be on the domain controller to use net to change password (or supply the "/domain" option).