<?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>Pario TechnoBlob &#187; eventquery.vbs</title>
	<atom:link href="http://pario.no/tag/eventqueryvbs/feed/" rel="self" type="application/rss+xml" />
	<link>http://pario.no</link>
	<description>A cronological documentation test project, nothing serious, really!</description>
	<lastBuildDate>Thu, 02 Feb 2012 13:17:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Simple Windows Print Accounting using Event Viewer data</title>
		<link>http://pario.no/2009/05/15/simple-windows-print-accounting-using-event-viewer-data/</link>
		<comments>http://pario.no/2009/05/15/simple-windows-print-accounting-using-event-viewer-data/#comments</comments>
		<pubDate>Fri, 15 May 2009 06:40:35 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Misc]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[csv]]></category>
		<category><![CDATA[Event Properties]]></category>
		<category><![CDATA[Event Viewer]]></category>
		<category><![CDATA[eventquery.vbs]]></category>

		<guid isPermaLink="false">http://pario.no/?p=1034</guid>
		<description><![CDATA[This post continues where my previous post titled Export events including Event Properties from Windows Event Viewer left off. The data I&#8217;m going to work with was exported using eventquery.vbs and saved in a CSV-file, comma separated file and it is presented in the form shown below. "Information","10","12.05.2009 13:24:48","Print","Servername","None","AD\username","Document 232, filename.pdf owned by username was [...]]]></description>
			<content:encoded><![CDATA[<p>This post continues where my previous post titled <a href="http://pario.no/2009/05/13/exporting-events-including-event-properties-from-windows-event-viewer/">Export events including Event Properties from Windows Event Viewer</a> left off.</p>
<p>The data I&#8217;m going to work with was exported using <strong>eventquery.vbs</strong> and saved in a CSV-file, comma separated file and it is presented in the form shown below.</p>
<pre>
"Information","10","12.05.2009 13:24:48","Print","Servername","None","AD\username","Document 232, filename.pdf owned by username was printed on printername via port IP_192.168.0.254. Size in bytes: 279232; pages printed: 18"</pre>
<p>I&#8217;m interested in the username, date/time printed and pages printed and will now show how I&#8217;ve accomplished that using some simple linux console commands.</p>
<pre>
awk -F, '{print $7 " " $3 " " $4 " " $NF}' Event_Viewer_System.csv | grep printername | awk '{print $1 "," $2 "," $3 "," $NF}' | sed 's/\"//g'|sort > PrintAccounting.csv</pre>
<p><strong>Result</strong></p>
<pre>
username,14.05.2009,12:58:41,18
username,15.05.2009,09:24:13,2
username,15.05.2009,09:25:00,37
username,15.05.2009,09:30:03,2
username,15.05.2009,09:30:29,2
...</pre>
<p>Where the fields contain username, date, time and the amount of printed pages.</p>
<p>A short description on whats being done</p>
<ul>
<li>print out column 7, 3, 4 and last column where the separator is a comma (,) from the file Event_Viewer_System.csv</li>
<li>filter out the printer you are interested in</li>
<li>filter out again the data we are interested in</li>
<li>remove quote sign (&#8220;) from the list</li>
<li>sort the list ny username</li>
<li>redirect the output to a file</li>
</ul>
<p>And that&#8217;s how you make a primitive print accounting system from data gathered in a Windows Server.<br />
This particular example has been testen on data from a Windows 2003 Server, but I think it can be performed on other versions of Windows as well.</p>
<script type="text/javascript">var wordpress_toolbar_urls = [];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDkvMDUvMTUvc2ltcGxlLXdpbmRvd3MtcHJpbnQtYWNjb3VudGluZy11c2luZy1ldmVudC12aWV3ZXItZGF0YS88d3B0Yj5TaW1wbGUgV2luZG93cyBQcmludCBBY2NvdW50aW5nIHVzaW5nIEV2ZW50IFZpZXdlciBkYXRhPHdwdGI%2BaHR0cDovL3BhcmlvLm5vPHdwdGI%2BUGFyaW8gVGVjaG5vQmxvYg%3D%3D";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2009/05/15/simple-windows-print-accounting-using-event-viewer-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Export events including Event Properties from Windows Event Viewer</title>
		<link>http://pario.no/2009/05/13/exporting-events-including-event-properties-from-windows-event-viewer/</link>
		<comments>http://pario.no/2009/05/13/exporting-events-including-event-properties-from-windows-event-viewer/#comments</comments>
		<pubDate>Wed, 13 May 2009 08:52:36 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[cscript]]></category>
		<category><![CDATA[Event Properties]]></category>
		<category><![CDATA[Event Viewer]]></category>
		<category><![CDATA[eventquery.vbs]]></category>

		<guid isPermaLink="false">http://pario.no/?p=1024</guid>
		<description><![CDATA[This post came to life after a request to produce an overview of how many prints every user produced on a special printer from our print server. Since we have no print accounting software installed on our Windows 2003 Server I had to come up with a new solution to this problem. The actual print [...]]]></description>
			<content:encoded><![CDATA[<p>This post came to life after a request to produce an overview of how many prints every user produced on a special printer from our print server. Since we have no print accounting software installed on our Windows 2003 Server I had to come up with a new solution to this problem. The actual print accounting part will be posted in another post&#8230;</p>
<p>The solution I came up with was to enable auditing on printing and then gather information from the System log in the Event Viewer. But first I had to export the necessary data from the Event Viewer since a normal export using the &#8220;Export List&#8230;&#8221; function by right clicking a log would not give me a good enough detail level including Event Properties.<br />
<img class="size-full wp-image-1025 alignnone" title="eventviewer" src="http://pario.no/wp-content/uploads/2009/05/eventviewer.png" alt="Event Viewer" width="486" height="220" /></p>
<p>After some research I found a Windows tools called <strong>eventquery.vbs</strong> which is located in the windows/system32 folder on most Windows PCs. It&#8217;s a script that lists the events and event properties from one or more event logs. </p>
<p><strong>Export log info</strong><br />
This is the switches I used to export Event Viewer events from System</p>
<pre>cscript c:\windows\system32\eventquery.vbs /fi "Type eq Information" /fi "Source eq Print" /fi "ID eq 10" /v  /l System /fo csv &gt; Event_Viewer_System.csv</pre>
<p>The syntax I used was to filter (/fi) out</p>
<ul>
<li>Events equal the type &#8220;Information&#8221;</li>
<li>filter out Source equal to &#8220;Print&#8221;</li>
<li>filter out ID equal &#8220;10&#8243;</li>
<li>and have a verbose (/v) output</li>
<li>from the System log (/l System)</li>
<li>output as comma separated file (/fo)</li>
<li>and redirect the result to a file &gt; filename.csv</li>
</ul>
<p>More info about the eventquery.vbs tool can be found by following the link under Sources.</p>
<p>The result from this export can look something like this</p>
<pre>"Information","10","12.05.2009 13:24:48","Print","Servername","None","AD\username","Document 232, filename.pdf owned by username was printed on printername via port IP_192.168.0.254. Size in bytes: 279232; pages printed: 1"</pre>
<p>If you look at the image below you&#8217;ll understand where I got the filter type info from.<br />
<img class="alignnone size-full wp-image-1026" title="eventproperties" src="http://pario.no/wp-content/uploads/2009/05/eventproperties.png" alt="Event Properties" width="405" height="446" /></p>
<p>These data now gives me the opportunity to filter out the data I need to create a simple print accounting on my users, and that is posted in the post named <a href="http://pario.no/2009/05/15/simple-windows-print-accounting-using-event-viewer-data/">Simple Windows Print Accounting using Event Viewer data</a>.</p>
<p><strong>Source:</strong> <a href="http://technet.microsoft.com/en-us/library/bb490900.aspx">eventquery.vbs</a></p>
<p>This post can also be used to export from any Event Viewer data log like Application, Security, Internet Explorer or other logs you have on your system.</p>
<script type="text/javascript">var wordpress_toolbar_urls = ["http:\/\/technet.microsoft.com\/en-us\/library\/bb490900.aspx"];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDkvMDUvMTMvZXhwb3J0aW5nLWV2ZW50cy1pbmNsdWRpbmctZXZlbnQtcHJvcGVydGllcy1mcm9tLXdpbmRvd3MtZXZlbnQtdmlld2VyLzx3cHRiPkV4cG9ydCBldmVudHMgaW5jbHVkaW5nIEV2ZW50IFByb3BlcnRpZXMgZnJvbSBXaW5kb3dzIEV2ZW50IFZpZXdlcjx3cHRiPmh0dHA6Ly9wYXJpby5ubzx3cHRiPlBhcmlvIFRlY2hub0Jsb2I%3D";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2009/05/13/exporting-events-including-event-properties-from-windows-event-viewer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

