11 October 2007

Ask admin why they are logging on

I went on an interesting question over newsgroups.. Someone posted "how to request why admin are logging on?"
He wanted something like when rebooting a 2003 server. While you can't do this through GPO, i wrote a little vbscript to make this.
It open a messag box, popping the question. Then i add an application event with username and comments or a message indicating he refused to explain.

Here is the script:
' NAME: <>
' AUTHOR: Mathieu CHATEAU, gollum123@free.fr
' DATE : 11/10/2007
option explicit
Dim msg, objshell,UserName
Set objShell = Wscript.CreateObject("Wscript.Shell")
UserName = objShell.ExpandEnvironmentStrings("%username%")

msg = InputBox("Why are you logging?")
if msg = "" then
msg="refused to say why"
end if

objShell.LogEvent EVENT_SUCCESS, UserName & " logged on because:" & msg
Set objShell = Nothing

No comments: