To lock a computer using PowerShell, use the old school command prompt and invoke the command in PowerShell.
This can be handy to lock a computer and use Task Scheduler, to run the script at an specified time.
Link below shows on how to set Task Scheduler:
http://quickbytesstuff.blogspot.sg/2014/03/how-to-set-windows-task-scheduler.html
Below is the PowerShell code to lock a computer:
$xCmdString = {rundll32.exe user32.dll,LockWorkStation}
Invoke-Command $xCmdString
Try to run the code on PowerShell ISE to see how it works. It will just lock the computer, and you will need to press Ctrl+Alt+Delete and enter your password to login again.
==============
Catholic Rosary Guide for Android:
Pray the Rosary every day, countless blessings will be showered upon your life if you recite the Rosary faithfully.
https://play.google.com/store/apps/details?id=com.myrosaryapp
https://play.google.com/store/apps/details?id=com.myrosaryapp
http://quickbytesstuff.blogspot.sg/2014/09/how-to-recite-rosary.html
This does not seem to work if you are logged in using the open ssh server in windows 10. same code works if you are the machine but not if your using open ssh. I am in a powershell session and not cmd.
ReplyDeleteSame method as a one-liner:
ReplyDeleteInvoke-command {rundll32.exe user32.dll,LockWorkStation}