<?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>Shawson&#039;s Code Blog &#187; Windows</title>
	<atom:link href="http://codeblog.shawson.co.uk/category/windows/feed/" rel="self" type="application/rss+xml" />
	<link>http://codeblog.shawson.co.uk</link>
	<description>development notes for my failing memory</description>
	<lastBuildDate>Wed, 01 Feb 2012 11:00:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Grabbing data from the registry on a remote machine using dot net and WMI</title>
		<link>http://codeblog.shawson.co.uk/grabbing-data-from-the-registry-on-a-remote-machine-using-dot-net-and-wmi/</link>
		<comments>http://codeblog.shawson.co.uk/grabbing-data-from-the-registry-on-a-remote-machine-using-dot-net-and-wmi/#comments</comments>
		<pubDate>Tue, 22 Nov 2011 13:24:57 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[C#.net]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://codeblog.shawson.co.uk/?p=1281</guid>
		<description><![CDATA[I recently had to write an app which, given a computer name, would grab their telephone extension from a registry key (For the purpose of the code example below, I just grab the CommonFilesDir key from the windows node. There&#8217;s a couple of ways you can achieve this- either using RegistryKey.OpenRemoteBaseKey which gave me a [...]


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/using-urlencode-urldecode-and-other-http-functions-from-a-non-web-file/' rel='bookmark' title='Using URLEncode, URLDecode and other Http functions from a non Web file'>Using URLEncode, URLDecode and other Http functions from a non Web file</a></li>
<li><a href='http://codeblog.shawson.co.uk/wcf-404-3-errors/' rel='bookmark' title='WCF 404.3 Errors'>WCF 404.3 Errors</a></li>
<li><a href='http://codeblog.shawson.co.uk/making-your-wcf-service-compatible-with-legacy-net-1-1-applications/' rel='bookmark' title='Making your WCF Service compatible with legacy .net 1.1 applications'>Making your WCF Service compatible with legacy .net 1.1 applications</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>I recently had to write an app which, given a computer name, would grab their telephone extension from a registry key (For the purpose of the code example below, I just grab the CommonFilesDir key from the windows node.  There&#8217;s a couple of ways you can achieve this- either using <a href="http://msdn.microsoft.com/en-us/library/8zha3xws.aspx">RegistryKey.OpenRemoteBaseKey</a> which gave me a whole bunch of permissions issues, plus you need the remote registry and remote administration services active on the server/client OR you can use the Windows Management Instrumentation (WMI) service.  I took this route, as it&#8217;s a service which is active by default on all of our machines on the domain, and it was easier to get the permissions right.  </p>
<p>Before I paste the code, a GOTCHA to beware of, straight from the MSDN <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa392722(v=vs.85).aspx">here</a>;</p>
<blockquote><p>The registry provider is hosted in LocalService—not the LocalSystem. Therefore, obtaining information remotely from the subtree HKEY_CURRENT_USER is not possible</p></blockquote>
<pre class="brush: csharp">
ConnectionOptions options = new ConnectionOptions();
options.Impersonation = ImpersonationLevel.Impersonate;
options.EnablePrivileges = true;
options.Username = &quot;&lt;domain_admin_username&gt;&quot;;
options.Password = &quot;&lt;domain_admin_password&gt;&quot;;

// http://msdn.microsoft.com/en-us/library/system.management.managementscope.aspx
ManagementScope ms = new ManagementScope(&quot;\\\\&lt;computer name&gt;\\root\\default&quot;, options);          

ms.Connect();

// http://msdn.microsoft.com/en-us/library/windows/desktop/aa390788(v=vs.85).aspx
ManagementClass mc = new ManagementClass(&quot;stdRegProv&quot;);
mc.Scope = ms;

ManagementBaseObject inParams = mc.GetMethodParameters(&quot;GetStringValue&quot;);
// there are other methods for grabbing other reg types- see
// http://msdn.microsoft.com/en-us/library/windows/desktop/aa393664(v=VS.85).aspx

inParams[&quot;hDefKey&quot;] = RegHive.HKEY_LOCAL_MACHINE;
inParams[&quot;sSubKeyName&quot;] = &quot;SOFTWARE\\Microsoft\\Windows\\CurrentVersion&quot;;
inParams[&quot;sValueName&quot;] = &quot;CommonFilesDir&quot;;

ManagementBaseObject outParams =
        mc.InvokeMethod(&quot;GetStringValue&quot;, inParams, null);

if (outParams[&quot;ReturnValue&quot;].ToString() == &quot;0&quot;)
{
    Console.WriteLine(outParams[&quot;sValue&quot;]);
}
else
{
    Console.WriteLine(&quot;Error &quot; + outParams[&quot;ReturnValue&quot;] + &quot; please refer to http://msdn.microsoft.com/en-us/library/ms681382%28v=3Dvs.85%29.aspx&quot;);
}

Console.ReadLine();
</pre>
<p>This code requires this enum..</p>
<pre class="brush: csharp">
public enum RegHive : uint
{
  HKEY_CLASSES_ROOT = 0x80000000,
  HKEY_CURRENT_USER = 0x80000001,
  HKEY_LOCAL_MACHINE = 0x80000002,
  HKEY_USERS = 0x80000003,
  HKEY_CURRENT_CONFIG = 0x80000005
}
</pre>
<p>If you receive a COM error back &#8220;The RPC server is unavailable&#8221;, make sure the target machine&#8217;s firewall isn&#8217;t blocking the call- this will open the port;<br />
<code>netsh firewall set service RemoteAdmin</code></p>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/using-urlencode-urldecode-and-other-http-functions-from-a-non-web-file/' rel='bookmark' title='Using URLEncode, URLDecode and other Http functions from a non Web file'>Using URLEncode, URLDecode and other Http functions from a non Web file</a></li>
<li><a href='http://codeblog.shawson.co.uk/wcf-404-3-errors/' rel='bookmark' title='WCF 404.3 Errors'>WCF 404.3 Errors</a></li>
<li><a href='http://codeblog.shawson.co.uk/making-your-wcf-service-compatible-with-legacy-net-1-1-applications/' rel='bookmark' title='Making your WCF Service compatible with legacy .net 1.1 applications'>Making your WCF Service compatible with legacy .net 1.1 applications</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/grabbing-data-from-the-registry-on-a-remote-machine-using-dot-net-and-wmi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Open Windows Firewall ports for SQL Server 2008</title>
		<link>http://codeblog.shawson.co.uk/open-windows-firewall-ports-for-sql-server-2008/</link>
		<comments>http://codeblog.shawson.co.uk/open-windows-firewall-ports-for-sql-server-2008/#comments</comments>
		<pubDate>Fri, 04 Nov 2011 15:23:12 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[Batch Scripting]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://codeblog.shawson.co.uk/?p=1274</guid>
		<description><![CDATA[http://support.microsoft.com/kb/968872 As noted in the article, you can run this batch file; @echo ========= SQL Server Ports =================== @echo Enabling SQLServer default instance port 1433 netsh firewall set portopening TCP 1433 "SQLServer" @echo Enabling Dedicated Admin Connection port 1434 netsh firewall set portopening TCP 1434 "SQL Admin Connection" @echo Enabling conventional SQL Server Service Broker [...]


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/command-line-to-delete-every-file-older-than-30-days/' rel='bookmark' title='Command line to delete every file older than 30 days'>Command line to delete every file older than 30 days</a></li>
<li><a href='http://codeblog.shawson.co.uk/how-to-run-sql-profiler-against-local-sql-express-instances/' rel='bookmark' title='How to run SQL Profiler against local SQL Express instances'>How to run SQL Profiler against local SQL Express instances</a></li>
<li><a href='http://codeblog.shawson.co.uk/aspnet-role-membership-providers-under-iis7-doesnt-work/' rel='bookmark' title='ASP.Net Role &amp; Membership Providers (Under IIS7) &#8211; DOESN&#8217;T Work!'>ASP.Net Role &#038; Membership Providers (Under IIS7) &#8211; DOESN&#8217;T Work!</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p><a href="http://support.microsoft.com/kb/968872">http://support.microsoft.com/kb/968872</a></p>
<p>As noted in the article, you can run this batch file;</p>
<pre>
@echo =========  SQL Server Ports  ===================
@echo Enabling SQLServer default instance port 1433
netsh firewall set portopening TCP 1433 "SQLServer"
@echo Enabling Dedicated Admin Connection port 1434
netsh firewall set portopening TCP 1434 "SQL Admin Connection"
@echo Enabling conventional SQL Server Service Broker port 4022
netsh firewall set portopening TCP 4022 "SQL Service Broker"
@echo Enabling Transact-SQL Debugger/RPC port 135
netsh firewall set portopening TCP 135 "SQL Debugger/RPC"
@echo =========  Analysis Services Ports  ==============
@echo Enabling SSAS Default Instance port 2383
netsh firewall set portopening TCP 2383 "Analysis Services"
@echo Enabling SQL Server Browser Service port 2382
netsh firewall set portopening TCP 2382 "SQL Browser"
@echo =========  Misc Applications  ==============
@echo Enabling HTTP port 80
netsh firewall set portopening TCP 80 "HTTP"
@echo Enabling SSL port 443
netsh firewall set portopening TCP 443 "SSL"
@echo Enabling port for SQL Server Browser Service's 'Browse' Button
netsh firewall set portopening UDP 1434 "SQL Browser"
@echo Allowing multicast broadcast response on UDP (Browser Service Enumerations OK)
netsh firewall set multicastbroadcastresponse ENABLE
</pre>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/command-line-to-delete-every-file-older-than-30-days/' rel='bookmark' title='Command line to delete every file older than 30 days'>Command line to delete every file older than 30 days</a></li>
<li><a href='http://codeblog.shawson.co.uk/how-to-run-sql-profiler-against-local-sql-express-instances/' rel='bookmark' title='How to run SQL Profiler against local SQL Express instances'>How to run SQL Profiler against local SQL Express instances</a></li>
<li><a href='http://codeblog.shawson.co.uk/aspnet-role-membership-providers-under-iis7-doesnt-work/' rel='bookmark' title='ASP.Net Role &amp; Membership Providers (Under IIS7) &#8211; DOESN&#8217;T Work!'>ASP.Net Role &#038; Membership Providers (Under IIS7) &#8211; DOESN&#8217;T Work!</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/open-windows-firewall-ports-for-sql-server-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Command Line- create a folder named with todays date</title>
		<link>http://codeblog.shawson.co.uk/command-line-create-a-folder-named-with-todays-date/</link>
		<comments>http://codeblog.shawson.co.uk/command-line-create-a-folder-named-with-todays-date/#comments</comments>
		<pubDate>Tue, 23 Aug 2011 15:08:15 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[Batch Scripting]]></category>

		<guid isPermaLink="false">http://codeblog.shawson.co.uk/?p=1170</guid>
		<description><![CDATA[mkdir %date:~-4,4%%date:~-7,2%%date:~0,2% will produce a folder named like this; YYYYMMDD Thanks to Mr Carmichael for this.. Related posts:Command line Batch File to Remove Direcories, using a Wild Card! Command line to delete every file older than 30 days


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/command-line-batch-file-to-remove-direcories-using-a-wild-card/' rel='bookmark' title='Command line Batch File to Remove Direcories, using a Wild Card!'>Command line Batch File to Remove Direcories, using a Wild Card!</a></li>
<li><a href='http://codeblog.shawson.co.uk/command-line-to-delete-every-file-older-than-30-days/' rel='bookmark' title='Command line to delete every file older than 30 days'>Command line to delete every file older than 30 days</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>mkdir %date:~-4,4%%date:~-7,2%%date:~0,2%<br />
will produce a folder named like this; YYYYMMDD</p>
<p>Thanks to Mr Carmichael for this..</p>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/command-line-batch-file-to-remove-direcories-using-a-wild-card/' rel='bookmark' title='Command line Batch File to Remove Direcories, using a Wild Card!'>Command line Batch File to Remove Direcories, using a Wild Card!</a></li>
<li><a href='http://codeblog.shawson.co.uk/command-line-to-delete-every-file-older-than-30-days/' rel='bookmark' title='Command line to delete every file older than 30 days'>Command line to delete every file older than 30 days</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/command-line-create-a-folder-named-with-todays-date/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automatic NAS Box shutdown &#8211; How to execute applications on Windows Shutdown (Part 2/2)</title>
		<link>http://codeblog.shawson.co.uk/automatic-nas-box-shutdown-how-to-execute-applications-on-windows-shutdown-part-22/</link>
		<comments>http://codeblog.shawson.co.uk/automatic-nas-box-shutdown-how-to-execute-applications-on-windows-shutdown-part-22/#comments</comments>
		<pubDate>Sun, 03 Jul 2011 13:37:53 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://codeblog.shawson.co.uk/?p=1063</guid>
		<description><![CDATA[In Part 1 we looked at how to figure out what message was being sent from the web management page of my Netgear ReadyNAS Duo network storage box, and then how to replicate that to happy from a c# dot net console application. To finish this off, we now need some way of making that [...]


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/removing-stored-log-in-credentials-for-network-shares-in-windows-xp/' rel='bookmark' title='Removing stored log in credentials for network shares in Windows XP'>Removing stored log in credentials for network shares in Windows XP</a></li>
<li><a href='http://codeblog.shawson.co.uk/windows-vista-visual-studio-20035-and-front-page-extensions/' rel='bookmark' title='Windows Vista, Visual Studio 2003/5 and Front Page Extensions!'>Windows Vista, Visual Studio 2003/5 and Front Page Extensions!</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>In <a title="Automatic shutdown of my Netgear ReadyNAS Duo network storage server triggered by Windows shutdown (Part 1/2)" href="http://codeblog.shawson.co.uk/automatic-shutdown-of-my-netgear-readynas-duo-network-storage-server/">Part 1</a> we looked at how to figure out what message was being sent from the web management page of my Netgear ReadyNAS Duo network storage box, and then how to replicate that to happy from a c# dot net console application.  To finish this off, we now need some way of making that new console app run automatically when I shut down my Windows 7 PC.</p>
<p>I started in the Task Scheduler panel in Control Panel &gt; Administrative Tools.</p>
<p>On the right hand panel you can then select &#8220;Create Task&#8230;&#8221;.  From this dialogue you have a number of tabs along the top- the second one along, right after General is &#8220;Triggers&#8221; &#8211; switch to this and then hit the &#8220;New&#8230;&#8221; button which brings up a third window called &#8220;New Trigger&#8221;.  From the drop down list entitled &#8220;Begin the task:&#8221; check the selected option from the default &#8220;On a schedule&#8221; to &#8220;On an event&#8221;.  So you should now see something similar to this screen shot;</p>
<p style="text-align: center;"><a href="http://codeblog.shawson.co.uk/wp-content/uploads/2011/07/create_task.jpg"><img class="aligncenter size-large wp-image-1065" title="create_task" src="http://codeblog.shawson.co.uk/wp-content/uploads/2011/07/create_task-1024x572.jpg" alt="" width="614" height="343" /></a></p>
<p>At this point I was kind of stumped- The other options in that &#8220;Begin the task:&#8221; list were things like &#8220;At log on&#8221;, &#8220;At startup&#8221;, &#8220;On work station lock&#8221; etc &#8211; there was no &#8220;On Shutdown&#8221;!!  So I selected &#8220;On an event&#8221;.  This gives you three new options in Settings &#8211; Log, Source and Event.  From here it was down to taking an educated guess.  I knew that shutting down Windows was likly to be logged as a &#8220;System&#8221; event, so in the first drop down I selected System.</p>
<p>What to choose in the Source drop down was not so clear- so to decide on an event source to use, I opened the Event Viewer, again from Control Panel &gt; Administrative Tools.  From the left hand panel, I opened the &#8220;Windows Logs&#8221; branch, then from within that selected &#8220;System&#8221;.  These are arranged by time, so it&#8217;s just a matter of going back to when you turned your computer on today, then going back a couple more to see the last things your computer logged before turning off when you last used it.</p>
<p style="text-align: center;"><a href="http://codeblog.shawson.co.uk/wp-content/uploads/2011/07/events.jpg"><img class="aligncenter size-large wp-image-1068" title="events" src="http://codeblog.shawson.co.uk/wp-content/uploads/2011/07/events-1024x448.jpg" alt="" width="614" height="269" /></a></p>
<p>In the end I opted for the event shown in the above screen shot- by reading the description I noticed it mentioned shutting down explorer.exe (a main component in Windows) because of the &#8220;power off of computer&#8221;, which I figured, with out knowing the in&#8217;s and out&#8217;s of what this really meant, sounded pretty promising.  So from the same window I noted the Source &#8220;USER32&#8243; and Event ID &#8220;1074&#8243;.  Going back to the New Trigger window I found that USER32 did indeed appear in the list, so I selected that and entered 1074 as the event ID.  This is pretty much everything for the trigger, so hit ok, then move on to the Actions tab, and click &#8220;New&#8230;&#8221;</p>
<p style="text-align: center;"><a href="http://codeblog.shawson.co.uk/wp-content/uploads/2011/07/task-actions.jpg"><img class="aligncenter size-large wp-image-1070" title="task-actions" src="http://codeblog.shawson.co.uk/wp-content/uploads/2011/07/task-actions-1024x572.jpg" alt="" width="614" height="343" /></a></p>
<p>From here it&#8217;s pretty easy- the action we want is to &#8220;Start a program&#8221; then just use the browser button to find the program you want to run.  Click OK and return to the General tab.</p>
<p>This final step may not be required, but I did it anyway just to be sure- on the general tab, I changed the radio button at the end and selected &#8220;Run whether user is logged on or not&#8221;.  I also changed the &#8220;Configure for:&#8221; drom down at the bottom to be &#8220;Windows 7, Windows Server 2008 R2&#8243;.  And that&#8217;s it- Shut down your computer to give it a go.  If you are following on from my previous post and you pointed the action dialogue to run the .exe produced from the last post, you should see your computer shut down and then a few seconds later the NAS box will power down.</p>
<p>Drop me a comment if I&#8217;ve missed any critical details!</p>
<p><a href="http://codeblog.shawson.co.uk/netgear-readynas-duo-command-line-shut-down-utility/">You can see the finished app here</a></p>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/removing-stored-log-in-credentials-for-network-shares-in-windows-xp/' rel='bookmark' title='Removing stored log in credentials for network shares in Windows XP'>Removing stored log in credentials for network shares in Windows XP</a></li>
<li><a href='http://codeblog.shawson.co.uk/windows-vista-visual-studio-20035-and-front-page-extensions/' rel='bookmark' title='Windows Vista, Visual Studio 2003/5 and Front Page Extensions!'>Windows Vista, Visual Studio 2003/5 and Front Page Extensions!</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/automatic-nas-box-shutdown-how-to-execute-applications-on-windows-shutdown-part-22/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ninite Easy PC Setup &#8211; Silent Unattended Install Multiple Programs At Once</title>
		<link>http://codeblog.shawson.co.uk/ninite-easy-pc-setup-silent-unattended-install-multiple-programs-at-once/</link>
		<comments>http://codeblog.shawson.co.uk/ninite-easy-pc-setup-silent-unattended-install-multiple-programs-at-once/#comments</comments>
		<pubDate>Thu, 09 Sep 2010 10:06:06 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.shawson.co.uk/codeblog/?p=778</guid>
		<description><![CDATA[Nige at work pointed me over to an awesome site for creating a one stop setup for installing all your useful apps in one go after a format- just tick the apps you want and download the installer. Ninite Easy PC Setup &#8211; Silent Unattended Install Multiple Programs At Once. Related posts:Windows Vista, Visual Studio [...]


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/windows-vista-visual-studio-20035-and-front-page-extensions/' rel='bookmark' title='Windows Vista, Visual Studio 2003/5 and Front Page Extensions!'>Windows Vista, Visual Studio 2003/5 and Front Page Extensions!</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>Nige at work pointed me over to an awesome site for creating a one stop setup for installing all your useful apps in one go after a format- just tick the apps you want and download the installer.</p>
<p><a href="http://ninite.com/">Ninite Easy PC Setup &#8211; Silent Unattended Install Multiple Programs At Once</a>.</p>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/windows-vista-visual-studio-20035-and-front-page-extensions/' rel='bookmark' title='Windows Vista, Visual Studio 2003/5 and Front Page Extensions!'>Windows Vista, Visual Studio 2003/5 and Front Page Extensions!</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/ninite-easy-pc-setup-silent-unattended-install-multiple-programs-at-once/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introducing the Microsoft Web Farm Framework &#8211; ScottGu&#8217;s Blog</title>
		<link>http://codeblog.shawson.co.uk/introducing-the-microsoft-web-farm-framework-scottgus-blog/</link>
		<comments>http://codeblog.shawson.co.uk/introducing-the-microsoft-web-farm-framework-scottgus-blog/#comments</comments>
		<pubDate>Wed, 08 Sep 2010 07:52:14 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[IIS]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.shawson.co.uk/codeblog/?p=776</guid>
		<description><![CDATA[Introducing the Microsoft Web Farm Framework &#8211; ScottGu&#8217;s Blog. Related posts:My shiny new blog MSDeploy Setup Guide &#038; How to Call Server Side Method Using jQuery/Ajax


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/my-shiny-new-blog/' rel='bookmark' title='My shiny new blog'>My shiny new blog</a></li>
<li><a href='http://codeblog.shawson.co.uk/msdeploy-setup-and-calling-server-side-method-using-jqueryajax-karans-blog/' rel='bookmark' title='MSDeploy Setup Guide &amp; How to Call Server Side Method Using jQuery/Ajax'>MSDeploy Setup Guide &#038; How to Call Server Side Method Using jQuery/Ajax</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p><a href="http://weblogs.asp.net/scottgu/archive/2010/09/08/introducing-the-microsoft-web-farm-framework.aspx">Introducing the Microsoft Web Farm Framework &#8211; ScottGu&#8217;s Blog</a>.</p>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/my-shiny-new-blog/' rel='bookmark' title='My shiny new blog'>My shiny new blog</a></li>
<li><a href='http://codeblog.shawson.co.uk/msdeploy-setup-and-calling-server-side-method-using-jqueryajax-karans-blog/' rel='bookmark' title='MSDeploy Setup Guide &amp; How to Call Server Side Method Using jQuery/Ajax'>MSDeploy Setup Guide &#038; How to Call Server Side Method Using jQuery/Ajax</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/introducing-the-microsoft-web-farm-framework-scottgus-blog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Command line to delete every file older than 30 days</title>
		<link>http://codeblog.shawson.co.uk/command-line-to-delete-every-file-older-than-30-days/</link>
		<comments>http://codeblog.shawson.co.uk/command-line-to-delete-every-file-older-than-30-days/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 10:56:41 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[Batch Scripting]]></category>

		<guid isPermaLink="false">http://www.shawson.co.uk/codeblog/?p=483</guid>
		<description><![CDATA[I found a new command line directive i&#8217;d never heard of today, along with a brilliant example of it&#8217;s use- once you have changed your working directory, running this will remove any files or folders older than 30 days; FORFILES /D -30 /C &#34;CMD /C IF @isdir==FALSE (echo Deleting File @file) &#38; (ATTRIB -H @file) [...]


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/command-line-batch-file-to-remove-direcories-using-a-wild-card/' rel='bookmark' title='Command line Batch File to Remove Direcories, using a Wild Card!'>Command line Batch File to Remove Direcories, using a Wild Card!</a></li>
<li><a href='http://codeblog.shawson.co.uk/open-windows-firewall-ports-for-sql-server-2008/' rel='bookmark' title='Open Windows Firewall ports for SQL Server 2008'>Open Windows Firewall ports for SQL Server 2008</a></li>
<li><a href='http://codeblog.shawson.co.uk/umbraco-installation-folder-permissions-setup/' rel='bookmark' title='Umbraco Installation &#8211; folder permissions setup'>Umbraco Installation &#8211; folder permissions setup</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>I found a new command line directive i&#8217;d never heard of today, along with a brilliant example of it&#8217;s use- once you have changed your working directory, running this will remove any files or folders older than 30 days;</p>
<pre class="brush: php">
FORFILES /D -30 /C &quot;CMD /C IF @isdir==FALSE (echo Deleting File @file) &amp; (ATTRIB -H @file) &amp; (DEL /F /Q @file) ELSE (echo Deleting Directory @file) &amp; (ATTRIB -H @FILE) &amp; (RD /S /Q @FILE)&quot;
</pre>
<p>As an example, I&#8217;ve since used this to iterate over a bunch of folders, deleting any files over 30 days;</p>
<pre class="brush: php">
d:
for /f &quot;delims=|&quot; %%f in (&#039;dir /b D:\_SQL_Backup\&#039;) DO (
  cd \_SQL_Backup
  cd %%f
  FORFILES /D -14 /C &quot;CMD /C IF @isdir==FALSE (echo Deleting File @file) &amp; (ATTRIB -H @file) &amp; (DEL /F /Q @file)&quot;
)
</pre>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/command-line-batch-file-to-remove-direcories-using-a-wild-card/' rel='bookmark' title='Command line Batch File to Remove Direcories, using a Wild Card!'>Command line Batch File to Remove Direcories, using a Wild Card!</a></li>
<li><a href='http://codeblog.shawson.co.uk/open-windows-firewall-ports-for-sql-server-2008/' rel='bookmark' title='Open Windows Firewall ports for SQL Server 2008'>Open Windows Firewall ports for SQL Server 2008</a></li>
<li><a href='http://codeblog.shawson.co.uk/umbraco-installation-folder-permissions-setup/' rel='bookmark' title='Umbraco Installation &#8211; folder permissions setup'>Umbraco Installation &#8211; folder permissions setup</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/command-line-to-delete-every-file-older-than-30-days/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Umbraco Installation &#8211; folder permissions setup</title>
		<link>http://codeblog.shawson.co.uk/umbraco-installation-folder-permissions-setup/</link>
		<comments>http://codeblog.shawson.co.uk/umbraco-installation-folder-permissions-setup/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 10:18:46 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[Batch Scripting]]></category>
		<category><![CDATA[Umbraco]]></category>

		<guid isPermaLink="false">http://www.shawson.co.uk/codeblog/?p=399</guid>
		<description><![CDATA[Just a real quick batch script i knocked up which sets the appropriate permissions to the various folders in the root of a fresh umbraco install- just drop this into a batch file, and run it from the root of your umbraco install; REM 2009.10.22 SY - Set permissions- user/ folders from "Install Umbraco 4 [...]


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/paged-list-of-child-nodes-un-umbraco/' rel='bookmark' title='Paged List of Child Nodes in Umbraco'>Paged List of Child Nodes in Umbraco</a></li>
<li><a href='http://codeblog.shawson.co.uk/command-line-batch-file-to-remove-direcories-using-a-wild-card/' rel='bookmark' title='Command line Batch File to Remove Direcories, using a Wild Card!'>Command line Batch File to Remove Direcories, using a Wild Card!</a></li>
<li><a href='http://codeblog.shawson.co.uk/giving-umbraco-trees-children/' rel='bookmark' title='Giving Umbraco custom tree&#8217;s children!'>Giving Umbraco custom tree&#8217;s children!</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>Just a real quick batch script i knocked up which sets the appropriate permissions to the various folders in the root of a fresh umbraco install- just drop this into a batch file, and run it from the root of your umbraco install;</p>
<pre>
REM 2009.10.22 SY - Set permissions- user/ folders from "Install Umbraco 4 on Windows Vista" guide
icacls app_code /grant "Network Service":(OI)(CI)(F)
icacls bin /grant "Network Service":(OI)(CI)(F)
icacls config /grant "Network Service":(OI)(CI)(F)
icacls css /grant "Network Service":(OI)(CI)(F)
icacls data /grant "Network Service":(OI)(CI)(F)
icacls masterpages /grant "Network Service":(OI)(CI)(F)
icacls media /grant "Network Service":(OI)(CI)(F)
icacls python /grant "Network Service":(OI)(CI)(F)
icacls scripts /grant "Network Service":(OI)(CI)(F)
icacls umbraco /grant "Network Service":(OI)(CI)(F)
icacls usercontrols /grant "Network Service":(OI)(CI)(F)
icacls xslt /grant "Network Service":(OI)(CI)(F)
pause
</pre>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/paged-list-of-child-nodes-un-umbraco/' rel='bookmark' title='Paged List of Child Nodes in Umbraco'>Paged List of Child Nodes in Umbraco</a></li>
<li><a href='http://codeblog.shawson.co.uk/command-line-batch-file-to-remove-direcories-using-a-wild-card/' rel='bookmark' title='Command line Batch File to Remove Direcories, using a Wild Card!'>Command line Batch File to Remove Direcories, using a Wild Card!</a></li>
<li><a href='http://codeblog.shawson.co.uk/giving-umbraco-trees-children/' rel='bookmark' title='Giving Umbraco custom tree&#8217;s children!'>Giving Umbraco custom tree&#8217;s children!</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/umbraco-installation-folder-permissions-setup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Command line Batch File to Remove Direcories, using a Wild Card!</title>
		<link>http://codeblog.shawson.co.uk/command-line-batch-file-to-remove-direcories-using-a-wild-card/</link>
		<comments>http://codeblog.shawson.co.uk/command-line-batch-file-to-remove-direcories-using-a-wild-card/#comments</comments>
		<pubDate>Wed, 28 Oct 2009 14:27:20 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[Batch Scripting]]></category>
		<category><![CDATA[Command Line]]></category>

		<guid isPermaLink="false">http://www.shawson.co.uk/codeblog/?p=393</guid>
		<description><![CDATA[We have a bunch of web services which log details of requests that come in, in folders named using the current date- in the format YYYY-MM-DDD-HH-MM-SS. I wanted to produce a simple cleanup batch file which we could run every month to bin all logs for transactions which happened 3 months ago- using the dos [...]


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/command-line-to-delete-every-file-older-than-30-days/' rel='bookmark' title='Command line to delete every file older than 30 days'>Command line to delete every file older than 30 days</a></li>
<li><a href='http://codeblog.shawson.co.uk/umbraco-installation-folder-permissions-setup/' rel='bookmark' title='Umbraco Installation &#8211; folder permissions setup'>Umbraco Installation &#8211; folder permissions setup</a></li>
<li><a href='http://codeblog.shawson.co.uk/command-line-create-a-folder-named-with-todays-date/' rel='bookmark' title='Command Line- create a folder named with todays date'>Command Line- create a folder named with todays date</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>We have a bunch of web services which log details of requests that come in, in folders named using the current date- in the format YYYY-MM-DDD-HH-MM-SS.  I wanted to produce a simple cleanup batch file which we could run every month to bin all logs for transactions which happened 3 months ago- using the dos commands which exist on Windows Server 2003.</p>
<p>The dos &#8220;del&#8221; command allows you to delete using wild cards &#8211; so for example &#8220;dev 2009-07-*&#8221; would erase any files starting with &#8220;2009-07-&#8221;; However this doesn&#8217;t work with folders- so it fell to the rd (remove directory) command- but this doesn&#8217;t support wild cards (I&#8217;m assuming for safety- to stop you permanently erasing 100&#8242;s of folders and their contents accidently- remember there&#8217;s no recycle bin when you delete from the command line!).</p>
<p>To get around this I created a simple Batch file which accepted a wildcard as a parameter, then removes all those folders at the current level (it wont check recursivly).  Just in case this is of use to anyone else, here&#8217;s the code;</p>
<pre>
REM - performs a remove directory, with wildcard matching - example ; rd-wildcard 2007-*
dir %1 /b >loglist.txt
setlocal enabledelayedexpansion
for /f %%a in (./loglist.txt) do (
	rd /s /q %%a
)
del /q loglist.txt
endlocal
</pre>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/command-line-to-delete-every-file-older-than-30-days/' rel='bookmark' title='Command line to delete every file older than 30 days'>Command line to delete every file older than 30 days</a></li>
<li><a href='http://codeblog.shawson.co.uk/umbraco-installation-folder-permissions-setup/' rel='bookmark' title='Umbraco Installation &#8211; folder permissions setup'>Umbraco Installation &#8211; folder permissions setup</a></li>
<li><a href='http://codeblog.shawson.co.uk/command-line-create-a-folder-named-with-todays-date/' rel='bookmark' title='Command Line- create a folder named with todays date'>Command Line- create a folder named with todays date</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/command-line-batch-file-to-remove-direcories-using-a-wild-card/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Windows Vista, Visual Studio 2003/5 and Front Page Extensions!</title>
		<link>http://codeblog.shawson.co.uk/windows-vista-visual-studio-20035-and-front-page-extensions/</link>
		<comments>http://codeblog.shawson.co.uk/windows-vista-visual-studio-20035-and-front-page-extensions/#comments</comments>
		<pubDate>Fri, 22 May 2009 10:54:14 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[IIS]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Front Page]]></category>
		<category><![CDATA[Vista]]></category>

		<guid isPermaLink="false">http://www.shawson.co.uk/codeblog/?p=175</guid>
		<description><![CDATA[We recently got new machines at work with Vista installed, allowing us to use IIS7, which has the added benefit of being able to run more than one site on the local IIS (unlike our previous IIS6 Win XP boxes) When installing the various incarnations of visual studio to enable me to support some of [...]


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/ninite-easy-pc-setup-silent-unattended-install-multiple-programs-at-once/' rel='bookmark' title='Ninite Easy PC Setup &#8211; Silent Unattended Install Multiple Programs At Once'>Ninite Easy PC Setup &#8211; Silent Unattended Install Multiple Programs At Once</a></li>
<li><a href='http://codeblog.shawson.co.uk/runaway-sharepoint-2003-indexing/' rel='bookmark' title='Runaway Sharepoint 2003 Indexing!'>Runaway Sharepoint 2003 Indexing!</a></li>
<li><a href='http://codeblog.shawson.co.uk/world-of-vs-make-it-easy-to-change-the-default-browser-in-visual-studio-blog/' rel='bookmark' title='World of VS: Make it easy to change the default browser in Visual Studio Blog'>World of VS: Make it easy to change the default browser in Visual Studio Blog</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>We recently got new machines at work with Vista installed, allowing us to use IIS7, which has the added benefit of being able to run more than one site on the local IIS (unlike our previous IIS6 Win XP boxes)</p>
<p>When installing the various incarnations of visual studio to enable me to support some of our legacy app&#8217;s I came across a problem when installing Visual Studio 2003.  One of the pre-requisites is front page extensions which are no longer shipped with Windows in Vista- the solution was a version of the extensions made by ready to run software which is actually linked to from the <a href="http://www.iis.net/downloads/default.aspx?tabid=34&#038;g=6&#038;i=1630" target="_blank">Official IIS Site</a> (the article is named &#8220;FrontPage 2002 Server Extensions for IIS 7.0&#8243; incase you have to use the site search, after another of microsoft&#8217;s random url switch around&#8217;s they&#8217;re so fond of) -you can grab the install from here : <a href="http://www.rtr.com/fpse/" target="_blank">http://www.rtr.com/fpse/</a></p>
<p>Once you&#8217;ve run the installer, make sure you execute the following from the command line to activate them for your default website otherwise the .net installer still won&#8217;t recognise that you have them installed;</p>
<pre> owsadm.exe –o install </pre>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/ninite-easy-pc-setup-silent-unattended-install-multiple-programs-at-once/' rel='bookmark' title='Ninite Easy PC Setup &#8211; Silent Unattended Install Multiple Programs At Once'>Ninite Easy PC Setup &#8211; Silent Unattended Install Multiple Programs At Once</a></li>
<li><a href='http://codeblog.shawson.co.uk/runaway-sharepoint-2003-indexing/' rel='bookmark' title='Runaway Sharepoint 2003 Indexing!'>Runaway Sharepoint 2003 Indexing!</a></li>
<li><a href='http://codeblog.shawson.co.uk/world-of-vs-make-it-easy-to-change-the-default-browser-in-visual-studio-blog/' rel='bookmark' title='World of VS: Make it easy to change the default browser in Visual Studio Blog'>World of VS: Make it easy to change the default browser in Visual Studio Blog</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/windows-vista-visual-studio-20035-and-front-page-extensions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

