<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Marc Valk dot Net &#187; Powershell</title>
	<atom:link href="http://www.marcvalk.net/category/powershell/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.marcvalk.net</link>
	<description>blogging about...... Microsoft, Cloud Computing and all other things I find interesting</description>
	<lastBuildDate>Mon, 16 Jan 2012 12:48:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>PowerShell: Last Logon</title>
		<link>http://www.marcvalk.net/2009/11/powershell-last-logon/</link>
		<comments>http://www.marcvalk.net/2009/11/powershell-last-logon/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 14:32:30 +0000</pubDate>
		<dc:creator>mvalk</dc:creator>
				<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Powershell]]></category>

		<guid isPermaLink="false">http://www.marcvalk.net/2009/11/powershell-last-logon/</guid>
		<description><![CDATA[I wanted to write a powershell script to retrieve the last logon property of an Active Directory User. Here is&#160; how I came to the final script. First of all: to get the domain users, use the command: Get-QADUser This &#8230; <a href="http://www.marcvalk.net/2009/11/powershell-last-logon/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I wanted to write a powershell script to retrieve the last logon property of an Active Directory User. Here is&#160; how I came to the final script.</p>
<p>First of all: to get the domain users, use the command:</p>
<ul>
<li><em><font size="2">Get-QADUser</font></em> </li>
</ul>
<p>This will return a list of all the domain users. As it will not return the property LastLogon, you have to include it. And for a better performance you can exclude the default properties</p>
<ul>
<li><font size="2"><em>Get-QADUser&#160; -IncludedProperties name,lastlogon</em> </font></li>
</ul>
<p>You will now have all your domain users and the property Lastlogon. To list them:</p>
<ul>
<li><em>Get-QADUser -DontUseDefaultIncludedProperties -IncludedProperties lastlogon&#160; | Select-Object Name,LastLogon</em> </li>
</ul>
<p>Next, to export it to a csv file (use the NoTypeInformation parameter to remove the .NET object header):</p>
<ul>
<li><em>Get-QADUser -DontUseDefaultIncludedProperties -IncludedProperties lastlogon&#160; | Select-Object Name,LastLogon | Export-Csv c:\ADusers.csv -NoTypeInformation</em> </li>
</ul>
<p>BTW: I used <a title="PowerGUI Site" href="http://www.powergui.org/index.jspa" target="_blank">PowerGUI Script Editor</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.marcvalk.net/2009/11/powershell-last-logon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

