<?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>Yattaa</title>
	<atom:link href="http://www.yattaa.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.yattaa.com</link>
	<description>IT Tips and Tricks</description>
	<lastBuildDate>Thu, 29 Oct 2009 02:52:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Determining System Uptime</title>
		<link>http://www.yattaa.com/?p=107</link>
		<comments>http://www.yattaa.com/?p=107#comments</comments>
		<pubDate>Thu, 29 Oct 2009 02:52:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[wmi]]></category>

		<guid isPermaLink="false">http://www.yattaa.com/?p=107</guid>
		<description><![CDATA[Using WMI to determine when a system last booted up 1 2 $a = (get-wmiobject win32_operatingsystem) $a.ConvertToDateTime($a.lastbootuptime)]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript"><!--
google_ad_client = "pub-8033245771077676";
/* 468x60, created 9/12/09 */
google_ad_slot = "2948751173";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<p>Using WMI to determine when a system last booted up</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="text" style="font-family:monospace;">$a = (get-wmiobject win32_operatingsystem)
$a.ConvertToDateTime($a.lastbootuptime)</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.yattaa.com/?feed=rss2&amp;p=107</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recursive Listing of Files by Date</title>
		<link>http://www.yattaa.com/?p=101</link>
		<comments>http://www.yattaa.com/?p=101#comments</comments>
		<pubDate>Mon, 19 Oct 2009 02:52:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://www.yattaa.com/?p=101</guid>
		<description><![CDATA[Using powershell to recursively list files modified before or after a certain date is an easy one line powershell script. 1 get-childitem -Recurse &#124;where {$_.lastwritetime -gt (date).adddays(-10)} or to list by a certain date: 1 get-childitem -Recurse &#124;where {$_.lastwritetime -gt &#34;10/2/09&#34;}]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript"><!--
google_ad_client = "pub-8033245771077676";
/* 468x60, created 9/12/09 */
google_ad_slot = "2948751173";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
Using powershell to recursively list files modified before or after a certain date is an easy one line powershell script.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="text" style="font-family:monospace;">get-childitem -Recurse |where {$_.lastwritetime -gt (date).adddays(-10)}</pre></td></tr></table></div>

<p>or to list by a certain date:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="text" style="font-family:monospace;"> get-childitem -Recurse |where {$_.lastwritetime -gt &quot;10/2/09&quot;}</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.yattaa.com/?feed=rss2&amp;p=101</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows 7 Powershell Pack</title>
		<link>http://www.yattaa.com/?p=96</link>
		<comments>http://www.yattaa.com/?p=96#comments</comments>
		<pubDate>Fri, 16 Oct 2009 00:17:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[Windows 7]]></category>

		<guid isPermaLink="false">http://www.yattaa.com/?p=96</guid>
		<description><![CDATA[The Windows 7 Powershell Pack has been released by Microsoft. A brief feature list as well as the download can be found at the following link: Windows 7 Resource Kit Powershell Pack]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript"><!--
google_ad_client = "pub-8033245771077676";
/* 468x60, created 9/12/09 */
google_ad_slot = "2948751173";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
The Windows 7 Powershell Pack has been released by Microsoft.  A brief feature list as well as the download can be found at the following link:</p>
<p><a href="http://blogs.msdn.com/powershell/archive/2009/10/15/introducing-the-windows-7-resource-kit-powershell-pack.aspx">Windows 7 Resource Kit Powershell Pack</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.yattaa.com/?feed=rss2&amp;p=96</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Change File Modified Date</title>
		<link>http://www.yattaa.com/?p=91</link>
		<comments>http://www.yattaa.com/?p=91#comments</comments>
		<pubDate>Wed, 14 Oct 2009 23:46:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://www.yattaa.com/?p=91</guid>
		<description><![CDATA[Using Powewrshell Set_LastWriteTime, we are able to modify a files last modifed date and time. 1 2 $date = date (get-item c:\temp\list.txt).set_LastWriteTime($date) To adjust the date to a day in the past just change the $date line: 1 2 $date = (date).AddDays(-10) (get-item c:\temp\list.txt).set_LastWriteTime($date) This just moved the date back 10 days from today. To [...]]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript"><!--
google_ad_client = "pub-8033245771077676";
/* 468x60, created 9/12/09 */
google_ad_slot = "2948751173";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<p>Using Powewrshell Set_LastWriteTime, we are able to modify a files last modifed date and time.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="text" style="font-family:monospace;">$date = date
(get-item c:\temp\list.txt).set_LastWriteTime($date)</pre></td></tr></table></div>

<p>To adjust the date to a day in the past just change the $date line:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="text" style="font-family:monospace;">$date = (date).AddDays(-10)
(get-item c:\temp\list.txt).set_LastWriteTime($date)</pre></td></tr></table></div>

<p>This just moved the date back 10 days from today.  To go forward you would do:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="text" style="font-family:monospace;">$date = (date).AddDays(10)
(get-item c:\temp\list.txt).set_LastWriteTime($date)</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.yattaa.com/?feed=rss2&amp;p=91</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Terminate Process</title>
		<link>http://www.yattaa.com/?p=73</link>
		<comments>http://www.yattaa.com/?p=73#comments</comments>
		<pubDate>Sun, 11 Oct 2009 14:15:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Process]]></category>
		<category><![CDATA[wmi]]></category>

		<guid isPermaLink="false">http://www.yattaa.com/?p=73</guid>
		<description><![CDATA[While wanting to kill a process, i decided why use the task manager when i can use powershell. I will be using wmi and the Win32_Process class for this task. First i look for the process name i would like to terminate: 1 gwmi win32_process &#124; select-object name I then select the process name from [...]]]></description>
			<content:encoded><![CDATA[<p>While wanting to kill a process, i decided why use the task manager when i can use powershell.  I will be using wmi and the Win32_Process class for this task.<br />
<script type="text/javascript"><!--
google_ad_client = "pub-8033245771077676";
/* 468x60, created 9/12/09 */
google_ad_slot = "2948751173";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
First i look for the process name i would like to terminate:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="text" style="font-family:monospace;">gwmi win32_process | select-object name</pre></td></tr></table></div>

<p>I then select the process name from this list to confirm this is the process i want to terminate:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="text" style="font-family:monospace;">gwmi win32_process | where {$_.name -eq &quot;AdobeUpdater.exe&quot;}</pre></td></tr></table></div>

<p>Then i terminate it:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="text" style="font-family:monospace;">(gwmi win32_process | where {$_.name -eq &quot;AdobeUpdater.exe&quot;}).terminate()</pre></td></tr></table></div>

<p>We are looking for a return value of 0 indicating this was successfull:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">__GENUS          : 2
__CLASS          : __PARAMETERS
__SUPERCLASS     :
__DYNASTY        : __PARAMETERS
__RELPATH        :
__PROPERTY_COUNT : 1
__DERIVATION     : {}
__SERVER         :
__NAMESPACE      :
__PATH           :
ReturnValue      : 0</pre></div></div>

<p>For other return values, visit <a href="http://msdn.microsoft.com/en-us/library/aa393907(VS.85).aspx"> MSDN </a> for more information.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yattaa.com/?feed=rss2&amp;p=73</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting SMTP Message Priority in Powershell</title>
		<link>http://www.yattaa.com/?p=77</link>
		<comments>http://www.yattaa.com/?p=77#comments</comments>
		<pubDate>Thu, 08 Oct 2009 14:15:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[SMTP]]></category>

		<guid isPermaLink="false">http://www.yattaa.com/?p=77</guid>
		<description><![CDATA[To expand on my previous post regarding how to send email from Powershell, below is an example that includes forcing plain text (or html), setting mesage priority, setting notification options, as well as adding CC: and BCC: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 # [...]]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript"><!--
google_ad_client = "pub-8033245771077676";
/* 468x60, created 9/12/09 */
google_ad_slot = "2948751173";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
To expand on my previous post regarding how to send email from Powershell, below is an example that includes forcing plain text (or html), setting mesage priority, setting notification options, as well as adding CC: and BCC:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code"><pre class="text" style="font-family:monospace;"># Setting SMTP Priority using Powershell V1
# Yattaa.com 10/07/2009
#
$email = New-Object System.Net.Mail.MailMessage
$email.From = &quot;user@yourdomain.com&quot;
$email.To.Add(&quot;user@yourdomain.com&quot;)
$email.To.Add(&quot;user@yourdomain.com&quot;)
$email.CC.Add(&quot;user@yourdomain.com&quot;)
$email.BCC.Add(&quot;user@yourdomain.com&quot;)
$email.DeliveryNotificationOptions = [System.Net.Mail.DeliveryNotificationOptions]::OnSuccess
$email.IsBodyHtml = $false
$email.Priority = [System.Net.Mail.MailPriority]::High
$email.Subject = &quot;Subect Here&quot;
$email.Body = &quot;Body Here&quot;
$smtp = New-Object System.Net.Mail.SmtpClient
$smtp.Host = &quot;SMTP Server Here&quot;
$smtp.Send($email)</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.yattaa.com/?feed=rss2&amp;p=77</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Determining Client OS Version</title>
		<link>http://www.yattaa.com/?p=67</link>
		<comments>http://www.yattaa.com/?p=67#comments</comments>
		<pubDate>Mon, 05 Oct 2009 21:47:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Registry]]></category>
		<category><![CDATA[wmi]]></category>

		<guid isPermaLink="false">http://www.yattaa.com/?p=67</guid>
		<description><![CDATA[Using powershell to query the registry, either local or remote, to determine the OS version being used: 1 2 3 4 $MachineName = $Args[0] $regKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]::LocalMachine, $MachineName) $regKey= $regKey.OpenSubKey(&#34;SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion&#34; ,$False) $regkey.getvalue('ProductName') Or by using WMI and also discovering whether the client is 32 or 64 bit: 1 gwmi Win32_OperatingSystem -computer &#34;.&#34; &#124; select-object [...]]]></description>
			<content:encoded><![CDATA[<p>Using powershell to query the registry, either local or remote, to determine the OS version being used:<br />
<script type="text/javascript"><!--
google_ad_client = "pub-8033245771077676";
/* 468x60, created 9/12/09 */
google_ad_slot = "2948751173";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="text" style="font-family:monospace;">$MachineName = $Args[0]
$regKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]::LocalMachine, $MachineName)
$regKey= $regKey.OpenSubKey(&quot;SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion&quot; ,$False)
$regkey.getvalue('ProductName')</pre></td></tr></table></div>

<p>Or by using WMI and also discovering whether the client is 32 or 64 bit:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="text" style="font-family:monospace;">gwmi Win32_OperatingSystem -computer &quot;.&quot; | select-object Caption , OSArchitecture</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.yattaa.com/?feed=rss2&amp;p=67</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Executing Unsigned Scripts</title>
		<link>http://www.yattaa.com/?p=65</link>
		<comments>http://www.yattaa.com/?p=65#comments</comments>
		<pubDate>Fri, 02 Oct 2009 16:10:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Powershell]]></category>

		<guid isPermaLink="false">http://www.yattaa.com/?p=65</guid>
		<description><![CDATA[By default powershell does not run unsigned scripts. To let powershell run unsigned scripts: 1 Set-ExecutionPolicy unrestricted]]></description>
			<content:encoded><![CDATA[<p>By default powershell does not run  unsigned scripts.  To let powershell run unsigned scripts:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="text" style="font-family:monospace;">Set-ExecutionPolicy unrestricted</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.yattaa.com/?feed=rss2&amp;p=65</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Export to Excel &#8211; Ping Status</title>
		<link>http://www.yattaa.com/?p=56</link>
		<comments>http://www.yattaa.com/?p=56#comments</comments>
		<pubDate>Thu, 01 Oct 2009 00:40:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Cisco]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[wmi]]></category>

		<guid isPermaLink="false">http://www.yattaa.com/?p=56</guid>
		<description><![CDATA[Here is a modified version of my previous post. This takes Win32_PingStatus, pings a subnet, and writes the output to Excel. All using Powershell. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a modified version of my previous post.  This takes Win32_PingStatus, pings a subnet, and writes the output to Excel.  All using Powershell.</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-8033245771077676";
/* 468x60, created 9/12/09 */
google_ad_slot = "2948751173";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
</pre></td><td class="code"><pre class="text" style="font-family:monospace;">#
# Powershell: Export Ping Status to Excel
# Exports pings of address range to excel
# Yattaa.com 9/28/09
$erroractionpreference = &quot;SilentlyContinue&quot;
&nbsp;
$a = New-Object -comobject Excel.Application
$a.visible = $True 
&nbsp;
$b = $a.Workbooks.Add()
$c = $b.Worksheets.Item(1)
&nbsp;
$c.Cells.Item(1,1) = &quot;Host&quot;
$c.Cells.Item(1,2) = &quot;Response&quot;
$c.Cells.Item(1,3) = &quot;Return Time&quot;
&nbsp;
($c.UsedRange).Interior.ColorIndex = 36
($c.UsedRange).Font.ColorIndex = 1
($c.UsedRange).Font.Bold = $True
&nbsp;
$intRow = 2
&nbsp;
$i = 0
while ($i -lt 255){
$i += 1
$a = get-WmiObject &quot;Win32_PingStatus&quot; -filter &quot;Address='192.168.1.$i' and Timeout=100&quot;
Write-Host $a.Address, $a.statuscode
	$c.Cells.Item($intRow,1) = $a.Address
	$c.Cells.Item($intRow,2) = $a.StatusCode
&nbsp;
	If($a.StatusCode -eq 0){
		$c.Cells.Item($intRow,2).Interior.ColorIndex = 4
		$c.Cells.Item($intRow,3) = $a.ResponseTimeToLive
	}
	Else{
		$c.Cells.Item($intRow,2).Interior.ColorIndex = 3
	}
&nbsp;
$intRow = $intRow + 1
}
($c.UsedRange).EntireColumn.AutoFit()</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.yattaa.com/?feed=rss2&amp;p=56</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Powershell Ping</title>
		<link>http://www.yattaa.com/?p=42</link>
		<comments>http://www.yattaa.com/?p=42#comments</comments>
		<pubDate>Sat, 26 Sep 2009 23:19:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[wmi]]></category>

		<guid isPermaLink="false">http://www.yattaa.com/?p=42</guid>
		<description><![CDATA[This is a basic powershell script for pinging a subnet to see which hosts respond.  Status 0 indicates the host responds while status 11003 indicates that no host is responding on that address.  Over the next couple of days i will be expanding on this script to export the results to excel and add more [...]]]></description>
			<content:encoded><![CDATA[<p>This is a basic powershell script for pinging a subnet to see which hosts respond.  Status 0 indicates the host responds while status 11003 indicates that no host is responding on that address.  Over the next couple of days i will be expanding on this script to export the results to excel and add more user variables<br />
<script type="text/javascript"><!--
google_ad_client = "pub-8033245771077676";
/* 468x60, created 9/12/09 */
google_ad_slot = "2948751173";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="text" style="font-family:monospace;">$i = 0
while ($i -lt 255){
   $i += 1
   $a = get-WmiObject Win32_PingStatus -f &quot;Address='192.168.1.$i'&quot;
   Write-Host $a.Address, $a.statuscode
   }</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.yattaa.com/?feed=rss2&amp;p=42</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
