{"id":29,"date":"2009-10-26T19:41:44","date_gmt":"2009-10-26T15:41:44","guid":{"rendered":"http:\/\/msbro.ru\/?p=29"},"modified":"2009-12-31T14:04:08","modified_gmt":"2009-12-31T10:04:08","slug":"kak-opredelit-kogda-polzovatel-sovershil-poslednijj-vkhod-v-sistemu","status":"publish","type":"post","link":"https:\/\/msbro.ru\/index.php\/archives\/29","title":{"rendered":"\u041a\u0430\u043a \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0441\u043e\u0432\u0435\u0440\u0448\u0438\u043b \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0432\u0445\u043e\u0434 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443?"},"content":{"rendered":"<p>\u0418\u043d\u043e\u0433\u0434\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0441\u043e\u0432\u0435\u0440\u0448\u0438\u043b \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0432\u0445\u043e\u0434 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443.<br \/>\n\u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435 \u0434\u043e\u043c\u0435\u043d\u0430<br \/>\n<!--more--><\/p>\n<p>Add User Account Information to Active Directory Users and Computers<br \/>\nby Daniel Petri &#8211; January 7, 2009<\/p>\n<p>How can I add additional user account information option to the Active Directory Users and Computers context menu?<\/p>\n<p>As seen in the Add Unlock User Option to Active Directory Users and Computers article, many of the daily tasks of a network administrator is to monitor user accounts, logo activities, password changes and account options, such as disabling and enabling user accounts, and also looking for logon information for the user account.<\/p>\n<p>One method of viewing additional information about user accounts is by using the Acctinfo.dll add-in for Active Directory Users and Computers (as explained in the View Additional User Information in AD Users and Computers article).<\/p>\n<p>Another method is by adding some right-click (context menu) options to the user account objects. By right-clicking a user object you will be able to view some more information about any user account you want, information that includes the last logon time, the user&#8217;s logon script, the last time the user has changed his or her password and so on.<br \/>\nWriting the script<\/p>\n<p>First we need to write a small VBS script (I thank Antid0t for the insight). It will be used as a context menu option on any user account object.<\/p>\n<p>I guess the script could be done in a better way, and if any of you have a good suggestion please send it over .<\/p>\n<p>On Error Resume Next<\/p>\n<pre><em>\r\n\r\nSet wshArguments = WScript.Arguments\r\nSet objUser = GetObject(wshArguments(0))\r\n\r\nstr1 = \"Last Login: \" &amp; objUser.LastLogin\r\nstr2 = \"Last Logoff: \" &amp; objUser.LastLogoff\r\nstr3 = \"Last Failed Login: \" &amp; objUser.LastFailedLogin\r\nstr4 = \"Logon Count: \" &amp; objUser.logonCount\r\nstr5 = \"Bad Login Count: \" &amp; objUser.BadLoginCount\r\nstr6 = \"Password Last Changed: \" &amp; objUser.PasswordLastChanged\r\nstr7 = \"User Account Control: \" &amp; objUser.userAccountControl\r\nstr8 = \"Login Script: \" &amp; objUser.scriptPath\r\nstr9 = \"Account Created: \" &amp; objUser.whenCreated\r\nstr10 = \"Account Last Modified: \" &amp; objUser.whenChanged\r\n\r\nMsgBox str1 &amp; vbCrLf &amp; str2 &amp; vbCrLf &amp; str3 &amp; vbCrLf &amp; str4 &amp; vbCrLf &amp; str5 &amp; vbCrLf &amp; str6 &amp; vbCrLf &amp; str7 &amp; vbCrLf &amp; str8 &amp; vbCrLf &amp; str9 &amp; vbCrLf &amp; str10,,objUser.Name\r\n\r\n<\/em><\/pre>\n<p>Save the script as USER_LOGON_INFO.VBS.<\/p>\n<p>Place the script in a share on one of your DCs, preferably in the NETLOGON share, thus replicating it to all of your DCs. Note that this change is a forest wide change, so each and every DC in the forest should have access to this script.<br \/>\nAdding the option to the context menu<\/p>\n<p>You now need to add the context menu options to user account objects in AD. To do so you need the following:<\/p>\n<p>1.      ADSIEdit.MSC &#8211; found in the Windows 2000\/2003 Support Tools (located on the installation CD)<br \/>\n2.      Enterprise Admin permissions<\/p>\n<p>User account context menu:<\/p>\n<p>1.      After installing the Support Tools, open ADSIEdit.MSC and navigate to the following path:<\/p>\n<pre><em>\r\n\r\nCN=user-Display,CN=409,CN=DisplaySpecifiers,CN=Configuration,DC=dpetri,DC=net\r\n\r\n4, &amp;Show Logon Info,\\\\zeus\\netlogon\\user_logon_info.vbs\r\n\r\n<\/em><\/pre>\n<p>Lamer note: Change the path to fit your own domain name&#8230;<\/p>\n<p>2.      Right-click on the user-Display object and select Properties.<br \/>\n3.      The first attribute in the list of attributes for the object should be adminContextMenu. Double-click it or click on the Edit button.<\/p>\n<p>5.      When done, click Add to add the line, then click Ok.<br \/>\n6.      Close ADSIEdit.MSC.<\/p>\n<p>Testing<\/p>\n<p>In order to test the context menu addition you&#8217;ll need to close DSA.MSC if it was open, and re open it.<\/p>\n<p>Right-click the user account you want to query and select the new context menu &#8211; Show Logon Info.<\/p>\n<pre><em>\r\n\r\n**************\r\nUSER_LOGON_INFO.VBS\r\n**************\r\n\r\nOn Error Resume Next\r\n\r\nSet wshArguments = WScript.Arguments\r\nSet objUser = GetObject(wshArguments(0))\r\n\r\nstr1 = \"Last Login: \" &amp; objUser.LastLogin\r\nstr2 = \"Last Logoff: \" &amp; objUser.LastLogoff\r\nstr3 = \"Last Failed Login: \" &amp; objUser.LastFailedLogin\r\nstr4 = \"Logon Count: \" &amp; objUser.logonCount\r\nstr5 = \"Bad Login Count: \" &amp; objUser.BadLoginCount\r\nstr6 = \"Password Last Changed: \" &amp; objUser.PasswordLastChanged\r\nstr7 = \"User Account Control: \" &amp; objUser.userAccountControl\r\nstr8 = \"Login Script: \" &amp; objUser.scriptPath\r\nstr9 = \"Account Created: \" &amp; objUser.whenCreated\r\nstr10 = \"Account Last Modified: \" &amp; objUser.whenChanged\r\n\r\nMsgBox str1 &amp; vbCrLf &amp; str2 &amp; vbCrLf &amp; str3 &amp; vbCrLf &amp; str4 &amp; vbCrLf &amp; str5 &amp; vbCrLf &amp; str6 &amp; vbCrLf &amp; str7 &amp; vbCrLf &amp; str8 &amp; vbCrLf &amp; str9 &amp; vbCrLf &amp; str10,,objUser.Name\r\n\r\n<\/em><\/pre>\n<p style=\"text-align: center;\"><a href=\"http:\/\/msbro.ru\/wp-content\/uploads\/2009\/10\/last-login.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-376 aligncenter\" title=\"last-login\" src=\"http:\/\/msbro.ru\/wp-content\/uploads\/2009\/10\/last-login.jpg\" alt=\"last-login\" width=\"251\" height=\"217\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0418\u043d\u043e\u0433\u0434\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0441\u043e\u0432\u0435\u0440\u0448\u0438\u043b \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0432\u0445\u043e\u0434 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443. \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435 \u0434\u043e\u043c\u0435\u043d\u0430<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,10],"tags":[],"class_list":["post-29","post","type-post","status-publish","format-standard","hentry","category-windows","category-scripts"],"_links":{"self":[{"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/posts\/29"}],"collection":[{"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/comments?post=29"}],"version-history":[{"count":0,"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/posts\/29\/revisions"}],"wp:attachment":[{"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/media?parent=29"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/categories?post=29"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/msbro.ru\/index.php\/wp-json\/wp\/v2\/tags?post=29"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}<!-- WP Super Cache is installed but broken. The constant WPCACHEHOME must be set in the file wp-config.php and point at the WP Super Cache plugin directory. -->