{"id":329,"date":"2004-10-24T17:00:00","date_gmt":"2004-10-24T17:00:00","guid":{"rendered":"http:\/\/markwilson.me.uk\/blog\/2004\/10\/handy-script-for-determining-when-user.htm"},"modified":"2007-05-15T12:40:41","modified_gmt":"2007-05-15T11:40:41","slug":"handy-script-for-determining-when-user","status":"publish","type":"post","link":"https:\/\/www.markwilson.co.uk\/blog\/2004\/10\/handy-script-for-determining-when-user.htm","title":{"rendered":"Handy script for determining when a user last logged on"},"content":{"rendered":"<p><!--112353781548606472-->I recently came across <a href=\"http:\/\/www.windowsitpro.com\/articles\/print.cfm?articleid=15113\">a handy script which examines a Windows NT\/2000\/XP\/2003 computer or an Active Directory domain controller to read out the last log on time for each user<\/a>.  By piping the output to a text file, it could be useful for sorting and identifying redundant user accounts.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently came across a handy script which examines a Windows NT\/2000\/XP\/2003 computer or an Active Directory domain controller to read out the last log on time for each user. By piping the output to a text file, it could be useful for sorting and identifying redundant user accounts.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[],"tags":[102,33,82],"class_list":["post-329","post","type-post","status-publish","format-standard","hentry","tag-active-directory","tag-windows","tag-scripting"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Handy script for determining when a user last logged on - markwilson.it<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.markwilson.co.uk\/blog\/2004\/10\/handy-script-for-determining-when-user.htm\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Handy script for determining when a user last logged on - markwilson.it\" \/>\n<meta property=\"og:description\" content=\"I recently came across a handy script which examines a Windows NT\/2000\/XP\/2003 computer or an Active Directory domain controller to read out the last log on time for each user. By piping the output to a text file, it could be useful for sorting and identifying redundant user accounts.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.markwilson.co.uk\/blog\/2004\/10\/handy-script-for-determining-when-user.htm\" \/>\n<meta property=\"og:site_name\" content=\"markwilson.it\" \/>\n<meta property=\"article:published_time\" content=\"2004-10-24T17:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2007-05-15T11:40:41+00:00\" \/>\n<meta name=\"author\" content=\"Mark Wilson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@markwilsonit\" \/>\n<meta name=\"twitter:site\" content=\"@markwilsonit\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Mark Wilson\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.markwilson.co.uk\\\/blog\\\/2004\\\/10\\\/handy-script-for-determining-when-user.htm#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.markwilson.co.uk\\\/blog\\\/2004\\\/10\\\/handy-script-for-determining-when-user.htm\"},\"author\":{\"name\":\"Mark Wilson\",\"@id\":\"https:\\\/\\\/www.markwilson.co.uk\\\/blog\\\/#\\\/schema\\\/person\\\/98f61365e7c39d6be942174b8c4de468\"},\"headline\":\"Handy script for determining when a user last logged on\",\"datePublished\":\"2004-10-24T17:00:00+00:00\",\"dateModified\":\"2007-05-15T11:40:41+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.markwilson.co.uk\\\/blog\\\/2004\\\/10\\\/handy-script-for-determining-when-user.htm\"},\"wordCount\":60,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.markwilson.co.uk\\\/blog\\\/#\\\/schema\\\/person\\\/98f61365e7c39d6be942174b8c4de468\"},\"keywords\":[\"Microsoft Active Directory\",\"Microsoft Windows\",\"Scripting\"],\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.markwilson.co.uk\\\/blog\\\/2004\\\/10\\\/handy-script-for-determining-when-user.htm#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.markwilson.co.uk\\\/blog\\\/2004\\\/10\\\/handy-script-for-determining-when-user.htm\",\"url\":\"https:\\\/\\\/www.markwilson.co.uk\\\/blog\\\/2004\\\/10\\\/handy-script-for-determining-when-user.htm\",\"name\":\"Handy script for determining when a user last logged on - markwilson.it\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.markwilson.co.uk\\\/blog\\\/#website\"},\"datePublished\":\"2004-10-24T17:00:00+00:00\",\"dateModified\":\"2007-05-15T11:40:41+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.markwilson.co.uk\\\/blog\\\/2004\\\/10\\\/handy-script-for-determining-when-user.htm#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.markwilson.co.uk\\\/blog\\\/2004\\\/10\\\/handy-script-for-determining-when-user.htm\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.markwilson.co.uk\\\/blog\\\/2004\\\/10\\\/handy-script-for-determining-when-user.htm#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.markwilson.co.uk\\\/blog\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Handy script for determining when a user last logged on\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.markwilson.co.uk\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.markwilson.co.uk\\\/blog\\\/\",\"name\":\"markwilson.it\",\"description\":\"get-info -class technology | write-output &gt; \\\/dev\\\/web\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.markwilson.co.uk\\\/blog\\\/#\\\/schema\\\/person\\\/98f61365e7c39d6be942174b8c4de468\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.markwilson.co.uk\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.markwilson.co.uk\\\/blog\\\/#\\\/schema\\\/person\\\/98f61365e7c39d6be942174b8c4de468\",\"name\":\"Mark Wilson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/i0.wp.com\\\/www.markwilson.co.uk\\\/blog\\\/uploads\\\/image-4.png?fit=800%2C800&ssl=1\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/www.markwilson.co.uk\\\/blog\\\/uploads\\\/image-4.png?fit=800%2C800&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/www.markwilson.co.uk\\\/blog\\\/uploads\\\/image-4.png?fit=800%2C800&ssl=1\",\"width\":800,\"height\":800,\"caption\":\"Mark Wilson\"},\"logo\":{\"@id\":\"https:\\\/\\\/i0.wp.com\\\/www.markwilson.co.uk\\\/blog\\\/uploads\\\/image-4.png?fit=800%2C800&ssl=1\"},\"description\":\"A Chartered IT Professional, with recent experience in technology leadership, IT strategy and practice management roles, Mark Wilson is an Enterprise Architect in the Advisory and Management Group at risual. During a career spanning more than two decades, Mark has gained widespread recognition as an expert in his field including both industry and national press exposure. In addition to certifications from Microsoft, VMware, Red Hat, The Open Group and Axelos, Mark held a Microsoft Most Valuable Professional (MVP) award for three years and is now part of the MVP Reconnect programme. Mark is also well-known on social media and maintains an award-winning blog.\",\"sameAs\":[\"http:\\\/\\\/www.markwilson.co.uk\\\/\",\"https:\\\/\\\/www.instagram.com\\\/markwilsonuk\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/markawilson\\\/\",\"https:\\\/\\\/x.com\\\/markwilsonit\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCWHlZCoHRTocdvtrOJ2IL4A\"],\"url\":\"https:\\\/\\\/www.markwilson.co.uk\\\/blog\\\/author\\\/mark-wilson\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Handy script for determining when a user last logged on - markwilson.it","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.markwilson.co.uk\/blog\/2004\/10\/handy-script-for-determining-when-user.htm","og_locale":"en_GB","og_type":"article","og_title":"Handy script for determining when a user last logged on - markwilson.it","og_description":"I recently came across a handy script which examines a Windows NT\/2000\/XP\/2003 computer or an Active Directory domain controller to read out the last log on time for each user. By piping the output to a text file, it could be useful for sorting and identifying redundant user accounts.","og_url":"https:\/\/www.markwilson.co.uk\/blog\/2004\/10\/handy-script-for-determining-when-user.htm","og_site_name":"markwilson.it","article_published_time":"2004-10-24T17:00:00+00:00","article_modified_time":"2007-05-15T11:40:41+00:00","author":"Mark Wilson","twitter_card":"summary_large_image","twitter_creator":"@markwilsonit","twitter_site":"@markwilsonit","twitter_misc":{"Written by":"Mark Wilson"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.markwilson.co.uk\/blog\/2004\/10\/handy-script-for-determining-when-user.htm#article","isPartOf":{"@id":"https:\/\/www.markwilson.co.uk\/blog\/2004\/10\/handy-script-for-determining-when-user.htm"},"author":{"name":"Mark Wilson","@id":"https:\/\/www.markwilson.co.uk\/blog\/#\/schema\/person\/98f61365e7c39d6be942174b8c4de468"},"headline":"Handy script for determining when a user last logged on","datePublished":"2004-10-24T17:00:00+00:00","dateModified":"2007-05-15T11:40:41+00:00","mainEntityOfPage":{"@id":"https:\/\/www.markwilson.co.uk\/blog\/2004\/10\/handy-script-for-determining-when-user.htm"},"wordCount":60,"commentCount":0,"publisher":{"@id":"https:\/\/www.markwilson.co.uk\/blog\/#\/schema\/person\/98f61365e7c39d6be942174b8c4de468"},"keywords":["Microsoft Active Directory","Microsoft Windows","Scripting"],"inLanguage":"en-GB","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.markwilson.co.uk\/blog\/2004\/10\/handy-script-for-determining-when-user.htm#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.markwilson.co.uk\/blog\/2004\/10\/handy-script-for-determining-when-user.htm","url":"https:\/\/www.markwilson.co.uk\/blog\/2004\/10\/handy-script-for-determining-when-user.htm","name":"Handy script for determining when a user last logged on - markwilson.it","isPartOf":{"@id":"https:\/\/www.markwilson.co.uk\/blog\/#website"},"datePublished":"2004-10-24T17:00:00+00:00","dateModified":"2007-05-15T11:40:41+00:00","breadcrumb":{"@id":"https:\/\/www.markwilson.co.uk\/blog\/2004\/10\/handy-script-for-determining-when-user.htm#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.markwilson.co.uk\/blog\/2004\/10\/handy-script-for-determining-when-user.htm"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.markwilson.co.uk\/blog\/2004\/10\/handy-script-for-determining-when-user.htm#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.markwilson.co.uk\/blog"},{"@type":"ListItem","position":2,"name":"Handy script for determining when a user last logged on"}]},{"@type":"WebSite","@id":"https:\/\/www.markwilson.co.uk\/blog\/#website","url":"https:\/\/www.markwilson.co.uk\/blog\/","name":"markwilson.it","description":"get-info -class technology | write-output &gt; \/dev\/web","publisher":{"@id":"https:\/\/www.markwilson.co.uk\/blog\/#\/schema\/person\/98f61365e7c39d6be942174b8c4de468"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.markwilson.co.uk\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":["Person","Organization"],"@id":"https:\/\/www.markwilson.co.uk\/blog\/#\/schema\/person\/98f61365e7c39d6be942174b8c4de468","name":"Mark Wilson","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/i0.wp.com\/www.markwilson.co.uk\/blog\/uploads\/image-4.png?fit=800%2C800&ssl=1","url":"https:\/\/i0.wp.com\/www.markwilson.co.uk\/blog\/uploads\/image-4.png?fit=800%2C800&ssl=1","contentUrl":"https:\/\/i0.wp.com\/www.markwilson.co.uk\/blog\/uploads\/image-4.png?fit=800%2C800&ssl=1","width":800,"height":800,"caption":"Mark Wilson"},"logo":{"@id":"https:\/\/i0.wp.com\/www.markwilson.co.uk\/blog\/uploads\/image-4.png?fit=800%2C800&ssl=1"},"description":"A Chartered IT Professional, with recent experience in technology leadership, IT strategy and practice management roles, Mark Wilson is an Enterprise Architect in the Advisory and Management Group at risual. During a career spanning more than two decades, Mark has gained widespread recognition as an expert in his field including both industry and national press exposure. In addition to certifications from Microsoft, VMware, Red Hat, The Open Group and Axelos, Mark held a Microsoft Most Valuable Professional (MVP) award for three years and is now part of the MVP Reconnect programme. Mark is also well-known on social media and maintains an award-winning blog.","sameAs":["http:\/\/www.markwilson.co.uk\/","https:\/\/www.instagram.com\/markwilsonuk\/","https:\/\/www.linkedin.com\/in\/markawilson\/","https:\/\/x.com\/markwilsonit","https:\/\/www.youtube.com\/channel\/UCWHlZCoHRTocdvtrOJ2IL4A"],"url":"https:\/\/www.markwilson.co.uk\/blog\/author\/mark-wilson"}]}},"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":485,"url":"https:\/\/www.markwilson.co.uk\/blog\/2004\/09\/script-to-disable-password-expiry-for.htm","url_meta":{"origin":329,"position":0},"title":"Script to disable password expiry for local Windows accounts","author":"Mark Wilson","date":"Friday 10 September 2004","format":false,"excerpt":"One of the shortcomings of the net user command in Windows is the inability to set the password never expires flag on an account (account expiry options can be set, but not password expiry and the full syntax is described in Microsoft knowledge base article 251394). There are 13 flags\u2026","rel":"","context":"In \"Microsoft Active Directory\"","block_context":{"text":"Microsoft Active Directory","link":"https:\/\/www.markwilson.co.uk\/blog\/tag\/active-directory"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":5496,"url":"https:\/\/www.markwilson.co.uk\/blog\/2015\/02\/microsoft-accounts-vs-microsofts-organizational-accounts.htm","url_meta":{"origin":329,"position":1},"title":"&#8220;Microsoft accounts&#8221; vs. Microsoft&#8217;s &#8220;organizational accounts&#8221;","author":"Mark Wilson","date":"Thursday 19 February 2015","format":false,"excerpt":"If you're using Microsoft's online services, you might reasonably expect to authenticate against some form of directory service. \u00a0And, if you have your own directory service (like\u00a0Active Directory), you might reasonably expect to be able to synchronise it with your cloud identity to provide a holistic view to end users.\u2026","rel":"","context":"In &quot;Technology&quot;","block_context":{"text":"Technology","link":"https:\/\/www.markwilson.co.uk\/blog\/topic\/technology"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":415,"url":"https:\/\/www.markwilson.co.uk\/blog\/2004\/01\/controlling-creation-of-active.htm","url_meta":{"origin":329,"position":2},"title":"Controlling the creation of Active Directory replication connections","author":"Mark Wilson","date":"Wednesday 28 January 2004","format":false,"excerpt":"The knowledge consistency checker (KCC) is a Microsoft Windows 2000 and Microsoft Windows Server 2003 component that automatically generates and maintains the intra- and inter-site replication topology. Whilst the KCC generally works well, sometimes it may be necessary to prevent the KCC's automatic generation of replication connections (a scripted method\u2026","rel":"","context":"In \"Microsoft Active Directory\"","block_context":{"text":"Microsoft Active Directory","link":"https:\/\/www.markwilson.co.uk\/blog\/tag\/active-directory"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":260,"url":"https:\/\/www.markwilson.co.uk\/blog\/2005\/10\/gpmc-modelling-after-upgrading-active.htm","url_meta":{"origin":329,"position":3},"title":"GPMC modelling after upgrading Active Directory","author":"Mark Wilson","date":"Monday 17 October 2005","format":false,"excerpt":"Earlier today, I came across a interesting hangover from last week's domain upgrade from Windows 2000 Server to Windows Server 2003. After installing the group policy management console (GPMC), I was viewing a pre-existing group policy object (GPO) and GPMC notified me that Enterprise Domain Controllers did not have read\u2026","rel":"","context":"In \"Microsoft Active Directory\"","block_context":{"text":"Microsoft Active Directory","link":"https:\/\/www.markwilson.co.uk\/blog\/tag\/active-directory"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":506,"url":"https:\/\/www.markwilson.co.uk\/blog\/2005\/05\/monitoring-active-directory-enterprise.htm","url_meta":{"origin":329,"position":4},"title":"Monitoring Active Directory enterprise replication","author":"Mark Wilson","date":"Wednesday 18 May 2005","format":false,"excerpt":"Unlike Windows NT domains, Active Directory (AD) domains have multiple masters and so all domain controller servers must be kept up-to-date with directory modifications made at other domain controllers. AD uses two forms of replication between domain controllers - directory replication is used for directory objects (users, computers, groups, etc.)\u2026","rel":"","context":"In \"Microsoft Active Directory\"","block_context":{"text":"Microsoft Active Directory","link":"https:\/\/www.markwilson.co.uk\/blog\/tag\/active-directory"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":102,"url":"https:\/\/www.markwilson.co.uk\/blog\/2005\/05\/troubleshooting-windows-authentication.htm","url_meta":{"origin":329,"position":5},"title":"Troubleshooting Windows authentication with the Microsoft account lockout and management tools","author":"Mark Wilson","date":"Wednesday 18 May 2005","format":false,"excerpt":"A few weeks back I was at a Microsoft TechNet UK event where John Howard demonstrated the free tools provided by Microsoft to troubleshoot and diagnose account lockout and management issues for Windows NT, 2000 and 2003: acctinfo.dll (also included with the Windows Server 2003 resource kit tools) is installed\u2026","rel":"","context":"In \"Microsoft Windows 2000\"","block_context":{"text":"Microsoft Windows 2000","link":"https:\/\/www.markwilson.co.uk\/blog\/tag\/windows-2000"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.markwilson.co.uk\/blog\/wp-json\/wp\/v2\/posts\/329","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.markwilson.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.markwilson.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.markwilson.co.uk\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.markwilson.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=329"}],"version-history":[{"count":0,"href":"https:\/\/www.markwilson.co.uk\/blog\/wp-json\/wp\/v2\/posts\/329\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.markwilson.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=329"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.markwilson.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=329"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.markwilson.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=329"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}