<?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>How Can I Automatically Run a Script Any Time a File is Added to a Folder?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2004/10/11/how-can-i-automatically-run-a-script-any-time-a-file-is-added-to-a-folder.aspx</link><description>Hey, Scripting Guy! Is it possible to have a script automatically run any time a file is added to a specific folder? -- MB 
 Hey, WM. Yes, this is possible, thanks to the magic of WMI events, which allow you to write a script to monitor for something</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: How Can I Automatically Run a Script Any Time a File is Added to a Folder?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2004/10/11/how-can-i-automatically-run-a-script-any-time-a-file-is-added-to-a-folder.aspx#3560383</link><pubDate>Fri, 22 Mar 2013 12:16:19 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3560383</guid><dc:creator>Ozi</dc:creator><description>&lt;p&gt;Hey is it possible to check the file being added to a drive as a whole, Rather then giving c:////Scripts can we give C:/ just?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3560383" width="1" height="1"&gt;</description></item><item><title>re: How Can I Automatically Run a Script Any Time a File is Added to a Folder?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2004/10/11/how-can-i-automatically-run-a-script-any-time-a-file-is-added-to-a-folder.aspx#3552700</link><pubDate>Thu, 14 Feb 2013 22:42:16 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3552700</guid><dc:creator>jrv</dc:creator><description>&lt;p&gt;@paris&lt;/p&gt;
&lt;p&gt;Control-C&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3552700" width="1" height="1"&gt;</description></item><item><title>re: How Can I Automatically Run a Script Any Time a File is Added to a Folder?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2004/10/11/how-can-i-automatically-run-a-script-any-time-a-file-is-added-to-a-folder.aspx#3552695</link><pubDate>Thu, 14 Feb 2013 22:23:47 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3552695</guid><dc:creator>JV</dc:creator><description>&lt;p&gt;@paris&lt;/p&gt;
&lt;p&gt;Control-C&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3552695" width="1" height="1"&gt;</description></item><item><title>re: How Can I Automatically Run a Script Any Time a File is Added to a Folder?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2004/10/11/how-can-i-automatically-run-a-script-any-time-a-file-is-added-to-a-folder.aspx#3552653</link><pubDate>Thu, 14 Feb 2013 19:53:00 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3552653</guid><dc:creator>paris</dc:creator><description>&lt;p&gt;We can stop the script using Windows Task Manager and looking for wscript.exe in the Processes, but how would we do that using WMI and scripting?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3552653" width="1" height="1"&gt;</description></item><item><title>re: How Can I Automatically Run a Script Any Time a File is Added to a Folder?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2004/10/11/how-can-i-automatically-run-a-script-any-time-a-file-is-added-to-a-folder.aspx#3523496</link><pubDate>Mon, 01 Oct 2012 11:29:19 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3523496</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;Great script but is it possible to make it monitor the %USERPROFILE% folder? &amp;nbsp;For instance C:\users\username\temp&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3523496" width="1" height="1"&gt;</description></item><item><title>re: How Can I Automatically Run a Script Any Time a File is Added to a Folder?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2004/10/11/how-can-i-automatically-run-a-script-any-time-a-file-is-added-to-a-folder.aspx#3510146</link><pubDate>Sun, 22 Jul 2012 00:51:45 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3510146</guid><dc:creator>Ed Wilson</dc:creator><description>&lt;p&gt;@DaveAef This article is written using VBScript and not using Windows PowerShell. The &amp;amp; character, which is concatenation in VBScript is the invocation operator in PowerShell. The space underscore is line continuation in VBScript. As it turns out, this week, I wrote about this topic. Go to the archives, and look at the Hey Scripting Guy articles for the week of July 16, 2012. You will see where I modify this query and use it in Windows PowerShell.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3510146" width="1" height="1"&gt;</description></item><item><title>re: How Can I Automatically Run a Script Any Time a File is Added to a Folder?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2004/10/11/how-can-i-automatically-run-a-script-any-time-a-file-is-added-to-a-folder.aspx#3510144</link><pubDate>Sun, 22 Jul 2012 00:40:33 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3510144</guid><dc:creator>DaveAef</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I tried the following in Powershell (execute privilege, etc. is OK):&lt;/p&gt;
&lt;p&gt;get-WmiObject -query &amp;quot;SELECT * FROM __InstanceCreationEvent WITHIN 10 WHERE &amp;quot; _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;amp; &amp;quot;Targetinstance ISA &amp;#39;CIM_DirectoryContainsFile&amp;#39; and &amp;quot; _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;amp; &amp;quot;TargetInstance.GroupComponent= &amp;quot; _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;amp; &amp;quot;&amp;#39;Win32_Directory.Name=&amp;quot;&amp;quot;c:\\\\temp&amp;quot;&amp;quot;&amp;#39;&amp;quot;&lt;/p&gt;
&lt;p&gt;The only change I made was to the target directory name. &amp;nbsp;The *&amp;amp;&amp;quot;s did not work. &amp;nbsp;I exchanged the &amp;quot;&amp;amp;&amp;quot;&amp;#39;s for &amp;quot;+&amp;quot;&amp;#39;s and got:&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; Get-WmiObject : A positional parameter cannot be found that accepts argument &amp;#39;+&amp;#39;&lt;/p&gt;
&lt;p&gt;I removed the &amp;quot;+&amp;quot; and left PS to do its own concatenation and got:&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Get-WmiObject : A positional parameter cannot be found that accepts argument &amp;#39;Targetinstance ISA &amp;#39;CIM_DirectoryContainsFile&amp;#39; and &amp;#39;.&lt;/p&gt;
&lt;p&gt;Any suggestions? &amp;nbsp;Am I going down the wrong path? &amp;nbsp;Any help greatly appreciated.&lt;/p&gt;
&lt;p&gt;DaveAef&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3510144" width="1" height="1"&gt;</description></item><item><title>re: How Can I Automatically Run a Script Any Time a File is Added to a Folder?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2004/10/11/how-can-i-automatically-run-a-script-any-time-a-file-is-added-to-a-folder.aspx#3508097</link><pubDate>Mon, 09 Jul 2012 14:56:40 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3508097</guid><dc:creator>ed wilson</dc:creator><description>&lt;p&gt;@Ittechstop you do not want to use this on a permanent basis ... this is a temporary event. You can change it to be a permanent event and then it would do exactly what you want. Look at this collection of articles that will explain the differences between temporary and permanent WMI events: &lt;a rel="nofollow" target="_new" href="http://aka.ms/InsideWMIEvents"&gt;http://aka.ms/InsideWMIEvents&lt;/a&gt; &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3508097" width="1" height="1"&gt;</description></item><item><title>re: How Can I Automatically Run a Script Any Time a File is Added to a Folder?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2004/10/11/how-can-i-automatically-run-a-script-any-time-a-file-is-added-to-a-folder.aspx#3508094</link><pubDate>Mon, 09 Jul 2012 14:53:12 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3508094</guid><dc:creator>Ed Wilson</dc:creator><description>&lt;p&gt;@Mini you will change the script to monitor for changes to the directory &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3508094" width="1" height="1"&gt;</description></item><item><title>re: How Can I Automatically Run a Script Any Time a File is Added to a Folder?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2004/10/11/how-can-i-automatically-run-a-script-any-time-a-file-is-added-to-a-folder.aspx#3508000</link><pubDate>Mon, 09 Jul 2012 04:47:38 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3508000</guid><dc:creator>ittechstop</dc:creator><description>&lt;p&gt;Is it possible to monitor a folder on a remote machine (in a workgroup so I have to pass the login info) with this script and move the file to the local machine when a file gets created? &amp;nbsp;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3508000" width="1" height="1"&gt;</description></item></channel></rss>