Morning All
I have a powershell script that pings computers and pulls the logged on user. The script then spits out an html page with that information. There is one case I can't figure out and that is the case when the lower locks his computer and walks away. In the case the user might be long gone but the computer still shows he is logged in.
I know I can solve this by either
1) changing power profiles so computer sleeps/shutdowns after moments of inactivity.
2) Scheduled tasks that runs when computer locks computer .
I am trying to work with 2. In win 7 you can run a script/bat file when the user locks the computer. I created environmental variables to keep track of when the computer is locked by the user( he/she does a windows key + l). So when they lock it I set a variable lock to true and another variable with a time stamp. Then with powershell I can query those variables and figure out if the computer is locked.
The logic makes sense but its not working. The script doesn't seem to change the environmental variables. I am using setx. Maybe users without admin privileges can't change environmental variables?
Any insights/ideas into how to implement this would truly be appreciated.
Rod
I have a powershell script that pings computers and pulls the logged on user. The script then spits out an html page with that information. There is one case I can't figure out and that is the case when the lower locks his computer and walks away. In the case the user might be long gone but the computer still shows he is logged in.
I know I can solve this by either
1) changing power profiles so computer sleeps/shutdowns after moments of inactivity.
2) Scheduled tasks that runs when computer locks computer .
I am trying to work with 2. In win 7 you can run a script/bat file when the user locks the computer. I created environmental variables to keep track of when the computer is locked by the user( he/she does a windows key + l). So when they lock it I set a variable lock to true and another variable with a time stamp. Then with powershell I can query those variables and figure out if the computer is locked.
The logic makes sense but its not working. The script doesn't seem to change the environmental variables. I am using setx. Maybe users without admin privileges can't change environmental variables?
Any insights/ideas into how to implement this would truly be appreciated.
Rod