<?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>stuartpreston.net &#187; Visual Studio</title>
	<atom:link href="http://stuartpreston.net/blog/category/visual-studio/feed/" rel="self" type="application/rss+xml" />
	<link>http://stuartpreston.net/blog</link>
	<description>Blog of Stuart Preston</description>
	<lastBuildDate>Fri, 06 Apr 2012 22:46:52 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Automated installation of SQL Server 2012 for TFS &#8220;11&#8243; at the command line</title>
		<link>http://stuartpreston.net/blog/2012/04/06/automated-installation-of-sql-server-2012-for-tfs-11-at-the-command-line/</link>
		<comments>http://stuartpreston.net/blog/2012/04/06/automated-installation-of-sql-server-2012-for-tfs-11-at-the-command-line/#comments</comments>
		<pubDate>Fri, 06 Apr 2012 22:21:23 +0000</pubDate>
		<dc:creator>Stuart Preston</dc:creator>
				<category><![CDATA[ALM]]></category>
		<category><![CDATA[Application Lifecycle Management]]></category>
		<category><![CDATA[Team Foundation Server]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://stuartpreston.net/blog/?p=74</guid>
		<description><![CDATA[If I had one pound sterling for every Team Foundation Server install I&#8217;ve performed in my life I&#8217;d be a rich man by now.  Back in late 2004/early 2005 when a number of us were playing with the alpha TFS 2005 bits, all the components had to be installed on a separate machines and [...]]]></description>
			<content:encoded><![CDATA[<p>If I had one pound sterling for every <a href="http://www.microsoft.com/visualstudio/en-gb/products/2010-editions/team-foundation-server">Team Foundation Server</a> install I&#8217;ve performed in my life I&#8217;d be a rich man by now.  Back in late 2004/early 2005 when a number of us were playing with the alpha TFS 2005 bits, all the components had to be installed on a separate machines and if you made the slightest mistake it was a rebuild job from the bare metal &#8211; of course Virtualisation technologies like snapshotting weren&#8217;t mainstream in those days and installation was a pain!</p>
<p>Fast forward 8 years and here we are; .NET Framework is properly integrated as a system component in the OS, Virtualisation and snapshotting is the norm, disks have got much faster, TFS installs in minutes (not hours) and automatically configures IIS and all the prerequisites it needs, which makes life amazingly easy.</p>
<p>Grant Holliday wrote <a href="http://blogs.msdn.com/b/granth/archive/2009/10/18/tfs2010-installing-pre-requisites-from-the-command-line.aspx">this article</a> that I still refer to when I need to build a TFS2010 virtual machine from scratch so when I came to installing a brand new Windows 8 Server with SQL Server 2012 and TFS &#8220;11&#8243; in a Virtual Machine I had to do a little bit of thinking for myself.</p>
<p>Assuming you want to create a Default instance of SQL Server 2012 complete with Analysis Services and SQL Server Reporting Services (SSRS) as if you had accepted all the defaults:</p>
<ul>
<li>start with a completely blank Windows 8 Server image with no roles or features added</li>
<li>mount the disk in your favourite manner (i.e. mount the .iso image on your host machine from the menu on your guest VM, or use <a href="http://www.slysoft.com/en/virtual-clonedrive.html">Virtual CloneDrive</a> to mount the .iso file locally)</li>
<li>at a new administrator command prompt, replace the <strong>highlighted </strong>bits with a valid user who you wish to have full access to everything!) and paste the whole thing:</li>
</ul>
<pre>d:\setup.exe /QS /ACTION="Install" /ENU /UpdateEnabled /FEATURES=SQLENGINE,FULLTEXT,AS,RS,SSMS,ADV_SSMS /UpdateSource="MU" /INDICATEPROGRESS="True" /X86="False" /INSTALLSHAREDDIR="C:\Program Files\Microsoft SQL Server" /INSTALLSHAREDWOWDIR="C:\Program Files (x86)\Microsoft SQL Server" /INSTANCENAME="MSSQLSERVER" /INSTANCEID="MSSQLSERVER" /SQMREPORTING="False" /RSINSTALLMODE="DefaultNativeMode" /ERRORREPORTING="False" /INSTANCEDIR="C:\Program Files\Microsoft SQL Server" /AGTSVCACCOUNT="NT Service\SQLSERVERAGENT" /AGTSVCSTARTUPTYPE="Manual" /ASSVCACCOUNT="NT Service\MSSQLServerOLAPService" /ASSVCSTARTUPTYPE="Automatic" /ASCOLLATION="Latin1_General_CI_AS" /ASDATADIR="C:\Program Files\Microsoft SQL Server\MSAS11.MSSQLSERVER\OLAP\Data" /ASLOGDIR="C:\Program Files\Microsoft SQL Server\MSAS11.MSSQLSERVER\OLAP\Log" /ASBACKUPDIR="C:\Program Files\Microsoft SQL Server\MSAS11.MSSQLSERVER\OLAP\Backup" /ASTEMPDIR="C:\Program Files\Microsoft SQL Server\MSAS11.MSSQLSERVER\OLAP\Temp" /ASCONFIGDIR="C:\Program Files\Microsoft SQL Server\MSAS11.MSSQLSERVER\OLAP\Config" /ASPROVIDERMSOLAP="1" /ASSYSADMINACCOUNTS="<strong>VS11BETA\Administrator</strong>" /ASSERVERMODE="MULTIDIMENSIONAL" /SQLSVCSTARTUPTYPE="Automatic" /FILESTREAMLEVEL="0" /SQLCOLLATION="Latin1_General_CI_AS" /SQLSVCACCOUNT="NT Service\MSSQLSERVER" /SQLSYSADMINACCOUNTS="<strong>VS11BETA\Administrator</strong>" /TCPENABLED="1" /NPENABLED="0" /BROWSERSVCSTARTUPTYPE="Disabled" /RSSVCACCOUNT="NT Service\ReportServer" /RSSVCSTARTUPTYPE="Automatic" /FTSVCACCOUNT="NT Service\MSSQLFDLauncher" /IAcceptSQLServerLicenseTerms</pre>
<p>Installation will progress for a while but when finished you have all the components required to do the TFS 11 install immediately afterwards.</p>
]]></content:encoded>
			<wfw:commentRss>http://stuartpreston.net/blog/2012/04/06/automated-installation-of-sql-server-2012-for-tfs-11-at-the-command-line/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Running and debugging a .NET  application as Network Service in Visual Studio 2010</title>
		<link>http://stuartpreston.net/blog/2010/05/18/running-and-debugging-a-net-application-as-network-service-in-visual-studio-2010/</link>
		<comments>http://stuartpreston.net/blog/2010/05/18/running-and-debugging-a-net-application-as-network-service-in-visual-studio-2010/#comments</comments>
		<pubDate>Tue, 18 May 2010 10:04:07 +0000</pubDate>
		<dc:creator>Stuart Preston</dc:creator>
				<category><![CDATA[Development Practices]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://stuartpreston.net/blog/2010/05/18/running-and-debugging-a-net-application-as-network-service-in-visual-studio-2010/</guid>
		<description><![CDATA[This post generated some interest on a discussion list so I’m re-posting here on my blog.  Cutting a longer story short, the original poster wanted a way to start a process as Network Service rather than as the current Windows identity to mitigate the risk that you have more rights than you should have. 
For those [...]]]></description>
			<content:encoded><![CDATA[<p>This post generated some interest on a discussion list so I’m re-posting here on my blog.  Cutting a longer story short, the original poster wanted a way to start a process as Network Service rather than as the current Windows identity to mitigate the risk that you have more rights than you should have. </p>
<p>For those who have tried to use “runas” to achieve this you are left with the rather bleak message: “RUNAS ERROR: Unable to acquire user password”. </p>
<p><img style="display: inline; border: 0px;" title="image" src="http://stuartpreston.net/blog/wp-content/uploads/2010/05/image2.png" border="0" alt="image" width="700" height="369" /></p>
<p>I’ll skip the reasons for this and go straight onto the solution.  Create a dummy service using the Service Manager (sc.exe).  This launches the application in the right session and is allowed to run as Network Service or even Local System (NT Authority\Local System).</p>
<blockquote><p>@echo off<br />
sc delete NetworkServiceCmd &gt;nul:<br />
sc create NetworkServiceCmd binpath= &#8220;cmd /K start c:\neverendingapp.exe&#8221; obj= &#8220;NT Authority\Network Service&#8221; &gt;nul:<br />
sc start NetworkServiceCmd &gt;nul:<br />
sc delete NetworkServiceCmd &gt;nul:</p></blockquote>
<p>Simply drop the above into a batch file and run it.  You can then use “Attach to Process” in Visual Studio to attach to the process (don’t forget that your PDB’s must be in the same location as the assembly).</p>
<p><img style="display: inline; border: 0px;" title="image" src="http://stuartpreston.net/blog/wp-content/uploads/2010/05/image3.png" border="0" alt="image" width="720" height="310" /></p>
<p>Here’s a screenshot of the debugger attached to my “NeverEndingApp” and viewing the current identity.</p>
<p><img style="display: inline; border: 0px;" title="image" src="http://stuartpreston.net/blog/wp-content/uploads/2010/05/image4.png" border="0" alt="image" width="720" height="522" /></p>
<p>You need to manually kill off the process you started, you can use Task Manager as usual or here’s a macro I use that works in my scenario.  You can attach this to a Keyboard Shortcut or even a Toolbar.</p>
<blockquote><p>Imports System<br />
Imports EnvDTE<br />
Imports EnvDTE80<br />
Imports EnvDTE90<br />
Imports EnvDTE90a<br />
Imports EnvDTE100<br />
Imports System.Diagnostics</p>
<p>Public Module TerminateProcess</p>
<p>    Public Function TerminateProcess()</p>
<p>        Dim processes As EnvDTE.Processes = DTE.Debugger.LocalProcesses<br />
        Dim process As EnvDTE.Process</p>
<p>        For Each process In processes<br />
            If (process.Name.ToLower().Contains(&#8220;neverendingapp.exe&#8221;)) Then<br />
                process.Terminate(True)<br />
            End If<br />
        Next</p>
<p>End Function<br />
End Module</p></blockquote>
<p>I’m certain all the above can be improved on but I think all the basics are in here and customising it for your process is a challenge I’ll leave to the reader!</p>
]]></content:encoded>
			<wfw:commentRss>http://stuartpreston.net/blog/2010/05/18/running-and-debugging-a-net-application-as-network-service-in-visual-studio-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

