Using PowerShell to prevent desktop lockouts...



Hola Everyone,

Today i wont talk too much because I am kinda loaded, As you see from the heading I wrote these two scratches which will prevent's your desktop from getting lockout.


Normally a PC in a domain will be forced to obey some rules, the rules that comes from group policy.

One of these famous rules are the lock out time of desktops when the desktop is idle and not used. This can be a problem sometimes specially if the PC is running some process which will be affected some how in case the PC got locked.

As rory gallagher used to say on some of his gig's, LETS GET TO WORK!!! :


This code Send keys(TAB key) to make the system feel that it's not idle :


# Code start here

while ($true){
# wait for 40 seconds every time before it hit the key
Start-Sleep -seconds 40
[System.Windows.Forms.SendKeys]::SendWait("{%}") | out-null


# Code end here


And this one which I prefer, which will move the mouse a little bit to the right side of the X axis:


# Code start here

while ($true){
# wait for 40 seconds every time before it move the mouse
Start-Sleep -seconds 40

$Place = [System.Windows.Forms.Cursor]::Position
[System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point((($Place.X) + 1) , $Place.Y)



# Code end here

Any way, I think I am finished here, I gotta go, Hasta luego todos.....




Comments

Popular posts from this blog

IP Calculator in PowerShell...with IP exclusion