<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.technet.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Use PowerShell to Monitor for the Creation of New Files</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2012/07/17/use-powershell-to-monitor-for-the-creation-of-new-files.aspx</link><description>Microsoft Scripting Guy, Ed Wilson, shows how to use Windows PowerShell to monitor for the creation of new files.</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Use PowerShell to Monitor for the Creation of New Files</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2012/07/17/use-powershell-to-monitor-for-the-creation-of-new-files.aspx#3510851</link><pubDate>Wed, 25 Jul 2012 16:45:11 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3510851</guid><dc:creator>Ed Wilson</dc:creator><description>&lt;p&gt;@K_Schulte Yes, I like the .NET Filesystem watcher, and have written some PowerShell scripts using it. Finding this stuff? Well as you said it is documented in MSDN, and in my WMI book. A blog is also documentation? Right? But one of the great things about PowerShell is that it is self discovering, and it also makes it easy to take an idea and test it out. In the old days, when you had to horribly complicated VBScripts it did not make it possible to experiment to easily.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3510851" width="1" height="1"&gt;</description></item><item><title>re: Use PowerShell to Monitor for the Creation of New Files</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2012/07/17/use-powershell-to-monitor-for-the-creation-of-new-files.aspx#3510803</link><pubDate>Wed, 25 Jul 2012 13:55:07 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3510803</guid><dc:creator>K_Schulte</dc:creator><description>&lt;p&gt;Hi Ed,&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve already seen this kind of FileSystemWatcher ( which is a .Net framework object that could be used to watch file events) using WMI somewhere on this blog before. Maybe I remember the old VBScript version but I&amp;#39;m not that sure ... I didn&amp;#39;t find it by now :-)&lt;/p&gt;
&lt;p&gt;Anyway ... it&amp;#39;s great what we can do with WMI events and I&amp;#39;m sure that is much more to find out.&lt;/p&gt;
&lt;p&gt;But the difficulty is &amp;quot;how to find out what we can do and how it could be done&amp;quot; ( I&amp;#39;m sure that there will be some documentation on MSDN or other sites ... but I hardly would ever guessed how to associate the classes and what the required classes are. This is the hardest part.&lt;/p&gt;
&lt;p&gt;The &amp;quot;$fileEvent.SourceEventArgs.NewEvent.TargetInstance.PartComponent&amp;quot; is such a thing.&lt;/p&gt;
&lt;p&gt;Who would ever have found out, that this is the way to get at the name of the newly created file !?&lt;/p&gt;
&lt;p&gt;This is the voodoo part of it ... (un)Registering and waiting for the event is quite easy with PS 2.0 (or 3.0)&lt;/p&gt;
&lt;p&gt;Way cool &lt;/p&gt;
&lt;p&gt;Klaus.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3510803" width="1" height="1"&gt;</description></item><item><title>re: Use PowerShell to Monitor for the Creation of New Files</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2012/07/17/use-powershell-to-monitor-for-the-creation-of-new-files.aspx#3509772</link><pubDate>Thu, 19 Jul 2012 14:17:29 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3509772</guid><dc:creator>IamMred</dc:creator><description>&lt;p&gt;@Rick on a Windows Server FTP is a folder, and therefore yes it would monitor a FTP site.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3509772" width="1" height="1"&gt;</description></item><item><title>re: Use PowerShell to Monitor for the Creation of New Files</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2012/07/17/use-powershell-to-monitor-for-the-creation-of-new-files.aspx#3509592</link><pubDate>Wed, 18 Jul 2012 17:11:01 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3509592</guid><dc:creator>Rick</dc:creator><description>&lt;p&gt;I know this could monitor local drive. Is it possible to monitor a ftp site?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3509592" width="1" height="1"&gt;</description></item><item><title>re: Use PowerShell to Monitor for the Creation of New Files</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2012/07/17/use-powershell-to-monitor-for-the-creation-of-new-files.aspx#3509581</link><pubDate>Wed, 18 Jul 2012 15:56:48 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3509581</guid><dc:creator>IamMred</dc:creator><description>&lt;p&gt;@hallstev5 no. &amp;nbsp;you will need one event per folder. Using this exact query it only montors the top folder.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3509581" width="1" height="1"&gt;</description></item><item><title>re: Use PowerShell to Monitor for the Creation of New Files</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2012/07/17/use-powershell-to-monitor-for-the-creation-of-new-files.aspx#3509580</link><pubDate>Wed, 18 Jul 2012 15:55:37 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3509580</guid><dc:creator>IamMred</dc:creator><description>&lt;p&gt;@Rjcox you are absolutely correct ... this is not a replacement for process monitor from Sysinternals. But, this IS in the box, and the Sysinternals tools are not, and for quick things IF you know this technique it will come in useful. In addition, this exact technique can monitor for nearly any of the thousands of WMI classes, and so from that perspective it is more flexible. In addition, this article is a building block, and later in the week (like on Friday) I will turn this query into a permenant event ... and so it will monitor all the time.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3509580" width="1" height="1"&gt;</description></item><item><title>re: Use PowerShell to Monitor for the Creation of New Files</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2012/07/17/use-powershell-to-monitor-for-the-creation-of-new-files.aspx#3509579</link><pubDate>Wed, 18 Jul 2012 15:52:51 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3509579</guid><dc:creator>IamMred</dc:creator><description>&lt;p&gt;Sorry about not including the full source code in the posting. I have uploaded the script to the TechNet Script Repository and added a sentence to the end of the article that points to that code. Thank you for pointing this out to me. Sorry for the inconvience.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3509579" width="1" height="1"&gt;</description></item><item><title>re: Use PowerShell to Monitor for the Creation of New Files</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2012/07/17/use-powershell-to-monitor-for-the-creation-of-new-files.aspx#3509563</link><pubDate>Wed, 18 Jul 2012 14:12:14 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3509563</guid><dc:creator>hallstev5</dc:creator><description>&lt;p&gt;Is it possible to monitor more than 1 folder per event? &amp;nbsp;Also is it going to monitor the top level folder only or can it do subfolders as well?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3509563" width="1" height="1"&gt;</description></item><item><title>re: Use PowerShell to Monitor for the Creation of New Files</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2012/07/17/use-powershell-to-monitor-for-the-creation-of-new-files.aspx#3509531</link><pubDate>Wed, 18 Jul 2012 11:06:57 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3509531</guid><dc:creator>rjcox</dc:creator><description>&lt;p&gt;Of course, for most purposes Process Monitor is far more powerful and detailed (eg. see individual IO operations with call stacks etc.)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3509531" width="1" height="1"&gt;</description></item><item><title>re: Use PowerShell to Monitor for the Creation of New Files</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2012/07/17/use-powershell-to-monitor-for-the-creation-of-new-files.aspx#3509523</link><pubDate>Wed, 18 Jul 2012 09:52:58 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3509523</guid><dc:creator>Баф</dc:creator><description>&lt;p&gt;Hi!&lt;/p&gt;
&lt;p&gt;Why you didn&amp;#39;t include full source code of your script in a post?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3509523" width="1" height="1"&gt;</description></item></channel></rss>