Display a dialog upon login asking for the login reason – Windows Server [closed] – Managing your servers can streamline the performance of your team by allowing them to complete complex tasks faster. Plus, it can enable them to detect problems early on before they get out of hand and compromise your business. As a result, the risk of experiencing operational setbacks is drastically lower.
But the only way to make the most of your server management is to perform it correctly. And to help you do so, this article will share nine tips on improving your server management and fix some problem about windows, login, dialog, , .
I’m looking for a way to display an input dialog upon login to a production server, asking the user to indicate the reason of the login. I was thinking maybe there’s a way in Windows to do it that is similar to the Shutdown dialog that is displayed whenever a server is restarted.
I’ve looked in the Group Policy but couldn’t find anything useful. I know this can be done by a script but I was looking to see if there’s any integrated way in Windows before I start writing it.
I ended up writing the following VBScript and set it to run on Logon in the GPO
' Display an input dialog asking the reason for a login and writes it to the event viewer with information of the user. Const EVENT_TYPE = "Information" 'Available Values: Success, Error, Warning, Information Const EVENT_SOURCE = "LoginAudit" 'Setting the event source requires that the script runs with administrative privileges firstname = GetUserFirstname() username = GetUsername() loginReason = "" Do While (loginReason = "") loginReason = InputBox("Hi " + firstname + ", please describe the reason of your login:", "Login Audit") Loop eventDescription = "User '" & username & "' logged in, providing the following reason: " & Chr(13) & Chr(13) & loginReason Set WshShell = WScript.CreateObject("WScript.Shell") strCommand = "eventcreate /T " & EVENT_TYPE & " /ID 100 /L Application /SO LoginAudit /D " & _ Chr(34) & eventDescription & Chr(34) WshShell.Run strcommand Function GetUserFirstname() Set objSysInfo = CreateObject("ADSystemInfo") Set objCurrentUser = GetObject("LDAP://" & objSysInfo.UserName) GetUserFirstname = objCurrentUser.givenName End Function Function GetUsername() Set objNetwork = CreateObject("Wscript.Network") GetUsername = objNetwork.UserName End Function
I was looking to see if there’s any integrated way in Windows before I start writing it.
No, there isn’t. You’re going to have to write it yourself I’m afraid. There might be a third party application that does what you want, but I’m afraid product/service recommendations are off topic here on Server Fault.