<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.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>The Deployment guy</title><link>http://blogs.msdn.com/ssehgal/default.aspx</link><description>Blog about technology, processes and best practices to make deployment easy. Primary focus on automating web based application deployment. Talks about technologies like Windows Server 2008, IIS7, SQL Server 2008, Powershell. </description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>7000 Dominoes mark Windows 7 Launch</title><link>http://blogs.msdn.com/ssehgal/archive/2009/10/29/7000-dominoes-mark-windows-7-launch.aspx</link><pubDate>Thu, 29 Oct 2009 12:21:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9914667</guid><dc:creator>ssehgal</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/ssehgal/comments/9914667.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ssehgal/commentrss.aspx?PostID=9914667</wfw:commentRss><description>&lt;p&gt;What comes to your mind when you think about Product Launch: Roadshows? Celebrity performances? Press conference? Gliterry evening with fancy stage? &lt;/p&gt;  &lt;p&gt;How about Dominoes? Sounds different? Well, it was. 22 Microsoft employees worked for hours to setup 7000 dominoes at Microsoft campus in Hyderabad, India. The occasion was Windows 7 Launch on 22 October 2009.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;How it started&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Archis Gore came up with the idea of having a Domino demonstration and a couple of others found it really interested and unique. Like minded people gathered, discussed and executed the plan.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;What made it possible&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;22 employees, 7000 dominoes, hours of effort to put up the dominoes, 3 dry runs and a lot of brainstorming.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;All those who worked on the effort (in alphabetical order):&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Anirban Debaprabha Das;Ansuman Acharya;Anup Nair;Archis Gore;Gargi Mitra;Gunjan Kesri;Hari Prasad N;Jitu Keshri;Lakshman Kumar Veerarajan;Mukesh Bhangria;Neha Gupta;Prashali Moodabettu Lakshminarayana;Puneet Singh;Ravi Kiran Puttaswamy;Sachin Verma;Sidharth Sehgal;Sidharth Vijayachandran;Swapnil Kothe;Tanvi Ritwik&lt;/p&gt;  &lt;p&gt;Not to forget the support we got from : Anil Bhansali, Chitra Sood, Juhee Ahmed and Debjani Mukherji&lt;/p&gt;  &lt;p&gt;And are you wondering if I am late in blogging about it? No… I was waiting for the right time, today is the 7th day of Windows 7 launch :) It’s all about 7 you see&lt;/p&gt;  &lt;p&gt;Video of the Domino Demonstration (Uploaded by Archis Gore and Shoot by Ankur Sadhoo)&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:26d72948-623b-4557-9cc6-2ba51ca48d06" class="wlWriterEditableSmartContent"&gt;&lt;div id="237b6aa2-7f31-4e91-9a32-6e73e58af890" style="margin: 0px; padding: 0px; display: inline;"&gt;&lt;div&gt;&lt;a href="http://www.youtube.com/watch?v=wi4PgybW1pc" target="_new"&gt;&lt;img src="http://blogs.msdn.com/blogfiles/ssehgal/WindowsLiveWriter/7000DominoesmarkedWindows7Launch_DA27/video4b82a4dbaf64.jpg" style="border-style: none" galleryimg="no" onload="var downlevelDiv = document.getElementById('237b6aa2-7f31-4e91-9a32-6e73e58af890'); downlevelDiv.innerHTML = &amp;quot;&amp;lt;div&amp;gt;&amp;lt;object width=\&amp;quot;425\&amp;quot; height=\&amp;quot;355\&amp;quot;&amp;gt;&amp;lt;param name=\&amp;quot;movie\&amp;quot; value=\&amp;quot;http://www.youtube.com/v/wi4PgybW1pc&amp;amp;hl=en\&amp;quot;&amp;gt;&amp;lt;\/param&amp;gt;&amp;lt;embed src=\&amp;quot;http://www.youtube.com/v/wi4PgybW1pc&amp;amp;hl=en\&amp;quot; type=\&amp;quot;application/x-shockwave-flash\&amp;quot; width=\&amp;quot;425\&amp;quot; height=\&amp;quot;355\&amp;quot;&amp;gt;&amp;lt;\/embed&amp;gt;&amp;lt;\/object&amp;gt;&amp;lt;\/div&amp;gt;&amp;quot;;" alt=""&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;During one of the dry runs. We devised a way of setting up the fallen dominoes without disturbing the ones near them (and you can see me on the pipes).&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:f312f9f7-c86e-481c-8b1f-3d40600eeb40" class="wlWriterEditableSmartContent"&gt;&lt;div&gt;&lt;object width="320" height="240" &gt;&lt;param name="allowfullscreen" value="true" /&gt;&lt;param name="allowscriptaccess" value="always" /&gt;&lt;param name="movie" value="http://www.facebook.com/v/164484308607" /&gt;&lt;embed src="http://www.facebook.com/v/164484308607" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="320" height="240"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;/div&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;Some pictures from the Event:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;a href="http://blogs.msdn.com/blogfiles/ssehgal/WindowsLiveWriter/7000DominoesmarkedWindows7Launch_DA27/_DSC0138_4.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="_DSC0138" border="0" alt="_DSC0138" src="http://blogs.msdn.com/blogfiles/ssehgal/WindowsLiveWriter/7000DominoesmarkedWindows7Launch_DA27/_DSC0138_thumb_1.jpg" width="543" height="361" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;a href="http://blogs.msdn.com/blogfiles/ssehgal/WindowsLiveWriter/7000DominoesmarkedWindows7Launch_DA27/_DSC0180_4.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="_DSC0180" border="0" alt="_DSC0180" src="http://blogs.msdn.com/blogfiles/ssehgal/WindowsLiveWriter/7000DominoesmarkedWindows7Launch_DA27/_DSC0180_thumb_1.jpg" width="550" height="368" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;a href="http://blogs.msdn.com/blogfiles/ssehgal/WindowsLiveWriter/7000DominoesmarkedWindows7Launch_DA27/100_0158_1.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="100_0158" border="0" alt="100_0158" src="http://blogs.msdn.com/blogfiles/ssehgal/WindowsLiveWriter/7000DominoesmarkedWindows7Launch_DA27/100_0158_thumb_1.jpg" width="558" height="420" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt; -- &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9914667" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ssehgal/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/windows/default.aspx">windows</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/launch/default.aspx">launch</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/hyderabad/default.aspx">hyderabad</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/windows7/default.aspx">windows7</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/dominoes/default.aspx">dominoes</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/domino/default.aspx">domino</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/dominos/default.aspx">dominos</category></item><item><title>Virtual TechDays is back</title><link>http://blogs.msdn.com/ssehgal/archive/2009/08/20/virtual-techdays-is-back.aspx</link><pubDate>Thu, 20 Aug 2009 21:15:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9877332</guid><dc:creator>ssehgal</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/ssehgal/comments/9877332.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ssehgal/commentrss.aspx?PostID=9877332</wfw:commentRss><description>&lt;p&gt;Microsoft Virtual TechDays is back – don’t miss on this opportunity to get trained on the latest Microsoft technologies. You have the opportunity to learn and explore how Microsoft products and tools can help you quickly address your most time-consuming development challenges. Join fellow developers, architects, IT Professionals, designers and project managers at this online event to interact with the best-in-class technologists attending the event.&lt;/p&gt;  &lt;p&gt;Agenda for the third and last day (21 August 2009) can be found at &lt;a title="http://www.virtualtechdays.com/agenda_architects.aspx" href="http://www.virtualtechdays.com/agenda_architects.aspx"&gt;http://www.virtualtechdays.com/agenda_architects.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.virtualtechdays.com/#"&gt;&lt;strong&gt;&amp;#160;&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9877332" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ssehgal/archive/tags/Virtual+TechDays/default.aspx">Virtual TechDays</category></item><item><title>Register for PDC ‘09</title><link>http://blogs.msdn.com/ssehgal/archive/2009/08/07/register-for-pdc-09.aspx</link><pubDate>Fri, 07 Aug 2009 15:01:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9860130</guid><dc:creator>ssehgal</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/ssehgal/comments/9860130.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ssehgal/commentrss.aspx?PostID=9860130</wfw:commentRss><description>&lt;p&gt;Registrations for Professional Developers Conference (PDC) is now open. Register before September 15 and receive a $500 USD off the regular conference pass price.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.microsoftpdc.com/"&gt;&lt;b&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image002" border="0" alt="clip_image002" src="http://blogs.msdn.com/blogfiles/ssehgal/WindowsLiveWriter/RegisterforPDC09_F67D/clip_image002_e23b2905-0823-4524-a323-4bf98aa3b781.png" width="244" height="64" /&gt;&lt;/b&gt;&lt;/a&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;ABOUT THE PDC&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;The Professional Developers Conference (PDC) is Microsoft’s premier gathering of leading-edge developers and architects.&amp;#160; Attendees come from around the world to learn about the future of Microsoft’s developer platform, exchange ideas with Microsoft technology experts, and network with fellow professionals.&amp;#160; This is the conference you need to attend if you want to stay ahead curve, and get a head start on planning your company’s products and technology investments.&lt;/p&gt;  &lt;p&gt;Register by September 15&lt;sup&gt;th&lt;/sup&gt; and receive $500 off your conference pass – that’s the best discount you’ll get for PDC09.&amp;#160; Visit us online at &lt;a href="http://www.microsoftpdc.com"&gt;www.microsoftpdc.com&lt;/a&gt; and learn more about the future-focused content, industry-leading speakers and other great opportunities you’ll get at PDC09.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;WHAT’S IN STORE FOR YOU AT PDC09&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;KEYNOTES&lt;/p&gt;  &lt;p&gt;PDC is where our biggest names make the biggest announcements. Learn about the future of the Microsoft developer platform straight from the people who make it happen - Microsoft's Chief Software Architect, &lt;a href="http://www.microsoft.com/presspass/exec/ozzie/"&gt;Ray Ozzie&lt;/a&gt;, and the President of Server and Tools, &lt;a href="http://www.microsoft.com/presspass/exec/bobmuglia/"&gt;Bob Muglia&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;SESSIONS &amp;amp; SPEAKERS&lt;/p&gt;  &lt;p&gt;For the first time ever, participate in a perfect storm of brilliance, insight, experience, and vision as we bring together Microsoft’s &lt;a href="http://www.microsoft.com/presspass/exec/techfellow/default.mspx"&gt;Technical Fellows&lt;/a&gt; for the &lt;a href="http://microsoftpdc.com/Sessions/Tags/TechnicalLeaders"&gt;Technical Leaders&lt;/a&gt; series of sessions at PDC09. These are the big brains that develop and drive technical strategies for Microsoft and the industry, and this is a series you won’t want to miss.&amp;#160; Visit the &lt;a href="http://www.microsoftpdc.com/Sessions"&gt;Sessions page&lt;/a&gt; for a full listing of published sessions.&lt;/p&gt;  &lt;p&gt;WORKSHOPS&lt;/p&gt;  &lt;p&gt;Join us a day early (on November 16) for a full day of in-depth content delivered by recognized industry leaders.&amp;#160; Workshops are available exclusively to attendees – they will not be made available online.&amp;#160; Don’t miss out on the opportunity to expand your developer skills at the PDC09 &lt;a href="http://www.microsoftpdc.com/Workshops"&gt;workshops&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;SPECIAL EVENTS&lt;/p&gt;  &lt;p&gt;Not only will you get great content and speakers, you’ll also get early access to the technology and opportunities to meet one-on-one with Microsoft developer technology experts and fellow professions at our special events.&amp;#160; Visit the &lt;a href="http://microsoftpdc.com/SpecialEvents"&gt;Special Events&lt;/a&gt; page for more information.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9860130" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ssehgal/archive/tags/PDC/default.aspx">PDC</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/Professional+Developers+Conference/default.aspx">Professional Developers Conference</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/Ray+Ozzie/default.aspx">Ray Ozzie</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/discount/default.aspx">discount</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/Bob+Muglia/default.aspx">Bob Muglia</category></item><item><title>Pay your tributes to the King of Pop</title><link>http://blogs.msdn.com/ssehgal/archive/2009/07/07/pay-your-tributes-to-the-king-of-pop.aspx</link><pubDate>Tue, 07 Jul 2009 17:02:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9822583</guid><dc:creator>ssehgal</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/ssehgal/comments/9822583.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ssehgal/commentrss.aspx?PostID=9822583</wfw:commentRss><description>&lt;p&gt;Pay your tribute to Michael Jackson and watch his memorial live from the Staples Center in Los Angeles on July 7, 2009 10 AM PT, 1 PM ET at &lt;a href="http://inmusic.ca/news_and_features/Michael_Jackson"&gt;http://inmusic.ca/news_and_features/Michael_Jackson&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;IIS Smooth Streaming and Microsoft Silverlight will be working behind the scene to bring you this broadcast to you in HD.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9822583" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ssehgal/archive/tags/Michael+Jackson/default.aspx">Michael Jackson</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/Microsoft+Silverlight/default.aspx">Microsoft Silverlight</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/IIS+Smooth+Streaming/default.aspx">IIS Smooth Streaming</category></item><item><title>India Union Budget 2009 live on net, thanks to Silverlight</title><link>http://blogs.msdn.com/ssehgal/archive/2009/07/05/india-union-budget-2009-live-on-net-thanks-to-silverlight.aspx</link><pubDate>Sun, 05 Jul 2009 21:49:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9818119</guid><dc:creator>ssehgal</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/ssehgal/comments/9818119.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ssehgal/commentrss.aspx?PostID=9818119</wfw:commentRss><description>&lt;P&gt;You don't need to worry if you want to catch up budget session live and don't have a Television set near you. Just log onto &lt;A href="http://budgetlive.economictimes.com/"&gt;http://budgetlive.economictimes.com/&lt;/A&gt;&amp;nbsp;on 6 July 2009, 10 AM IST, where Microsoft Silverlight will be used to deliver streaming Live Budget session.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9818119" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ssehgal/archive/tags/Union+Budget/default.aspx">Union Budget</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/India/default.aspx">India</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/streaming/default.aspx">streaming</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/Silverlight/default.aspx">Silverlight</category></item><item><title>Running IIS6 App Pools under a Domain account Identity</title><link>http://blogs.msdn.com/ssehgal/archive/2009/06/23/running-iis6-app-pools-under-a-domain-account-identity.aspx</link><pubDate>Tue, 23 Jun 2009 18:40:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9799640</guid><dc:creator>ssehgal</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/ssehgal/comments/9799640.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ssehgal/commentrss.aspx?PostID=9799640</wfw:commentRss><description>&lt;p&gt;Recently we changed the Identity of an App Pool in IIS 6, from Network Service to a Domain account. Soon after recycling the App Pool, we started seeing some issues.&lt;/p&gt;  &lt;p&gt;As soon as we started the App Pool, the following warning was logged in the System section of Event Viewer:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;table border="0" cellspacing="0" cellpadding="1" width="640"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td bgcolor="#efefef" valign="top" width="100%"&gt;         &lt;p&gt;Event Type:&amp;#160;&amp;#160;&amp;#160; Warning            &lt;br /&gt;Event Source:&amp;#160;&amp;#160;&amp;#160; W3SVC             &lt;br /&gt;Event Category:&amp;#160;&amp;#160;&amp;#160; None             &lt;br /&gt;Event ID:&amp;#160;&amp;#160;&amp;#160; 1021             &lt;br /&gt;Date:&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 6/22/2009             &lt;br /&gt;Time:&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 11:16:26 PM             &lt;br /&gt;User:&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; N/A             &lt;br /&gt;Computer:&amp;#160;&amp;#160;&amp;#160; &amp;lt;ComputerName&amp;gt;             &lt;br /&gt;Description:             &lt;br /&gt;The identity of application pool, 'MyAppPool' is invalid.&amp;#160; If it remains invalid when the first request for the application pool is processed, the application pool will be disabled.&amp;#160; The data field contains the error number. &lt;/p&gt;          &lt;p&gt;For more information, see Help and Support Center at &lt;a href="http://go.microsoft.com/fwlink/events.asp"&gt;http://go.microsoft.com/fwlink/events.asp&lt;/a&gt;.             &lt;br /&gt;Data:             &lt;br /&gt;0000: 69 05 07 80&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; i..&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;And when the Web Application which was using this App Pool was accessed, the App Pool stopped, logging these warnings/errors in Event Viewer:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;table border="0" cellspacing="0" cellpadding="1" width="640"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td bgcolor="#efefef" valign="top" width="100%"&gt;         &lt;p&gt;Event Type:&amp;#160;&amp;#160;&amp;#160; Warning            &lt;br /&gt;Event Source:&amp;#160;&amp;#160;&amp;#160; W3SVC             &lt;br /&gt;Event Category:&amp;#160;&amp;#160;&amp;#160; None             &lt;br /&gt;Event ID:&amp;#160;&amp;#160;&amp;#160; 1057             &lt;br /&gt;Date:&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 6/22/2009             &lt;br /&gt;Time:&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 11:16:39 PM             &lt;br /&gt;User:&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; N/A             &lt;br /&gt;Computer:&amp;#160;&amp;#160;&amp;#160; &amp;lt;ComputerName&amp;gt;             &lt;br /&gt;Description:             &lt;br /&gt;The identity of application pool 'MyAppPool' is invalid, so the World Wide Web Publishing Service can not create a worker process to serve the application pool.&amp;#160; Therefore, the application pool has been disabled. &lt;/p&gt;          &lt;p&gt;For more information, see Help and Support Center at &lt;a href="http://go.microsoft.com/fwlink/events.asp"&gt;http://go.microsoft.com/fwlink/events.asp&lt;/a&gt;.&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;table border="0" cellspacing="0" cellpadding="1" width="640"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td bgcolor="#efefef" valign="top" width="100%"&gt;         &lt;p&gt;Event Type:&amp;#160;&amp;#160;&amp;#160; Error            &lt;br /&gt;Event Source:&amp;#160;&amp;#160;&amp;#160; W3SVC             &lt;br /&gt;Event Category:&amp;#160;&amp;#160;&amp;#160; None             &lt;br /&gt;Event ID:&amp;#160;&amp;#160;&amp;#160; 1059             &lt;br /&gt;Date:&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 6/22/2009             &lt;br /&gt;Time:&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 11:16:39 PM             &lt;br /&gt;User:&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; N/A             &lt;br /&gt;Computer:&amp;#160;&amp;#160;&amp;#160; &amp;lt;ComputerName&amp;gt;             &lt;br /&gt;Description:             &lt;br /&gt;A failure was encountered while launching the process serving application pool 'MyAppPool'. The application pool has been disabled. &lt;/p&gt;          &lt;p&gt;For more information, see Help and Support Center at &lt;a href="http://go.microsoft.com/fwlink/events.asp"&gt;http://go.microsoft.com/fwlink/events.asp&lt;/a&gt;. &lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;So, here’s what you need to do if you are switching the identity of IIS App Pool to run under a Domain Account, Unless you love seeing the errors above :)&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;1. Add the Domain Account to the &lt;strong&gt;IIS_WPG&lt;/strong&gt; group on the Machine running IIS.    &lt;br /&gt;(This group is the worker Process group which contains the Accounts, allowed to run the IIS worker process.)&lt;/p&gt;  &lt;p&gt;2. Goto &lt;strong&gt;Start&lt;/strong&gt;&amp;gt; &lt;strong&gt;Run&lt;/strong&gt; and type &lt;strong&gt;secpol.msc&lt;/strong&gt; . Hit OK. The &lt;strong&gt;Local Security Settings&lt;/strong&gt; console will open up. Under &lt;strong&gt;Security Settings&lt;/strong&gt;, expand &lt;strong&gt;Local Policies&lt;/strong&gt; and Click &lt;strong&gt;User Rights Assignment&lt;/strong&gt;. Double click &lt;strong&gt;Log on as a service&lt;/strong&gt; in the right pane. Add the domain account if not already listed. Click &lt;strong&gt;OK&lt;/strong&gt; and exit the console.     &lt;br /&gt;(It enabled the Domain account to register a process as a service.)&lt;/p&gt;  &lt;p&gt;You are all set to run your web application now :)&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9799640" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ssehgal/archive/tags/IIS_5F00_WPG/default.aspx">IIS_WPG</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/App+Pool+Identity/default.aspx">App Pool Identity</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/IIS/default.aspx">IIS</category></item><item><title>Securing the Microsoft Cloud Infrastructure &amp;amp; Microsoft Online Services</title><link>http://blogs.msdn.com/ssehgal/archive/2009/06/17/securing-the-microsoft-cloud-infrastructure-microsoft-online-services.aspx</link><pubDate>Wed, 17 Jun 2009 18:03:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9769588</guid><dc:creator>ssehgal</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/ssehgal/comments/9769588.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ssehgal/commentrss.aspx?PostID=9769588</wfw:commentRss><description>&lt;p&gt;Microsoft Global Foundation Services and BPOS team has provided the following resources to assist in concerns regarding the security, Privacy, reliability and operational controls for companies considering moving IT operations to Microsoft cloud.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;White Paper - &lt;a href="http://www.globalfoundationservices.com/security/index.html"&gt;Securing Microsoft’s Cloud Infrastructure&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;White Paper - &lt;a href="http://technet.microsoft.com/en-us/library/cc742708.aspx"&gt;Security in Microsoft Business Productivity Online Suite&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;GFS Security Team Blog on &lt;a href="http://blogs.technet.com/gfs/"&gt;Securing Microsoft’s Cloud Infrastructure&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9769588" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ssehgal/archive/tags/Microsoft+Cloud/default.aspx">Microsoft Cloud</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/Security/default.aspx">Security</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/GFS/default.aspx">GFS</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/securing/default.aspx">securing</category></item><item><title>Are you ready for Server Quest II ?</title><link>http://blogs.msdn.com/ssehgal/archive/2009/06/15/are-you-ready-for-server-quest-ii.aspx</link><pubDate>Mon, 15 Jun 2009 17:49:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9753444</guid><dc:creator>ssehgal</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/ssehgal/comments/9753444.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ssehgal/commentrss.aspx?PostID=9753444</wfw:commentRss><description>&lt;p&gt;The company’s&amp;#160; resident IT professional extraordinaire has just returned from a much-deserved vacation but, in a temporary spell of relaxed judgment, has jeopardized their reputation with a poorly placed email and forwarded personal holiday snaps to the entire staff. Now they have to excavate through the email chain to find the offending photos – all while keeping the office online.   &lt;br /&gt;In Server Quest II, the sequel to last year’s pixellated adventure, players must hone their technical prowess in order to prove once and for all why the tech pros take the cake.&amp;#160; From software support to sidequests, players will get behind the curtain and live the life of a server genius fighting for respect.”&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.microsoft.com/click/serverquest"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="clip_image002" border="0" alt="clip_image002" src="http://blogs.msdn.com/blogfiles/ssehgal/WindowsLiveWriter/AreyoureadyforServerQuestII_11DB8/clip_image002_2e151831-4685-4b1a-8719-2cc540fc62ca.jpg" width="644" height="86" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9753444" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ssehgal/archive/tags/Server/default.aspx">Server</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/Quest/default.aspx">Quest</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/Challenge/default.aspx">Challenge</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/Geek/default.aspx">Geek</category></item><item><title>Azure “How Do I” videos</title><link>http://blogs.msdn.com/ssehgal/archive/2009/06/15/azure-how-do-i-videos.aspx</link><pubDate>Mon, 15 Jun 2009 17:12:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9753321</guid><dc:creator>ssehgal</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/ssehgal/comments/9753321.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ssehgal/commentrss.aspx?PostID=9753321</wfw:commentRss><description>&lt;p&gt;Learn more about Azure with free How Do I videos at &lt;a title="http://msdn.microsoft.com/en-us/azure/dd439432.aspx" href="http://msdn.microsoft.com/en-us/azure/dd439432.aspx"&gt;http://msdn.microsoft.com/en-us/azure/dd439432.aspx&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;4 new videos added recently:&lt;/p&gt;  &lt;table border="0" cellspacing="0" cellpadding="1" width="637"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="216"&gt;&lt;i&gt;&lt;strong&gt;Solution&lt;/strong&gt;&lt;/i&gt;&lt;/td&gt;        &lt;td valign="top" width="210"&gt;&lt;strong&gt;&lt;i&gt;Topic: &lt;/i&gt;How Do I…&lt;/strong&gt;&lt;/td&gt;        &lt;td valign="top" width="209"&gt;&lt;i&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/i&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="219"&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ssehgal/WindowsLiveWriter/AzurehowDoIvideos_11522/clip_image002%5B4%5D.gif"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image002[4]" border="0" alt="clip_image002[4]" src="http://blogs.msdn.com/blogfiles/ssehgal/WindowsLiveWriter/AzurehowDoIvideos_11522/clip_image002%5B4%5D_thumb.gif" width="201" height="37" /&gt;&lt;/a&gt;&lt;/td&gt;        &lt;td valign="top" width="209"&gt;&lt;i&gt;&lt;a href="http://msdn.microsoft.com/en-us/azure/dd875664.aspx"&gt;Leverage Concurrency in Windows Azure Table Storage?&lt;/a&gt;&lt;/i&gt;&lt;/td&gt;        &lt;td valign="top" width="208"&gt;Windows Azure table storage is designed to support many users at the same time. In this session, you’ll learn how Windows Azure table storage supports concurrency, and you’ll learn a few strategies to help you deal with any concurrency violations.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="222"&gt;&amp;#160;&lt;/td&gt;        &lt;td valign="top" width="207"&gt;&lt;i&gt;&lt;a href="http://msdn.microsoft.com/en-us/azure/dd875665.aspx"&gt;Use Paging in Windows Azure Tables?&lt;/a&gt;&lt;/i&gt;&lt;/td&gt;        &lt;td valign="top" width="206"&gt;To improve application usability, many applications need to support viewing data page-by-page. In this screencast, you'll learn how Windows Azure table storage provides a built-in mechanism that allows you to efficiently page through query results.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="222"&gt;&amp;#160;&lt;/td&gt;        &lt;td valign="top" width="207"&gt;&amp;#160;&lt;/td&gt;        &lt;td valign="top" width="206"&gt;&amp;#160;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="224"&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ssehgal/WindowsLiveWriter/AzurehowDoIvideos_11522/clip_image002%5B6%5D.gif"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image002[6]" border="0" alt="clip_image002[6]" src="http://blogs.msdn.com/blogfiles/ssehgal/WindowsLiveWriter/AzurehowDoIvideos_11522/clip_image002%5B6%5D_thumb.gif" width="165" height="42" /&gt;&lt;/a&gt;&lt;/td&gt;        &lt;td valign="top" width="209"&gt;&lt;i&gt;&lt;a href="http://msdn.microsoft.com/en-us/azure/dd875667.aspx"&gt;Sync Between Devices and the Cloud with FeedSync?&lt;/a&gt;&lt;/i&gt;&lt;/td&gt;        &lt;td valign="top" width="206"&gt;Syncing the cloud and a growing world of devices is a fundamental need in today’s world. In this video, you will learn how to use FeedSync feeds to synchronize Live Framework data between a device and the cloud.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="226"&gt;&amp;#160;&lt;/td&gt;        &lt;td valign="top" width="206"&gt;&lt;i&gt;&lt;a href="http://msdn.microsoft.com/en-us/azure/dd891045.aspx"&gt;Get Started with the Messenger Web Toolkit?&lt;/a&gt;&lt;/i&gt;&lt;/td&gt;        &lt;td valign="top" width="206"&gt;Making your application sociable is easy. In this screencast, Chris Parker uses simple code to add instant messaging to his Web site. In minutes he connects his Web site to 320 million Instant Messenger (IM) users on PCs, Macs, mobile devices and Xbox 360. These efforts can help bring new users to his application and retain them for a longer period of time through the use of cool features like chat, presence, contacts and profile information.&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9753321" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ssehgal/archive/tags/Free/default.aspx">Free</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/Azure/default.aspx">Azure</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/videos/default.aspx">videos</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/learn/default.aspx">learn</category></item><item><title>Springboard Virtual Roundtable - Windows 7 Application Compatibility, Part 1</title><link>http://blogs.msdn.com/ssehgal/archive/2009/06/04/springboard-virtual-roundtable-windows-7-application-compatibility-part-1.aspx</link><pubDate>Thu, 04 Jun 2009 21:31:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9700084</guid><dc:creator>ssehgal</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/ssehgal/comments/9700084.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ssehgal/commentrss.aspx?PostID=9700084</wfw:commentRss><description>&lt;p&gt;Mark Russinovich will host a virtual roundtable for IT pros worldwide to discuss Windows 7 Application Compatibility on Thursday, June 18.&lt;/p&gt;  &lt;p&gt;This is a chance for IT pros to learn all about the Windows 7 Application Compatibility and answer any deployment and management questions that they may have. As part of the “virtual” experience, IT pros will be able to submit their questions about Windows 7 Application Compatibility to the panel live during the event—or submit questions in advance to &lt;a href="mailto:vrtable@microsoft.com"&gt;vrtable@microsoft.com&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;Join Mark on June 18 2009,&amp;#160; 11 AM Pacific Time at &lt;a href="https://ms.istreamplanet.com/springboard"&gt;https://ms.istreamplanet.com/springboard&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;table border="1" cellspacing="0" cellpadding="1" width="640"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="640"&gt;         &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ssehgal/WindowsLiveWriter/SpringboardVirtualRoundtableWindows7Appl_56/clip_image002_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="clip_image002" border="0" alt="clip_image002" src="http://blogs.msdn.com/blogfiles/ssehgal/WindowsLiveWriter/SpringboardVirtualRoundtableWindows7Appl_56/clip_image002_thumb.jpg" width="642" height="202" /&gt;&lt;/a&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="640"&gt;         &lt;table border="0" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;             &lt;tr&gt;               &lt;td&gt;&amp;#160;&lt;/td&gt;                &lt;td&gt;                 &lt;p&gt;&lt;b&gt;Springboard Series Virtual Roundtable &lt;/b&gt;&lt;/p&gt;                  &lt;p&gt;&lt;b&gt;Windows 7 Application Compatibility: Your Questions Answered (Part 1)&lt;/b&gt;&lt;/p&gt;                  &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;                  &lt;p&gt;&lt;b&gt;Date: &lt;/b&gt;Thursday, June 18&lt;/p&gt;                  &lt;p&gt;&lt;b&gt;Time: &lt;/b&gt;11:00am Pacific Time&lt;/p&gt;                  &lt;p&gt;&lt;a href="https://ms.istreamplanet.com/springboard"&gt;https://ms.istreamplanet.com/springboard&lt;/a&gt;&lt;/p&gt;                  &lt;p&gt;Windows 7, is approaching fast and from the application standpoint is very similar to Windows Vista. We’re going to examine Windows 7 application compatibility not only from the perspective of moving from Windows Vista, but also for those coming from Windows XP. Join us to discuss the most common challenges around application compatibility when coming from a legacy operating system, why changes were made along the way, compatibility technologies inside the OS and methods for getting incompatible applications to run on Windows 7. Along the way we share tips and tricks, demonstrate free tools to analyze and fix applications and answer your specific questions about application compatibility live. &lt;/p&gt;                  &lt;p&gt;In Part 2 of this Virtual Round Table discussion (planned for later this Summer/Fall), we’ll discuss the options and approaches for using virtualization tools In depth to address application incompatibilities – including presentation virtualization, desktop virtualization and application virtualization. We’ll be sending out more details and posting information to &lt;a href="http://www.microsoft.com/springboard"&gt;www.microsoft.com/springboard&lt;/a&gt; for part 2 as the dates are finalized.&lt;/p&gt;                  &lt;p&gt;As part of the “virtual” experience, you may submit your questions about Windows 7 Application Compatibility to the panel live during the event—or submit questions in advance to &lt;a href="mailto:vrtable@microsoft.com"&gt;vrtable@microsoft.com&lt;/a&gt;.&lt;/p&gt;                  &lt;p&gt;&lt;b&gt;Springboard Series: The resource for Windows desktop IT professionals&lt;/b&gt;&lt;b&gt; &lt;/b&gt;&lt;/p&gt;               &lt;/td&gt;                &lt;td&gt;&amp;#160;&lt;/td&gt;             &lt;/tr&gt;              &lt;tr&gt;               &lt;td width="37"&gt;                 &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ssehgal/WindowsLiveWriter/SpringboardVirtualRoundtableWindows7Appl_56/clip_image004_3.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image004" border="0" alt="clip_image004" src="http://blogs.msdn.com/blogfiles/ssehgal/WindowsLiveWriter/SpringboardVirtualRoundtableWindows7Appl_56/clip_image004_thumb.jpg" width="24" height="5" /&gt;&lt;/a&gt;&lt;/p&gt;               &lt;/td&gt;                &lt;td width="577"&gt;                 &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ssehgal/WindowsLiveWriter/SpringboardVirtualRoundtableWindows7Appl_56/clip_image006_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image006" border="0" alt="clip_image006" src="http://blogs.msdn.com/blogfiles/ssehgal/WindowsLiveWriter/SpringboardVirtualRoundtableWindows7Appl_56/clip_image006_thumb.jpg" width="70" height="5" /&gt;&lt;/a&gt;&lt;/p&gt;               &lt;/td&gt;                &lt;td width="37"&gt;                 &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ssehgal/WindowsLiveWriter/SpringboardVirtualRoundtableWindows7Appl_56/clip_image004%5B1%5D.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image004[1]" border="0" alt="clip_image004[1]" src="http://blogs.msdn.com/blogfiles/ssehgal/WindowsLiveWriter/SpringboardVirtualRoundtableWindows7Appl_56/clip_image004%5B1%5D_thumb.jpg" width="24" height="5" /&gt;&lt;/a&gt;&lt;/p&gt;               &lt;/td&gt;             &lt;/tr&gt;           &lt;/tbody&gt;&lt;/table&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="640"&gt;         &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ssehgal/WindowsLiveWriter/SpringboardVirtualRoundtableWindows7Appl_56/clip_image008_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="clip_image008" border="0" alt="clip_image008" src="http://blogs.msdn.com/blogfiles/ssehgal/WindowsLiveWriter/SpringboardVirtualRoundtableWindows7Appl_56/clip_image008_thumb.jpg" width="642" height="61" /&gt;&lt;/a&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9700084" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ssehgal/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/Mark/default.aspx">Mark</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/Russinovich/default.aspx">Russinovich</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/Springboard/default.aspx">Springboard</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/Virtual+roundtable/default.aspx">Virtual roundtable</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/Compatibility/default.aspx">Compatibility</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/Application/default.aspx">Application</category></item><item><title>Configuring Windows services using Command Prompt</title><link>http://blogs.msdn.com/ssehgal/archive/2009/06/01/configuring-windows-services-using-command-prompt.aspx</link><pubDate>Mon, 01 Jun 2009 16:44:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9677773</guid><dc:creator>ssehgal</dc:creator><slash:comments>10</slash:comments><comments>http://blogs.msdn.com/ssehgal/comments/9677773.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ssehgal/commentrss.aspx?PostID=9677773</wfw:commentRss><description>&lt;p&gt;Configuring the properties of a Windows Service using command prompt and scripting it in a batch file is really simple and can save you from performing the same manual configuration again and again.&lt;/p&gt;  &lt;p&gt;The sc utility comes handy to achieve this. &lt;/p&gt;  &lt;p&gt;In the example below, we are going to configure a windows service to:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Set the startup type as automatic. &lt;/li&gt;    &lt;li&gt;Run the service under a particular account &lt;/li&gt;    &lt;li&gt;Set the failure actions for the service and set the reset period. &lt;/li&gt;    &lt;li&gt;Define dependencies. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;To give a more clear understanding, screenshots of the service properties UI is attached along with the scripts to set the configurations.&lt;/p&gt;  &lt;p&gt;1. Set the startup type as automatic.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ssehgal/WindowsLiveWriter/ConfiguringWindowsservicesusingCommandPr_1070D/image_14.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/ssehgal/WindowsLiveWriter/ConfiguringWindowsservicesusingCommandPr_1070D/image_thumb_6.png" width="330" height="391" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;table border="0" cellspacing="0" cellpadding="2" width="100%"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td bgcolor="#efefef" valign="top" width="100%"&gt; sc config &amp;quot;Service1&amp;quot;&amp;#160; start= auto&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;Note here that although the Display name of the Service is myfirstservice, The actual Service name is Service1. We need to use the actual service name in the scripts to control the service properties.&lt;/p&gt;  &lt;p&gt;2. Run the service under a particular account&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ssehgal/WindowsLiveWriter/ConfiguringWindowsservicesusingCommandPr_1070D/image_8.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/ssehgal/WindowsLiveWriter/ConfiguringWindowsservicesusingCommandPr_1070D/image_thumb_3.png" width="325" height="372" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;table border="0" cellspacing="0" cellpadding="2" width="100%"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td bgcolor="#efefef" valign="top" width="100%"&gt; sc config &amp;quot;Service1&amp;quot; obj= mydomain\sidharth password= MyPassword&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;3.Set the failure actions for the service and set the reset period.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ssehgal/WindowsLiveWriter/ConfiguringWindowsservicesusingCommandPr_1070D/image_10.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/ssehgal/WindowsLiveWriter/ConfiguringWindowsservicesusingCommandPr_1070D/image_thumb_4.png" width="335" height="382" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;table border="0" cellspacing="0" cellpadding="2" width="100%"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td bgcolor="#efefef" valign="top" width="100%"&gt; sc failure &amp;quot;Service1&amp;quot;&amp;#160; actions= restart/180000/restart/180000/&amp;quot;&amp;quot;/180000 reset= 86400&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt; The restart service times are in milliseconds and the reset fail count time is in seconds.&lt;/p&gt;  &lt;p&gt;4. Define dependencies.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/ssehgal/WindowsLiveWriter/ConfiguringWindowsservicesusingCommandPr_1070D/image_12.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/ssehgal/WindowsLiveWriter/ConfiguringWindowsservicesusingCommandPr_1070D/image_thumb_5.png" width="343" height="389" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Our service depends on the SQL Server service, whose Actual Service name is MSSQLServer, To set this dependency, use the following command.&lt;/p&gt;  &lt;table border="0" cellspacing="0" cellpadding="2" width="100%"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td bgcolor="#efefef" valign="top" width="100%"&gt; sc config &amp;quot;Service1&amp;quot;&amp;#160; depend= &amp;quot;MSSQLServer&amp;quot;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt; Finally, to start the server use &lt;/p&gt;  &lt;table border="0" cellspacing="0" cellpadding="2" width="100%"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td bgcolor="#efefef" valign="top" width="100%"&gt; net start Service1&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt; We can also club all the command and save it as a batch file, it will look like this: &lt;/p&gt;  &lt;table border="0" cellspacing="0" cellpadding="2" width="100%"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td bgcolor="#efefef" valign="top" width="100%"&gt;         &lt;p&gt;sc config &amp;quot;Service1&amp;quot;&amp;#160; start= auto            &lt;br /&gt;sc config &amp;quot;Service1&amp;quot; obj= mydomain\sidharth password= MyPassword             &lt;br /&gt;sc failure &amp;quot;Service1&amp;quot;&amp;#160; actions= restart/180000/restart/180000/&amp;quot;&amp;quot;/180000 reset= 86400             &lt;br /&gt;sc config &amp;quot;Service1&amp;quot;&amp;#160; depend= &amp;quot;MSSQLServer&amp;quot;             &lt;br /&gt;net start Service1 &lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9677773" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ssehgal/archive/tags/Script/default.aspx">Script</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/file/default.aspx">file</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/configure/default.aspx">configure</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/batch/default.aspx">batch</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/properties/default.aspx">properties</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/command/default.aspx">command</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/prompt/default.aspx">prompt</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/DOS/default.aspx">DOS</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/windows/default.aspx">windows</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/service/default.aspx">service</category></item><item><title>Bing webcast on June 1 @10 PM pacific time</title><link>http://blogs.msdn.com/ssehgal/archive/2009/06/01/bing-webcast-on-june-1-10-pm-pacific-time.aspx</link><pubDate>Mon, 01 Jun 2009 11:53:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9675754</guid><dc:creator>ssehgal</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/ssehgal/comments/9675754.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ssehgal/commentrss.aspx?PostID=9675754</wfw:commentRss><description>&lt;p&gt;[Taken from &lt;a title="http://blogs.msdn.com/livesearch/archive/2009/05/29/join-us-june-1st-10am-pt-for-the-bing-webcast.aspx" href="http://blogs.msdn.com/livesearch/archive/2009/05/29/join-us-june-1st-10am-pt-for-the-bing-webcast.aspx"&gt;http://blogs.msdn.com/livesearch/archive/2009/05/29/join-us-june-1st-10am-pt-for-the-bing-webcast.aspx&lt;/a&gt;]&lt;/p&gt;  &lt;p&gt;Want more Bing?&amp;#160; How about an interactive &lt;b&gt;Webcast&lt;/b&gt; where we’ll walk you through all the cool features in our new decision engine.&amp;#160; Sure you could read the Product Guide (located &lt;a href="http://www.discoverbing.com/behindbing/productGuide.aspx"&gt;here&lt;/a&gt;)&lt;b&gt; &lt;/b&gt;but that would require, you know, reading.&amp;#160; Better just to watch.&amp;#160; &lt;/p&gt;  &lt;p&gt;Plus, while you can talk to the Product Guide it likely won’t respond (and if it does let us know - I thought we fixed that bug).&amp;#160;&amp;#160; Our webcast will let you interact with the presenter by asking questions throughout the session! &lt;/p&gt;  &lt;p&gt;How do you join in the fun?&amp;#160; Three easy steps:&lt;/p&gt;  &lt;p&gt;1) Set your alarm clocks for &lt;b&gt;10AM Pacific Daylight Time, Monday, June 1.&amp;#160; &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;2) &lt;b&gt;Point your browser to&amp;#160; &lt;/b&gt;&lt;a href="http://ms.istreamplanet.com/search"&gt;http://ms.istreamplanet.com/search&lt;/a&gt; (I’d do this before 10AM just to make sure you’ve got what you need to watch the stream)&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;3) &lt;b&gt;Sit quietly and watch&lt;/b&gt; the ‘cast OR engage by typing questions in the player.&lt;/p&gt;  &lt;p&gt;That’s it!&amp;#160; Tell your friends.&amp;#160; Tell your neighbors.&amp;#160; Tell people you don’t even know.&amp;#160; Post it on &lt;a href="http://www.facebook.com/event.php?eid=194705425281&amp;amp;ref=mf"&gt;Facebook&lt;/a&gt;. The &lt;b&gt;Bing&lt;/b&gt; &lt;b&gt;Webcast&lt;/b&gt;– no prompters, no scripts, 100% danger.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9675754" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ssehgal/archive/tags/webcast/default.aspx">webcast</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/search/default.aspx">search</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/decision/default.aspx">decision</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/decisionsearch/default.aspx">decisionsearch</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/engine/default.aspx">engine</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/Bing/default.aspx">Bing</category></item><item><title>Automating config file changes : Part 4 – Adding a new element to an XML file</title><link>http://blogs.msdn.com/ssehgal/archive/2009/05/30/automating-config-file-changes-part-4-adding-a-new-element-to-an-xml-file.aspx</link><pubDate>Sat, 30 May 2009 17:11:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9665574</guid><dc:creator>ssehgal</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/ssehgal/comments/9665574.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ssehgal/commentrss.aspx?PostID=9665574</wfw:commentRss><description>&lt;p&gt;After updating and deleting element from an XML config file, lets see how to add new elements at the desired position in an XML file.&lt;/p&gt;  &lt;p&gt;We will again take the same web.config file , which we took in the first example and save it at C:\MyApplication&lt;/p&gt;  &lt;table border="0" cellspacing="0" cellpadding="2" width="100%"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td bgcolor="#efefef" valign="top" width="100%"&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;          &lt;br /&gt;&amp;lt;configuration&amp;gt;           &lt;br /&gt;&amp;#160; &amp;lt;system.web&amp;gt;           &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;customErrors mode=&amp;quot;On&amp;quot; defaultRedirect=&amp;quot;Error.htm&amp;quot;&amp;gt;           &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;error statusCode=&amp;quot;404&amp;quot; redirect=&amp;quot;http://myAppDevWeb/404.aspx&amp;quot;/&amp;gt;           &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/customErrors&amp;gt;           &lt;br /&gt;&amp;#160; &amp;lt;/system.web&amp;gt;           &lt;br /&gt;&amp;#160; &amp;lt;appSettings&amp;gt;           &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;add key=&amp;quot;DBServer&amp;quot; value=&amp;quot;myAppDevDB&amp;quot;/&amp;gt;           &lt;br /&gt;&amp;#160; &amp;lt;/appSettings&amp;gt;           &lt;br /&gt;&amp;lt;/configuration&amp;gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;We want to add a new element &amp;lt;add key=&amp;quot;ReportingServer&amp;quot; value=&amp;quot;myAppDevRpt&amp;quot;/&amp;gt; under the appsettings section if it does not exist. If it exists we will set the value as myAppDevRpt&lt;/p&gt;  &lt;p&gt;The resultant file should look like this&lt;/p&gt;  &lt;table border="0" cellspacing="0" cellpadding="2" width="100%"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td bgcolor="#efefef" valign="top" width="100%"&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;          &lt;br /&gt;&amp;lt;configuration&amp;gt;           &lt;br /&gt;&amp;#160; &amp;lt;system.web&amp;gt;           &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;customErrors mode=&amp;quot;On&amp;quot; defaultRedirect=&amp;quot;Error.htm&amp;quot;&amp;gt;           &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;error statusCode=&amp;quot;404&amp;quot; redirect=&amp;quot;http://myAppDevWeb/404.aspx&amp;quot;/&amp;gt;           &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/customErrors&amp;gt;           &lt;br /&gt;&amp;#160; &amp;lt;/system.web&amp;gt;           &lt;br /&gt;&amp;#160; &amp;lt;appSettings&amp;gt;           &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;add key=&amp;quot;DBServer&amp;quot; value=&amp;quot;myAppDevDB&amp;quot;/&amp;gt;           &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;add key=”ReportingServer&amp;quot; value=&amp;quot;myAppDevRpt&amp;quot;/&amp;gt;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160; &amp;lt;/appSettings&amp;gt;           &lt;br /&gt;&amp;lt;/configuration&amp;gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Lets have a look at the script.&amp;#160; We will name this script addElement.ps1 and store it in C:\Scripts&lt;/p&gt;  &lt;table border="0" cellspacing="0" cellpadding="2" width="100%"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td bgcolor="#efefef" valign="top" width="100%"&gt;         &lt;p&gt;# Parameter declaration which will be passed to the script during execution &lt;/p&gt;          &lt;p&gt;Param (            &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; $webConfigPath&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; #Path to the web.config file. Make sure file is not read-only             &lt;br /&gt;)             &lt;br /&gt;            &lt;br /&gt;$RptKeyFound=0;&lt;/p&gt;          &lt;p&gt;$xml = [xml](get-content $webConfigPath);&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; # Create the XML Object and open the web.config file            &lt;br /&gt;$root = $xml.get_DocumentElement();&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; # Get the root element of the file&lt;/p&gt;          &lt;p&gt;foreach( $item in $root.appSettings.add)&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; # loop through the child items in appsettings            &lt;br /&gt;{             &lt;br /&gt;&amp;#160; if($item.key –eq “ReportingServer”)&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; # If the desired element already exists             &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {             &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; $item.value = “myAppDevRpt”;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; # Update the value attribute             &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; $RptKeyFound=1;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; # Set the found flag             &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }             &lt;br /&gt;}&lt;/p&gt;          &lt;p&gt;if($RptKeyFound -eq 0)&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; # If the desired element does not exist            &lt;br /&gt;{             &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; $newEl=$xml.CreateElement(&amp;quot;add&amp;quot;);&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; # Create a new Element             &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; $nameAtt1=$xml.CreateAttribute(&amp;quot;key&amp;quot;);&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; # Create a new attribute “key”             &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; $nameAtt1.psbase.value=&amp;quot;ReportingServer&amp;quot;;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; # Set the value of “key” attribute             &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; $newEl.SetAttributeNode($nameAtt1);&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; # Attach the “key” attribute             &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; $nameAtt2=$xml.CreateAttribute(&amp;quot;value&amp;quot;);&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; # Create “value” attribute&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; $nameAtt2.psbase.value=&amp;quot;myAppDevRpt&amp;quot;;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; # Set the value of “value” attribute             &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; $newEl.SetAttributeNode($nameAtt2);&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; # Attach the “value” attribute             &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; $xml.configuration[&amp;quot;appSettings&amp;quot;].AppendChild($newEl);&amp;#160;&amp;#160;&amp;#160; # Add the newly created element to the right position &lt;/p&gt;          &lt;p&gt;}&lt;/p&gt;          &lt;p&gt;$xml.Save($webConfigPath)&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; # Save the web.config file&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Run the script&lt;/p&gt;  &lt;p&gt;Open Command Prompt&lt;/p&gt;  &lt;p&gt;c:\&amp;gt;Powershell&lt;/p&gt;  &lt;p&gt;PS C:\&amp;gt; cd scripts&lt;/p&gt;  &lt;p&gt;PS C:\scripts&amp;gt; .\addElement.ps1 “C:\MyApplication\web.config” &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Related Posts:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/ssehgal/archive/2009/04/12/automating-config-file-changes-part-1-installing-microsoft-windows-powershell.aspx"&gt;Automating config file changes : Part 1 – Installing Microsoft Windows Powershell&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/ssehgal/archive/2009/05/28/automating-config-file-changes-part-2-modifying-already-existing-config-keys.aspx"&gt;Automating config file changes : Part 2 – modifying already existing config keys&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/ssehgal/archive/2009/05/29/automating-config-file-changes-part-3-deleting-an-element-from-an-xml-file.aspx"&gt;Automating config file changes : Part 3 – Deleting an element from an XML file&lt;/a&gt;s&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9665574" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ssehgal/archive/tags/files/default.aspx">files</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/config/default.aspx">config</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/update/default.aspx">update</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/web_2E00_config/default.aspx">web.config</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/Powershell/default.aspx">Powershell</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/XML/default.aspx">XML</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/file/default.aspx">file</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/element/default.aspx">element</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/new/default.aspx">new</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/insert/default.aspx">insert</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/modify/default.aspx">modify</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/add/default.aspx">add</category></item><item><title>Automating config file changes : Part 3 – Deleting an element from an XML file</title><link>http://blogs.msdn.com/ssehgal/archive/2009/05/29/automating-config-file-changes-part-3-deleting-an-element-from-an-xml-file.aspx</link><pubDate>Fri, 29 May 2009 13:03:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9652489</guid><dc:creator>ssehgal</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/ssehgal/comments/9652489.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ssehgal/commentrss.aspx?PostID=9652489</wfw:commentRss><description>&lt;p&gt;This post talks about removing an existing XML element from the config file. Consider a scenario where we have the following web.config file saved at location C:\MyApplication&lt;/p&gt;  &lt;table border="0" cellspacing="0" cellpadding="2" width="100%"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td bgcolor="#efefef" valign="top" width="100%"&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;          &lt;br /&gt;&amp;lt;configuration&amp;gt;           &lt;br /&gt;&amp;#160; &lt;font color="#ff0000"&gt;&amp;lt;configSections&amp;gt;            &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;sectionGroup name=&amp;quot;system.web&amp;quot;&amp;gt;             &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;section name=&amp;quot;myConfigSection”/&amp;gt;             &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/sectionGroup&amp;gt;             &lt;br /&gt;&amp;#160; &amp;lt;/configSections&amp;gt;             &lt;br /&gt;&lt;/font&gt;&amp;#160; &amp;lt;system.webServer&amp;gt;           &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;modules&amp;gt;           &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;font color="#ff0000"&gt;&amp;lt;add name=&amp;quot;moduleToRemove”/&amp;gt;            &lt;br /&gt;&lt;/font&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;add name=&amp;quot;moduleToKeep”/&amp;gt;           &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/modules&amp;gt;           &lt;br /&gt;&amp;#160; &amp;lt;/system.webServer&amp;gt;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160; &amp;lt;system.web&amp;gt;           &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;customErrors mode=&amp;quot;On&amp;quot; defaultRedirect=&amp;quot;Error.htm&amp;quot;&amp;gt;           &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;error statusCode=&amp;quot;404&amp;quot; redirect=&amp;quot;http://myAppDevWeb/404.aspx&amp;quot;/&amp;gt;           &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/customErrors&amp;gt;           &lt;br /&gt;&amp;#160; &amp;lt;/system.web&amp;gt;           &lt;br /&gt;&amp;#160; &amp;lt;appSettings&amp;gt;           &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;add key=&amp;quot;DBServer&amp;quot; value=&amp;quot;myAppDevDB&amp;quot;/&amp;gt;           &lt;br /&gt;&amp;#160; &amp;lt;/appSettings&amp;gt;           &lt;br /&gt;&amp;lt;/configuration&amp;gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt; The requirement is to remove the &amp;lt;configSections&amp;gt; and the module “moduleToRemove” . These sections are&amp;#160; marked in &lt;font color="#ff0000"&gt;Red&lt;/font&gt;.&lt;/p&gt;  &lt;p&gt;The resultant file should look like this&lt;/p&gt;  &lt;table border="0" cellspacing="0" cellpadding="2" width="100%"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td bgcolor="#efefef" valign="top" width="100%"&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;          &lt;br /&gt;&amp;lt;configuration&amp;gt;&amp;#160; &lt;br /&gt;&amp;#160; &amp;lt;system.webServer&amp;gt;           &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;modules&amp;gt;           &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;add name=&amp;quot;moduleToKeep”/&amp;gt;           &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/modules&amp;gt;           &lt;br /&gt;&amp;#160; &amp;lt;/system.webServer&amp;gt;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160; &amp;lt;system.web&amp;gt;           &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;customErrors mode=&amp;quot;On&amp;quot; defaultRedirect=&amp;quot;Error.htm&amp;quot;&amp;gt;           &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;error statusCode=&amp;quot;404&amp;quot; redirect=&amp;quot;http://myAppDevWeb/404.aspx&amp;quot;/&amp;gt;           &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/customErrors&amp;gt;           &lt;br /&gt;&amp;#160; &amp;lt;/system.web&amp;gt;           &lt;br /&gt;&amp;#160; &amp;lt;appSettings&amp;gt;           &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;add key=&amp;quot;DBServer&amp;quot; value=&amp;quot;myAppDevDB&amp;quot;/&amp;gt;           &lt;br /&gt;&amp;#160; &amp;lt;/appSettings&amp;gt;           &lt;br /&gt;&amp;lt;/configuration&amp;gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Lets have a look at the Powershell script we will be using. We will name this script RemoveElement.ps1 and save it in C:\Scripts&lt;/p&gt;  &lt;table border="0" cellspacing="0" cellpadding="2" width="100%"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td bgcolor="#efefef" valign="top" width="100%"&gt;         &lt;p&gt;# Declaring the parameter to be passed while executing the Powershell script&lt;/p&gt;          &lt;p&gt;Param (            &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; $webConfigPath&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; # Path to the web.config file. Make sure file is not read-only             &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ) &lt;/p&gt;          &lt;p&gt;$xml = [xml](get-content $webConfigPath)&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; # Create XML object and open the web.config file&lt;/p&gt;          &lt;p&gt;$nodeToRemove= $xml.configuration.SelectSingleNode(&amp;quot;configSections&amp;quot;);&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; # Selecting the Element to be removed            &lt;br /&gt;$xml.configuration.RemoveChild($nodeToRemove);&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; # Remove the Element&lt;/p&gt;          &lt;p&gt;foreach( $item in&amp;#160; $xml.configuration.&amp;quot;system.webServer&amp;quot;.modules.add )&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; # Traverse through all modules            &lt;br /&gt;{             &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; if( $item.name -eq &amp;quot;moduleToRemove&amp;quot; )&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; # Checking if the current module is to be removed             &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {             &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; $xml.configuration.&amp;quot;system.webServer&amp;quot;.modules.RemoveChild($item);&amp;#160;&amp;#160; # Remove the desired module when found            &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }             &lt;br /&gt;}&lt;/p&gt;          &lt;p&gt;&amp;#160;&lt;/p&gt;          &lt;p&gt;$xml.Save($webConfigPath)&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; # Save the updated web.config file&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Run the script: &lt;/p&gt;  &lt;p&gt;c:\&amp;gt;Powershell&lt;/p&gt;  &lt;p&gt;PS C:\&amp;gt; cd scripts&lt;/p&gt;  &lt;p&gt;PS C:\scripts&amp;gt; .\RemoveElement.ps1 “C:\MyApplication\web.config”&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Related Posts:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/ssehgal/archive/2009/04/12/automating-config-file-changes-part-1-installing-microsoft-windows-powershell.aspx"&gt;Automating config file changes : Part 1 – Installing Microsoft Windows Powershell&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/ssehgal/archive/2009/05/28/automating-config-file-changes-part-2-modifying-already-existing-config-keys.aspx"&gt;Automating config file changes : Part 2 – modifying already existing config keys&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9652489" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ssehgal/archive/tags/Automate/default.aspx">Automate</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/files/default.aspx">files</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/config/default.aspx">config</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/Powershell/default.aspx">Powershell</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/XML/default.aspx">XML</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/file/default.aspx">file</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/element/default.aspx">element</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/remove/default.aspx">remove</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/node/default.aspx">node</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/delete/default.aspx">delete</category></item><item><title>Automating config file changes : Part 2 – modifying already existing config keys</title><link>http://blogs.msdn.com/ssehgal/archive/2009/05/28/automating-config-file-changes-part-2-modifying-already-existing-config-keys.aspx</link><pubDate>Thu, 28 May 2009 15:47:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9647072</guid><dc:creator>ssehgal</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/ssehgal/comments/9647072.aspx</comments><wfw:commentRss>http://blogs.msdn.com/ssehgal/commentrss.aspx?PostID=9647072</wfw:commentRss><description>&lt;P&gt;This post contains the Powershell script to modify already existing config key values in a config file.&lt;/P&gt;
&lt;P&gt;A sample web.config file is given below&lt;/P&gt;
&lt;TABLE border=0 cellSpacing=0 cellPadding=2 width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD bgColor=#efefef vAlign=top width="100%"&gt;&amp;lt;?xml version="1.0"?&amp;gt; &lt;BR&gt;&amp;lt;configuration&amp;gt; &lt;BR&gt;&amp;nbsp; &amp;lt;system.web&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;customErrors mode="On" defaultRedirect="Error.htm"&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;error statusCode="404" redirect="http://myAppDevWeb/404.aspx"/&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/customErrors&amp;gt; &lt;BR&gt;&amp;nbsp; &amp;lt;/system.web&amp;gt; &lt;BR&gt;&amp;nbsp; &amp;lt;appSettings&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;add key="DBServer" value="myAppDevDB"/&amp;gt; &lt;BR&gt;&amp;nbsp; &amp;lt;/appSettings&amp;gt; &lt;BR&gt;&amp;lt;/configuration&amp;gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P&gt;We want to modify the 404 redirect page address and DBServer by passing the required values to the Powershell script.&lt;/P&gt;
&lt;P&gt;The following Powershell script helps us achieve this. We will name this script webUpdate.ps1 and store it in C:\Scripts&lt;/P&gt;
&lt;TABLE border=0 cellSpacing=0 cellPadding=2 width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD bgColor=#efefef vAlign=top width="100%"&gt;
&lt;P&gt;# In Powershell, variable is declared by prefixing dollar symbol $ &lt;BR&gt;# Anything followed by hash # is treating as a single line comment &lt;BR&gt;# –eq is the comparison operator &lt;BR&gt;# Plus + is used to concatenate strings&lt;/P&gt;
&lt;P&gt;# Parameter declaration which will be passed to the script during execution &lt;/P&gt;
&lt;P&gt;Param ( &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $webConfigPath,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Path to the web.config file. Make sure file is not read-only &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $webServerName,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Name of the Webserver. This value will be used to construct the 404 page address &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $dbServerName&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Name of the DB Server. &lt;BR&gt;)&lt;/P&gt;
&lt;P&gt;$xml = [xml](get-content $webConfigPath);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Create the XML Object and open the web.config file &lt;BR&gt;$root = $xml.get_DocumentElement();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Get the root element of the file.&lt;/P&gt;
&lt;P&gt;foreach( $item in $root."system.web".customErrors.error)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Iterate through each error node under the customErrors tag &lt;BR&gt;{ &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if( $item.statusCode -eq "404" )&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Check if the current statusCode is 404 &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { $item.redirect = “http://” + $webServername + "/404.aspx"; }&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Setting the redirect value for 404 error page &lt;BR&gt;}&lt;/P&gt;
&lt;P&gt;foreach( $item in $root.appSettings.add)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Updating the DBServer Name &lt;BR&gt;{ &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if( $item.key -eq "DBServer" ) &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { $item.value = $dbServerName; } &lt;BR&gt;}&lt;/P&gt;
&lt;P&gt;$xml.Save($webConfigPath)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Finally, Saving the file &lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P&gt;We will now run the script on a web.config file present at the location C:\MyApplication\web.config &lt;BR&gt;The requirement is to update the config values for the Test environment where the webserver name is myAppTestWeb and the DB Server name is myAppTestDB&lt;/P&gt;
&lt;P&gt;Open Command Prompt&lt;/P&gt;
&lt;P&gt;c:\&amp;gt;Powershell&lt;/P&gt;
&lt;P&gt;PS C:\&amp;gt; cd scripts&lt;/P&gt;
&lt;P&gt;PS C:\scripts&amp;gt; .\webUpdate.ps1 “C:\MyApplication\web.config” myAppTestWeb myAppTestDB &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Related Post: &lt;A href="http://blogs.msdn.com/ssehgal/archive/2009/04/12/automating-config-file-changes-part-1-installing-microsoft-windows-powershell.aspx" mce_href="http://blogs.msdn.com/ssehgal/archive/2009/04/12/automating-config-file-changes-part-1-installing-microsoft-windows-powershell.aspx"&gt;Automating config file changes : Part 1 – Installing Microsoft Windows Powershell&lt;/A&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9647072" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/ssehgal/archive/tags/Automate/default.aspx">Automate</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/config/default.aspx">config</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/update/default.aspx">update</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/keys/default.aspx">keys</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/web_2E00_config/default.aspx">web.config</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/Powershell/default.aspx">Powershell</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/XML/default.aspx">XML</category><category domain="http://blogs.msdn.com/ssehgal/archive/tags/file/default.aspx">file</category></item></channel></rss>