Sunday, May 29, 2016

How to execute Script and Command when Log off

Usually, we use Task Scheduler for executing which one of Script or Command while you are login. But we can not use that way to log off. To do this we need to use Local Group Policy Editor in Windows system.

Let's create a simple script make computer tell hour while you logoff.
Objective: understanding about using Local Group Policy Editor.

Creating Batch file with VBScript

1. open notepad for writing script below:
cscript %userprofile%\desktop\time.vbs



2. then save as batch file "logoff.batch".

Local Group Policy Editor

To open local group policy you can press Key Windows + R then type gpedit.msc.


after that it will show popup of Local Group Policy. In the left side  panel go to User Configuration -> Windows Setting -> Scripts (Logon/Logoff) then double click on Logoff to open property.



Next click add to browse batch file that we have created then click Ok.

Watch this video:

No comments:

Post a Comment