我正在寻找一种方法来显示input对话框login到生产服务器,要求用户指出login的原因。 我在想,也许在Windows中有一种方法可以实现,就像服务器重新启动时显示的“closures”对话框一样。
我查看了组策略,但找不到任何有用的信息。 我知道这可以通过脚本来完成,但我开始编写之前正在查看Windows中是否有任何集成方式。
谢谢
我结束了写下面的VBScript并将其设置为在GPO中的login上运行
' 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
在开始编写之前,我正在查看是否有任何Windows集成方式。
不,没有。 恐怕你得自己写。 有可能是第三方应用程序,你想要什么,但我担心产品/服务的build议是关于服务器故障这里的话题。