<?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>..::\\ www.christiano.ch //::.. &#187; PowerShell</title>
	<atom:link href="http://www.christiano.ch/wordpress/category/microsoft/powershell/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.christiano.ch/wordpress</link>
	<description>christiano.ch blog - personal knowledge base, news, memoires et cetera</description>
	<lastBuildDate>Fri, 06 Jan 2012 15:28:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<meta xmlns="http://www.w3.org/1999/xhtml" name="robots" content="noindex,follow" />
		<item>
		<title>Finding process that locks a DLL</title>
		<link>http://www.christiano.ch/wordpress/2011/09/04/finding-process-that-locks-a-dll/</link>
		<comments>http://www.christiano.ch/wordpress/2011/09/04/finding-process-that-locks-a-dll/#comments</comments>
		<pubDate>Sun, 04 Sep 2011 06:15:08 +0000</pubDate>
		<dc:creator>christian</dc:creator>
				<category><![CDATA[CMD / Batch]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Tips n'Tricks]]></category>
		<category><![CDATA[Windows General]]></category>
		<category><![CDATA[DLL]]></category>
		<category><![CDATA[Tasklist]]></category>

		<guid isPermaLink="false">http://www.christiano.ch/wordpress/2011/09/04/finding-process-that-locks-a-dll/</guid>
		<description><![CDATA[You want to replace a dll on a system, but you get access denied, although you’re admin, have the necessary rights.. so which process is locking the particular file/library. I know, there is handles.exe from Sysinternal Suite, and plenty other &#8230; <a href="http://www.christiano.ch/wordpress/2011/09/04/finding-process-that-locks-a-dll/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<table border="0" cellspacing="0" cellpadding="2" width="675">
<tbody>
<tr>
<td valign="top" width="557">You want to replace a dll on a system, but you get access denied, although you’re admin, have the necessary rights.. so which process is locking the particular file/library. I know, there is handles.exe from Sysinternal Suite, and plenty other tools that do the trick.But, you don’t need third-party tools to get the answer, just use tasklist.exe or PowerShell.</td>
<td valign="top" width="117">&nbsp;</td>
</tr>
</tbody>
</table>
<p><span id="more-1254"></span>
<p>Windows command line:</p>
<pre>C:\&gt; tasklist /FI "modules eq vstoee.dll"</pre>
<p>PowerShell
<pre>PS C:\&gt; Get-Process | ? { $_.Modules -like "*(vstoee.dll)*" }</pre>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/intent/tweet?text=Finding+process+that+locks+a+DLL+http%3A%2F%2Fchristiano.ch%2Fwordpress%2F%3Fp%3D1254" title="Post to Twitter"><img class="nothumb" src="http://www.christiano.ch/wordpress/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/intent/tweet?text=Finding+process+that+locks+a+DLL+http%3A%2F%2Fchristiano.ch%2Fwordpress%2F%3Fp%3D1254" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.christiano.ch/wordpress/2011/09/04/finding-process-that-locks-a-dll/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting registry last write time with PowerShell</title>
		<link>http://www.christiano.ch/wordpress/2011/07/16/getting-registry-last-write-time-with-powershell/</link>
		<comments>http://www.christiano.ch/wordpress/2011/07/16/getting-registry-last-write-time-with-powershell/#comments</comments>
		<pubDate>Sat, 16 Jul 2011 16:02:12 +0000</pubDate>
		<dc:creator>christian</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Registry]]></category>

		<guid isPermaLink="false">http://www.christiano.ch/wordpress/2011/07/16/getting-registry-last-write-time-with-powershell/</guid>
		<description><![CDATA[All registry keys have a value associated with called the Last Write Time. This is analogous to the last modification time for a file. When ever the registry key or one if its values has been created, modified, or deleted &#8230; <a href="http://www.christiano.ch/wordpress/2011/07/16/getting-registry-last-write-time-with-powershell/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>All registry keys have a value associated with called the Last Write Time. This is analogous to the last modification time for a file. When ever the registry key or one if its values has been created, modified, or deleted the value is updated to the current local system time. Unfortunately, there is no Last Write Time associated with a registry value, but it can be infered from the Last Write Time of the key.</p>
<p>Here is a PowerShell script to read the Last Write Time for a registry key.</p>
<p>Usage:</p>
<pre>Get-RegKeyLastWriteTime.ps1 &lt;Key&gt; &lt;SubKey&gt;</pre>
<p><span id="more-1242"></span>
<p>Example:</p>
<pre>Get-RegKeyLastWriteTime.ps1 HKLM SOFTWARE\Microsoft\Windows\CurrentVersion</pre>
<p>Output:</p>
<pre>Key                         LastWriteTime
—-                         ——————-
AdminDebug                  10/28/2009 7:50:51 PM
App Management              7/14/2009 4:41:12 AM
App Paths                   1/22/2010 2:07:18 PM
Applets                     7/14/2009 4:41:12 AM
Audio                       7/14/2009 4:41:12 AM
Authentication              7/14/2009 4:41:12 AM
BitLocker                   7/14/2009 4:41:12 AM
...</pre>
<p>Get-RegKeyLastWriteTime.ps1 Script:</p>
<pre>param (	[string] $Key, [string] $SubKey )

switch ($Key) {
    &quot;HKCR&quot; { $searchKey = 0x80000000} #HK Classes Root
    &quot;HKCU&quot; { $searchKey = 0x80000001} #HK Current User
    &quot;HKLM&quot; { $searchKey = 0x80000002} #HK Local Machine
    &quot;HKU&quot;  { $searchKey = 0x80000003} #HK Users
    &quot;HKCC&quot; { $searchKey = 0x80000005} #HK Current Config
    default {
        #throw &quot;Invalid Key. Use one of the following options HKCR, HKCU, HKLM, HKU, HKCC&quot;
    }
}

$KEYQUERYVALUE = 0x1
$KEYREAD = 0x19
$KEYALLACCESS = 0x3F

$sig1 = @'
[DllImport(&quot;advapi32.dll&quot;, CharSet = CharSet.Auto)]
  public static extern int RegOpenKeyEx(
    int hKey,
    string subKey,
    int ulOptions,
    int samDesired,
    out int hkResult);
'@
$type1 = Add-Type -MemberDefinition $sig1 -Name Win32Utils `
    -Namespace RegOpenKeyEx -Using System.Text -PassThru

$sig2 = @'
[DllImport(&quot;advapi32.dll&quot;, EntryPoint = &quot;RegEnumKeyEx&quot;)]
extern public static int RegEnumKeyEx(
    int hkey,
    int index,
    StringBuilder lpName,
    ref int lpcbName,
    int reserved,
    int lpClass,
    int lpcbClass,
    out long lpftLastWriteTime);
'@
$type2 = Add-Type -MemberDefinition $sig2 -Name Win32Utils `
    -Namespace RegEnumKeyEx -Using System.Text -PassThru

$sig3 = @'
[DllImport(&quot;advapi32.dll&quot;, SetLastError=true)]
public static extern int RegCloseKey(
    int hKey);
'@
$type3 = Add-Type -MemberDefinition $sig3 -Name Win32Utils `
    -Namespace RegCloseKey -Using System.Text -PassThru

$hKey = new-object int
$result = $type1::RegOpenKeyEx($searchKey, $SubKey, 0, $KEYREAD, [ref] $hKey)

#initialize variables
$builder = New-Object System.Text.StringBuilder 1024
$index = 0
$length = [int] 1024
$time = New-Object Long

#234 means more info, 0 means success. Either way, keep reading
while ( 0,234 -contains $type2::RegEnumKeyEx($hKey, $index++, `
    $builder, [ref] $length, $null, $null, $null, [ref] $time) )
{
    #create output object
    $o = &quot;&quot; | Select Key, LastWriteTime
    $o.Key = $builder.ToString()
    $o.LastWriteTime = (Get-Date $time).AddYears(1600)
    $o

    #reinitialize for next time through the loop
    $length = [int] 1024
    $builder = New-Object System.Text.StringBuilder 1024
}

$result = $type3::RegCloseKey($hKey);</pre>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/intent/tweet?text=Getting+registry+last+write+time+with+PowerShell+http%3A%2F%2Fchristiano.ch%2Fwordpress%2F%3Fp%3D1242" title="Post to Twitter"><img class="nothumb" src="http://www.christiano.ch/wordpress/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/intent/tweet?text=Getting+registry+last+write+time+with+PowerShell+http%3A%2F%2Fchristiano.ch%2Fwordpress%2F%3Fp%3D1242" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.christiano.ch/wordpress/2011/07/16/getting-registry-last-write-time-with-powershell/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Scan IP range using ping</title>
		<link>http://www.christiano.ch/wordpress/2011/07/16/scan-ip-range-using-ping/</link>
		<comments>http://www.christiano.ch/wordpress/2011/07/16/scan-ip-range-using-ping/#comments</comments>
		<pubDate>Sat, 16 Jul 2011 15:35:44 +0000</pubDate>
		<dc:creator>christian</dc:creator>
				<category><![CDATA[CMD / Batch]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[cmd]]></category>
		<category><![CDATA[IPScan]]></category>

		<guid isPermaLink="false">http://www.christiano.ch/wordpress/2011/07/16/scan-ip-range-using-ping/</guid>
		<description><![CDATA[IP scanner for the poor ones Just open up a cmd.exe and change the ip range.. C:\&#62;FOR /L %x in (1,1,255) do ping -n 1 192.168.2.%x &#124; find /I &#34;reply&#34; &#62;&#62; c:\temp\pingresult.txt The above command uses a FOR loop to &#8230; <a href="http://www.christiano.ch/wordpress/2011/07/16/scan-ip-range-using-ping/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>IP scanner for the poor ones <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Zwinkerndes Smiley" src="http://www.christiano.ch/wordpress/wp-content/uploads/2011/07/wlEmoticon-winkingsmile.png" /></p>
<p>Just open up a cmd.exe and change the ip range..</p>
<blockquote><p>C:\&gt;FOR /L %x in (1,1,255) do ping -n 1 192.168.2.%x | find /I &quot;reply&quot; &gt;&gt; c:\temp\pingresult.txt</p>
</blockquote>
<p>The above command uses a FOR loop to ping each device and looks for &quot;Reply&quot; in the output. If there is a &quot;Reply&quot; then the host is up.. Results will be written to C:\temp\pingresults.txt</p>
<p>Or the PowerShell version: </p>
<blockquote><p>C:\&gt; 1..255 | foreach-object { (new-object System.Net.Networkinformation.Ping).Send(&quot;192.168.2.$_&quot;) } | where-object {$_.Status -eq &quot;success&quot;} | select Address</p>
</blockquote>
<p><span id="more-1240"></span>
<p>Address    <br />&#8212;&#8212;-     <br />192.168.2.1     <br />192.168.2.5     <br />192.168.2.10     <br />192.168.2.11     <br />192.168.2.12</p>
<p>At first glance the results are very similar and you would think, &quot;Why all the extra typing? The second command is 2.5 times longer!&quot; The big difference between the standard windows command line and powershell is that the latter uses objects, which gives a lot of power&#8230;in our shell. Not let&#8217;s see how it works&#8230;</p>
<p>In the above command the range operator (..) generates a list of the numbers 1 through 255. The cool thing is you don&#8217;t have to use just a single range, you can string them together like this (1..5),7,(9..10) which would give you the numbers 1-10 skipping 6 and 8.</p>
<blockquote><p>foreach-object { (new-object System.Net.Networkinformation.Ping).Send(&quot;10.10.10.$_&quot;) }</p>
</blockquote>
<p>The foreach-object takes the numbers fed into the pipeline and operates on them one at a time. First, it creates a new ping object and then calls the send method. The parameter given to the send method is a string concatenation of 10.10.10. and the number from $_, which is the &quot;current pipeline object.&quot; The $_ variable in our example will contain the numbers 1-255.</p>
<blockquote><p>where-object {$_.Status -eq &quot;success&quot;}</p>
</blockquote>
<p>The output of the send method is the PingReply object which contains a status. We can filter the results only successful pings reply objects will be sent further down the pipeline.</p>
<blockquote><p>Select Address      <br />Finally, all we care about is the address so that is the only piece we have displayed.</p>
</blockquote>
<p>Now that we know how it works, let&#8217;s pimp out our powershell version.</p>
<p>First, we don&#8217;t have to just use a contiguous set of numbers. If we wanted to scan all ip address before 10.10.10.100, after 10.10.10.200 and 10.10.10.155 we could use this:    <br />(1..99),(200..255),155 | foreach-object &#8230;.     <br />We can use the results to feed into other commands. You can ping sweep an entire subnet and have it automatically do an nslookup, attempt to list the contents of the c$ share, and tell you that you are doing a good job (a little positive reinforcement never hurts).</p>
<blockquote><p>PS C:\&gt;1..255 | foreach-object { (new-object System.Net.Networkinformation.Ping).Send(&quot;10.10.10.$_&quot;) } | where-object {$_.Status -eq &quot;success&quot;} | foreach-object { nslookup $_; gci &quot;\\$($_.Address)\c$&quot;; echo &quot;Good Job&quot; }</p>
</blockquote>
<p>The ping sweep can be sped up by setting a timeout value (in milliseconds). In the example below we set the timeout value to 100ms.</p>
<blockquote><p>&#8230; (new-object System.Net.Networkinformation.Ping).Send(&quot;10.10.10.$_&quot;, 100) &#8230;</p>
</blockquote>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/intent/tweet?text=Scan+IP+range+using+ping+http%3A%2F%2Fchristiano.ch%2Fwordpress%2F%3Fp%3D1240" title="Post to Twitter"><img class="nothumb" src="http://www.christiano.ch/wordpress/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/intent/tweet?text=Scan+IP+range+using+ping+http%3A%2F%2Fchristiano.ch%2Fwordpress%2F%3Fp%3D1240" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.christiano.ch/wordpress/2011/07/16/scan-ip-range-using-ping/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerShell: About SessionConfiguration and how to change them</title>
		<link>http://www.christiano.ch/wordpress/2010/04/24/powershell-about-sessionconfiguration-and-how-to-change-them/</link>
		<comments>http://www.christiano.ch/wordpress/2010/04/24/powershell-about-sessionconfiguration-and-how-to-change-them/#comments</comments>
		<pubDate>Sat, 24 Apr 2010 21:18:31 +0000</pubDate>
		<dc:creator>christian</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.christiano.ch/wordpress/?p=929</guid>
		<description><![CDATA[Remote Access Without Admin Privileges In PowerShell v.2, remote access is available only to users who hold local administrator privileges. So, even if you do have appropriate remote access to a machine, , you cannot remotely access the system if &#8230; <a href="http://www.christiano.ch/wordpress/2010/04/24/powershell-about-sessionconfiguration-and-how-to-change-them/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>Remote Access Without Admin Privileges</strong></p>
<p>In PowerShell v.2, remote access is available only to users who hold local administrator privileges. So, even if you do have appropriate remote access to a machine, , you cannot remotely access the system if you are not an Admin. This is not a technical limitation, though, just a safe default. You should use this line to change it :</p>
<p><strong>Set-PSSessionConfiguration -Name Microsoft.PowerShell -showSecurityDescriptorUI</strong></p>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/intent/tweet?text=PowerShell%3A+About+SessionConfiguration+and+how+to+change+them+http%3A%2F%2Fchristiano.ch%2Fwordpress%2F%3Fp%3D929" title="Post to Twitter"><img class="nothumb" src="http://www.christiano.ch/wordpress/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/intent/tweet?text=PowerShell%3A+About+SessionConfiguration+and+how+to+change+them+http%3A%2F%2Fchristiano.ch%2Fwordpress%2F%3Fp%3D929" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.christiano.ch/wordpress/2010/04/24/powershell-about-sessionconfiguration-and-how-to-change-them/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerShell: Generate PC Lists using Foreach-Object and -f Operator</title>
		<link>http://www.christiano.ch/wordpress/2010/04/24/powershell-generate-pc-lists-using-foreach-object-and-f-operator/</link>
		<comments>http://www.christiano.ch/wordpress/2010/04/24/powershell-generate-pc-lists-using-foreach-object-and-f-operator/#comments</comments>
		<pubDate>Sat, 24 Apr 2010 21:10:36 +0000</pubDate>
		<dc:creator>christian</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.christiano.ch/wordpress/?p=921</guid>
		<description><![CDATA[Generate PC Lists One easy way of creating lists of PC names or IP address ranges etc is a simple pipeline like this: 1..40 &#124; Foreach-Object { &#8216;PC-W7-A{0:000}&#8217; -f $_ } Use the -f operator to format the number. In &#8230; <a href="http://www.christiano.ch/wordpress/2010/04/24/powershell-generate-pc-lists-using-foreach-object-and-f-operator/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Generate PC Lists</p>
<p>One easy way of creating lists of PC names or IP address ranges etc is a simple pipeline like this:</p>
<p><strong>1..40 | Foreach-Object { &#8216;PC-W7-A{0:000}&#8217; -f $_ }</strong></p>
<p>Use the -f operator to format the number. In this example, it will always be three-digit.</p>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/intent/tweet?text=PowerShell%3A+Generate+PC+Lists+using+Foreach-Object+and+-f+Operator+http%3A%2F%2Fchristiano.ch%2Fwordpress%2F%3Fp%3D921" title="Post to Twitter"><img class="nothumb" src="http://www.christiano.ch/wordpress/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/intent/tweet?text=PowerShell%3A+Generate+PC+Lists+using+Foreach-Object+and+-f+Operator+http%3A%2F%2Fchristiano.ch%2Fwordpress%2F%3Fp%3D921" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.christiano.ch/wordpress/2010/04/24/powershell-generate-pc-lists-using-foreach-object-and-f-operator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerShell: Sort-Object</title>
		<link>http://www.christiano.ch/wordpress/2010/04/24/powershell-sort-object/</link>
		<comments>http://www.christiano.ch/wordpress/2010/04/24/powershell-sort-object/#comments</comments>
		<pubDate>Sat, 24 Apr 2010 21:08:19 +0000</pubDate>
		<dc:creator>christian</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.christiano.ch/wordpress/?p=919</guid>
		<description><![CDATA[You can use Sort-Object to sort simple variable types. Have a look at the following: &#8216;Tom&#8217;, &#8216;Chris&#8217;, &#8216;Judy&#8217;, &#8216;Alan&#8217; &#124; Sort-Object Input can come from a different command. If you’d like to get seven random lottery numbers, you should try &#8230; <a href="http://www.christiano.ch/wordpress/2010/04/24/powershell-sort-object/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>You can use Sort-Object to sort simple variable types. Have a look at the following:</p>
<p><strong>&#8216;Tom&#8217;, &#8216;Chris&#8217;, &#8216;Judy&#8217;, &#8216;Alan&#8217; | Sort-Object<br />
</strong></p>
<p>Input can come from a different command. If you’d like to get seven random lottery numbers, you should try this:</p>
<p><strong>1..49 | Get-Random -Count 7 | Sort-Object</strong></p>
<p>You’ll find that when you feed complex objects into Sort-Object, you should specify the object property you want to sort on (or else Sort-Object will pick one by itself):</p>
<p><strong>Get-ChildItem $env:windir | Sort-Object Length</strong></p>
<p>Here are some more examples:</p>
<p><strong>Get-HotFix | Sort-Object InstalledOn</p>
<p>Get-ComputerRestorePoint | Sort-Object Description</strong></p>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/intent/tweet?text=PowerShell%3A+Sort-Object+http%3A%2F%2Fchristiano.ch%2Fwordpress%2F%3Fp%3D919" title="Post to Twitter"><img class="nothumb" src="http://www.christiano.ch/wordpress/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/intent/tweet?text=PowerShell%3A+Sort-Object+http%3A%2F%2Fchristiano.ch%2Fwordpress%2F%3Fp%3D919" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.christiano.ch/wordpress/2010/04/24/powershell-sort-object/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Microsoft Exchange 2007 / 2010 &#8211; Statistics using Exchange Management Shell (EMS)</title>
		<link>http://www.christiano.ch/wordpress/2010/03/14/microsoft-exchange-2007-2010-statistics-using-exchange-management-shell-ems/</link>
		<comments>http://www.christiano.ch/wordpress/2010/03/14/microsoft-exchange-2007-2010-statistics-using-exchange-management-shell-ems/#comments</comments>
		<pubDate>Sun, 14 Mar 2010 09:14:10 +0000</pubDate>
		<dc:creator>christian</dc:creator>
				<category><![CDATA[Exchange Server]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Exchange]]></category>
		<category><![CDATA[Statistics]]></category>

		<guid isPermaLink="false">http://www.christiano.ch/wordpress/2010/03/14/microsoft-exchange-2007-2010-statistics-using-exchange-management-shell-ems/</guid>
		<description><![CDATA[Using Microsoft Exchange 2007 / 2010 Management Shell (PowerShell with extensions), you can pull out some very exciting statistics. That was never that easy in the pre Exchange 2007 era. Let’s start with some easy stuff.. Get the number of &#8230; <a href="http://www.christiano.ch/wordpress/2010/03/14/microsoft-exchange-2007-2010-statistics-using-exchange-management-shell-ems/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<table border="0" cellspacing="0" cellpadding="2" width="675">
<tbody>
<tr>
<td valign="top" width="676">Using Microsoft Exchange 2007 / 2010 Management Shell (PowerShell with extensions), you can pull out some very exciting statistics. That was never that easy in the pre Exchange 2007 era.</td>
<td valign="top" width="10"><a href="http://www.christiano.ch/wordpress/wp-content/uploads/2010/03/Logo_ExchangeSvr.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Logo_ExchangeSvr" border="0" alt="Logo_ExchangeSvr" src="http://www.christiano.ch/wordpress/wp-content/uploads/2010/03/Logo_ExchangeSvr_thumb.png" width="160" height="90" /></a> </td>
</tr>
</tbody>
</table>
<p> <span id="more-898"></span>
<p>Let’s start with some easy stuff..</p>
<p><strong>Get the number of Public Folders</strong></p>
<p><code>Get-PublicFolder -Recurse | Measure-Object</code></p>
<p><strong>Get the sum / number of Mails / Object in all Public Folders</strong></p>
<p><code>Get-PublicFolderStatistics | Measure-Object -Property ItemCount -Sum</code></p>
<p><strong>Get the number of Mailboxes</strong></p>
<p><code>Get-Mailbox | Measure-Object</code></p>
<p><strong>Get the number of sent messages / emails within a date range</strong></p>
<p><code>Get-MessageTrackingLog -Start &quot;29.11.2009&quot; -End &quot;30.12.2009&quot; -ResultSize Unlimited | Measure-Object</code></p>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/intent/tweet?text=Microsoft+Exchange+2007+%2F+2010+%E2%80%93+Statistics+using+Exchange+Management+Shell+%28EMS%29+http%3A%2F%2Fchristiano.ch%2Fwordpress%2F%3Fp%3D898" title="Post to Twitter"><img class="nothumb" src="http://www.christiano.ch/wordpress/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/intent/tweet?text=Microsoft+Exchange+2007+%2F+2010+%E2%80%93+Statistics+using+Exchange+Management+Shell+%28EMS%29+http%3A%2F%2Fchristiano.ch%2Fwordpress%2F%3Fp%3D898" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.christiano.ch/wordpress/2010/03/14/microsoft-exchange-2007-2010-statistics-using-exchange-management-shell-ems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerShell: Creating large dummy files with .NET</title>
		<link>http://www.christiano.ch/wordpress/2010/03/13/powershell-creating-large-dummy-files-with-net/</link>
		<comments>http://www.christiano.ch/wordpress/2010/03/13/powershell-creating-large-dummy-files-with-net/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 13:23:02 +0000</pubDate>
		<dc:creator>christian</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.christiano.ch/wordpress/2010/03/13/powershell-creating-large-dummy-files-with-net/</guid>
		<description><![CDATA[Ok, this one’s is cool i think. Whenever i needed a large dummy file, i opened up notepad, write ASDFASDFASDFA CTRL-A, CTRL-C, CTRL-V,CTRL-V,CTRL-V,CTRL-V. CTRL-A, CTRL-C, CTRL-V,CTRL-V,CTRL-V,CTRL-V,CTRL-V.. Then i saved the file, opened up a CMD-Shell and wrote copy dummyFile.txt+dummyFile.txt+dummyFile.txt until &#8230; <a href="http://www.christiano.ch/wordpress/2010/03/13/powershell-creating-large-dummy-files-with-net/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<table border="0" cellspacing="0" cellpadding="2" width="675">
<tbody>
<tr>
<td valign="top" width="666">Ok, this one’s is cool i think. Whenever i needed a large dummy file, i opened up notepad, write ASDFASDFASDFA CTRL-A, CTRL-C, CTRL-V,CTRL-V,CTRL-V,CTRL-V. CTRL-A, CTRL-C, CTRL-V,CTRL-V,CTRL-V,CTRL-V,CTRL-V.. Then i saved the file, opened up a CMD-Shell and wrote copy dummyFile.txt+dummyFile.txt+dummyFile.txt until the file was large enough.. ok, there’s fsutil.exe which does the same in a much more efficient manner.. OR, unleash the Power of .NET – no, you don’t have to start programming using Visual Studio, just open up PowerShell.. </td>
<td valign="top" width="10"><a href="http://www.christiano.ch/wordpress/wp-content/uploads/2010/03/Logo_PowerShell1.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Logo_PowerShell" border="0" alt="Logo_PowerShell" src="http://www.christiano.ch/wordpress/wp-content/uploads/2010/03/Logo_PowerShell_thumb1.png" width="160" height="125" /></a> </td>
</tr>
</tbody>
</table>
<p> <span id="more-895"></span>
<p>Ok, the goal is to have a 1gb large dummy file .. </p>
<p>first we declare a string variable called file: </p>
<p><code>PS C:\&gt; $file = &quot;$env:temp\dummyFile.txt&quot;</code></p>
<p>no we create on object of type Io.File    <br /><code>PS C:\&gt; $objFile = [io.file]::Create($file)</code></p>
<p>on the object, we call the void SetLength parameterized with 1gb&#160; <br /><code>PS C:\&gt; $objFile.SetLength(1gb)</code></p>
<p>no we call the close method and the file is written    <br /><code>PS C:\&gt; $objFile.Close()</code></p>
<p>using get-item $file we list the file we just created:</p>
<p><code>PS C:\&gt; Get-Item $file </code><code>Directory: C:\Users\&lt;removed&gt;\AppData\Local\Temp </code></p>
<p><code>Mode&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; LastWriteTime&#160;&#160;&#160;&#160; Length Name      <br />----&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; -------------&#160;&#160;&#160;&#160; ------ ----       <br />-a---&#160;&#160;&#160;&#160;&#160;&#160;&#160; 13.03.2010&#160;&#160;&#160;&#160; 14:07 1073741824 dummyFile.txt </code></p>
<p><code>PS C:\&gt;</code></p>
<p>Ok, finally we can call an ii (Invoke-Item) to open the Path where the dummyFile resides in Windows Explorer. </p>
<p>To get the Path from a File, we can use Get-ChildItem (Get-ChildItems returns a FileInfo Object/Class). This object has a DirectoryName Property. </p>
<p>We declare an Object $path</p>
<p><code>$path = Get-ChildItem $file</code></p>
<p>Finally we call the mentioned ii (Invoke-Item) to open the path in Windows Explorer.</p>
<p><code>ii $path.DirectoryName</code></p>
<p><strong><em>The complete Script </em></strong></p>
<p><code>$file = &quot;$env:temp\dummyFile.txt&quot;      <br />$objFile = [io.file]::Create($file)       <br />$objFile.SetLength(1gb)       <br />$objFile.Close()       <br />$path = Get-ChildItem $file       <br />ii $path.DirectoryName</code></p>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/intent/tweet?text=PowerShell%3A+Creating+large+dummy+files+with+.NET+http%3A%2F%2Fchristiano.ch%2Fwordpress%2F%3Fp%3D895" title="Post to Twitter"><img class="nothumb" src="http://www.christiano.ch/wordpress/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/intent/tweet?text=PowerShell%3A+Creating+large+dummy+files+with+.NET+http%3A%2F%2Fchristiano.ch%2Fwordpress%2F%3Fp%3D895" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.christiano.ch/wordpress/2010/03/13/powershell-creating-large-dummy-files-with-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerShell: Running PowerShell Scripts as Scheduled Task</title>
		<link>http://www.christiano.ch/wordpress/2010/03/10/powershell-running-powershell-scripts-as-scheduled-task/</link>
		<comments>http://www.christiano.ch/wordpress/2010/03/10/powershell-running-powershell-scripts-as-scheduled-task/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 06:04:39 +0000</pubDate>
		<dc:creator>christian</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Scheduled Task]]></category>

		<guid isPermaLink="false">http://www.christiano.ch/wordpress/2010/03/10/powershell-running-powershell-scripts-as-scheduled-task/</guid>
		<description><![CDATA[Schtasks.exe &#8211; Enables an administrator to create, delete, query, change, run, and end scheduled tasks on a local or remote computer. Running Schtasks.exe without arguments displays the status and next run time for each registered task. If you have jobs &#8230; <a href="http://www.christiano.ch/wordpress/2010/03/10/powershell-running-powershell-scripts-as-scheduled-task/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<table border="0" cellspacing="0" cellpadding="2" width="675">
<tbody>
<tr>
<td valign="top" width="671">Schtasks.exe &#8211; Enables an administrator to create, delete, query, change, run, and end scheduled tasks on a local or remote computer. Running Schtasks.exe without arguments displays the status and next run time for each registered task.          <br /> 
<p>If you have jobs that need to execute regularly, you can manage them with a PowerShell script and make it a scheduled task:</p>
</td>
<td valign="top" width="10"><a href="http://www.christiano.ch/wordpress/wp-content/uploads/2010/03/Logo_PowerShell.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Logo_PowerShell" border="0" alt="Logo_PowerShell" src="http://www.christiano.ch/wordpress/wp-content/uploads/2010/03/Logo_PowerShell_thumb.png" width="160" height="125" /></a> </td>
</tr>
</tbody>
</table>
<p> <span id="more-888"></span>
<p>To create a scheduled task do.</p>
<p><code>schtasks /CREATE /TN CheckHealthScript /TR &quot;powershell.exe -noprofile -executionpolicy Unrestricted -file %public%\checkhealth.ps1&quot; /IT /RL HIGHEST /SC DAILY</code></p>
<p>To get a list of scheduled tasks / enumerate scheduled tasks do:</p>
<p><code>schtasks /query</code></p>
<p><strong>Links</strong></p>
<p><a title="Running PowerShell Scripts as Scheduled Task" href="http://powershell.com/cs/blogs/tips/archive/2010/03/09/running-powershell-scripts-as-scheduled-task.aspx" target="_blank">Running PowerShell Scripts as Scheduled Task</a></p>
<p><a title="About Scheduled Tasks on MSDN" href="http://msdn.microsoft.com/en-us/library/bb736357%28VS.85%29.aspx" target="_blank">About Scheduled Tasks on MSDN</a></p>
<p><a title="About Scheduled Tasks on Technet" href="http://technet.microsoft.com/en-us/library/bb490996.aspx" target="_blank">About Scheduled Tasks on Technet</a></p>
<p>&#160;</p>
<p><strong><em>Script to enumerate / list scheduled tasks on a list of servers..</em></strong></p>
<p> <code>$Version=&quot;v8.4.28 Aaron Dodd&quot;   <br />$Description=&quot;Generate CSV of scheduled tasks in the environment&quot;    </p>
<p>#------------------------------------------------------------------------------    <br /># Settings / Variables    <br />#------------------------------------------------------------------------------    <br />If (Test-Path &quot;QueryScheduledTasks.config&quot;) {    <br />$cfg=[xml](get-content &quot;QueryScheduledTasks.config&quot;)    <br />} Else {    <br />Write-Host &quot;!! ERROR !! - Config file not found&quot;    <br />Write-Host &quot;A file with the same name as this script, ending in .config, must exist in the same directory as this script.&quot;    <br />exit    <br />}    </p>
<p>$ServerList = Import-Csv $cfg.configuration.ServerList.name    <br />$FinalReport=$cfg.configuration.FinalReport.name    <br />$TempDir=$cfg.configuration.TempFolder.name    <br />$TempReport=$TempDir + &quot;\temp.csv&quot;    <br />$ErrorActionPreference=$cfg.configuration.ErrorAction.value    <br />#------------------------------------------------------------------------------    </p>
<p>#------------------------------------------------------------------------------    <br /># Process tasks    <br />#------------------------------------------------------------------------------    <br />ForEach ($Server in $ServerList) {    <br />schtasks /QUERY /S $Server.Name /FO CSV /V &gt; $TempReport    <br />$TempCsv += Import-Csv $TempReport    <br />}    <br />Remove-Item $TempReport    <br />$TempCsv | Export-Csv $FinalReport -notype    <br />#----------------------------------------------------------------</code>
<p>found here =&gt; <a title="http://blog.geekpoet.net/2008/04/powershell-script-to-report-on-all.html" href="http://blog.geekpoet.net/2008/04/powershell-script-to-report-on-all.html" target="_blank">http://blog.geekpoet.net/2008/04/powershell-script-to-report-on-all.html</a></p>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/intent/tweet?text=PowerShell%3A+Running+PowerShell+Scripts+as+Scheduled+Task+http%3A%2F%2Fchristiano.ch%2Fwordpress%2F%3Fp%3D888" title="Post to Twitter"><img class="nothumb" src="http://www.christiano.ch/wordpress/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/intent/tweet?text=PowerShell%3A+Running+PowerShell+Scripts+as+Scheduled+Task+http%3A%2F%2Fchristiano.ch%2Fwordpress%2F%3Fp%3D888" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.christiano.ch/wordpress/2010/03/10/powershell-running-powershell-scripts-as-scheduled-task/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerShell: Delete specific files recursively / recursive</title>
		<link>http://www.christiano.ch/wordpress/2010/02/19/powershell-delete-specific-files-recursively-recursive/</link>
		<comments>http://www.christiano.ch/wordpress/2010/02/19/powershell-delete-specific-files-recursively-recursive/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 12:26:14 +0000</pubDate>
		<dc:creator>christian</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Get-ChildItem]]></category>
		<category><![CDATA[Remove-Item]]></category>
		<category><![CDATA[Where-Object]]></category>

		<guid isPermaLink="false">http://www.christiano.ch/wordpress/2010/02/19/powershell-delete-specific-files-recursively-recursive/</guid>
		<description><![CDATA[Okay, this post I&#8217;m going to write down for my personal notes but also for you.. Ever needed to delete a specific file, in my case in need to delete (remove-item) all *.pdb files in one of my Visual Studio &#8230; <a href="http://www.christiano.ch/wordpress/2010/02/19/powershell-delete-specific-files-recursively-recursive/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<table border="0" cellspacing="0" cellpadding="2" width="675">
<tbody>
<tr>
<td valign="top" width="644">Okay, this post I&#8217;m going to write down for my personal notes but also for you..          <br />Ever needed to delete a specific file, in my case in need to delete (remove-item) all *.pdb files in one of my Visual Studio Solution.. recursive of course.           <br />To get a list of Files use the <strong><em>Get-ChildItem</em></strong> CmdLet. Extend that command using the <strong><em>–rec</em></strong> or <strong><em>–recurse</em></strong> parameter – so you’ll get all the files recursively, starting from the current path / directory.</td>
<td valign="top" width="30"><a href="http://www.christiano.ch/wordpress/wp-content/uploads/2010/02/Logo_PowerShell.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Logo_PowerShell" border="0" alt="Logo_PowerShell" src="http://www.christiano.ch/wordpress/wp-content/uploads/2010/02/Logo_PowerShell_thumb.png" width="160" height="125" /></a> </td>
</tr>
</tbody>
</table>
<p> <span id="more-860"></span>
<p>Now, we don’t need all the file, but all the files with a specific extension. We’ll use the <strong><em>Where-Object </em></strong>to achieve this. Well if you do <strong><em>Get-ChildItem</em></strong> you’ll get something like:</p>
<p><em><strong>PS D:\DEMO&gt; Get-ChildItem </strong></em></p>
<p><em>&#160;&#160;&#160; Directory: D:\DEMO </em></p>
<p><em>Mode&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; LastWriteTime&#160;&#160;&#160;&#160; Length Name     <br />&#8212;-&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8212;&#8212;&#8212;&#8212;-&#160;&#160;&#160;&#160; &#8212;&#8212; &#8212;-      <br />d&#8212;-&#160;&#160;&#160;&#160;&#160;&#160;&#160; 19.02.2010&#160;&#160;&#160;&#160; 13:16&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; DEMO Folder      <br />-a&#8212;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 19.02.2010&#160;&#160;&#160;&#160; 13:17&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 18 someFile.ext </em></p>
<p><em>PS D:\DEMO&gt;</em></p>
<p>&#160;</p>
<p>So, how to get only files with a specific extension? Easy, using <strong><em>Get-Member </em></strong>we can list all properties of <strong><em>Get-ChildItem</em></strong>.</p>
<p><em><strong>PS D:\DEMO&gt; Get-ChildItem | Get-Member </strong></em></p>
<p><em>&#160;&#160; TypeName: System.IO.DirectoryInfo </em></p>
<p><em>Name&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; MemberType&#160;&#160;&#160;&#160; Definition     <br />&#8212;-&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8212;&#8212;&#8212;-&#160;&#160;&#160;&#160; &#8212;&#8212;&#8212;-      <br />Mode&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; CodeProperty&#160;&#160; System.String Mode{get=Mode;}      <br />Create&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Method&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.Void Create(System.Security.AccessControl.DirectorySecurity director&#8230;      <br />&#8230;      <br />&#8230;      <br /><strong>Extension&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Property&#160;&#160;&#160;&#160;&#160;&#160; System.String Extension {get;}</strong></em>    <br /><em>FullName&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Property&#160;&#160;&#160;&#160;&#160;&#160; System.String FullName {get;}     <br />&#8230;      <br />&#8230; </em></p>
<p><em>PS D:\DEMO&gt;</em></p>
<p>&#160;</p>
<p>When we want to search for a specific File Type, the Extension Property comes in very handy. </p>
<p>So, to get a list of all, let’s say *.tmp files recursively, we’ll write:</p>
<p><em><strong>PS D:\DEMO&gt; Get-ChildItem -Rec | Where {$_.Extension -match &quot;tmp&quot;} </strong></em></p>
<p><em>&#160;&#160;&#160; Directory: D:\DEMO </em></p>
<p><em>Mode&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; LastWriteTime&#160;&#160;&#160;&#160; Length Name     <br />&#8212;-&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8212;&#8212;&#8212;&#8212;-&#160;&#160;&#160;&#160; &#8212;&#8212; &#8212;-      <br />-a&#8212;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 19.02.2010&#160;&#160;&#160;&#160; 13:22&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 12 demo.tmp </em></p>
<p><em>&#160;&#160;&#160; Directory: D:\DEMO\DEMO Folder </em></p>
<p><em>Mode&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; LastWriteTime&#160;&#160;&#160;&#160; Length Name     <br />&#8212;-&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8212;&#8212;&#8212;&#8212;-&#160;&#160;&#160;&#160; &#8212;&#8212; &#8212;-      <br />-a&#8212;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 19.02.2010&#160;&#160;&#160;&#160; 13:22&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 12 dem32.tmp      <br />-a&#8212;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 19.02.2010&#160;&#160;&#160;&#160; 13:22&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 12 demo2.tmp </em></p>
<p><em>PS D:\DEMO&gt;</em></p>
<p>&#160;</p>
<p>Now, let’s delete all of these *.tmp files using Remove-Item</p>
<p><em><strong>PS D:\DEMO&gt; Get-ChildItem -Rec | Where {$_.Extension -match &quot;tmp&quot;} | Remove-Item</strong></em></p>
<p>and they are all gone!</p>
<div class="tweetthis" style="text-align:left;"><p> <a class="tt" href="http://twitter.com/intent/tweet?text=PowerShell%3A+Delete+specific+files+recursively+%2F+recursive+http%3A%2F%2Fchristiano.ch%2Fwordpress%2F%3Fp%3D860" title="Post to Twitter"><img class="nothumb" src="http://www.christiano.ch/wordpress/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/intent/tweet?text=PowerShell%3A+Delete+specific+files+recursively+%2F+recursive+http%3A%2F%2Fchristiano.ch%2Fwordpress%2F%3Fp%3D860" title="Post to Twitter">Tweet This Post</a></p></div>]]></content:encoded>
			<wfw:commentRss>http://www.christiano.ch/wordpress/2010/02/19/powershell-delete-specific-files-recursively-recursive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

