<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>MSJimblog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/msjimblog/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/msjimblog/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 03:45:53 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Writing and running scripts with PowerShell ISE</title>
      <link>https://docs.microsoft.com/archive/blogs/msjimblog/writing-and-running-scripts-with-powershell-ise</link>
      <pubDate>Tue, 25 Jun 2013 12:07:00 GMT</pubDate>
      <dc:creator><![CDATA[Jim E. Cox]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/msjimblog/2013/06/25/writing-and-running-scripts-with-powershell-ise/</guid>
      <description><![CDATA[Using&nbsp;SharePoint 2010 Management Shell is a very inefficient way to run PowerShell scripts. It...]]></description>
      <content:encoded><![CDATA[<p class="entry-title">Using&nbsp;SharePoint 2010 Management Shell is a very inefficient way to run PowerShell scripts. It is great for quickly running PowerShell commands that are a few lines long, but when is this a typical scenario these days with SharePoint, SQL or other technologies, not often. I always wanted a better way to execute scripts as opposed to saving as a .ps1 text file, launching PowerShell window,&nbsp;change directory to find the .ps1 file and then finally&nbsp;run&nbsp;my&nbsp;scripts, to me this is antiquated with way too may steps involved. I want to highlight my script or portions of my script with my mouse and click one button to run it, that's all. I got this idea from my short lived days as an SQL developer where you can highlight a piece of SQL and click run to return results. When I joined Microsoft, I went to a PowerShell session held by Josh Gavant and saw how he could select a piece of PowerShell Script and run it, well the sky turned blue again. I never looked back and I never load the SharePoint Management Shell, but I run hundreds of commands all the time. Read and see how you can improve your life.</p>
<p class="entry-title">PowerShell v2 ships with <a href="https://technet.microsoft.com/en-us/library/dd315244.aspx">PowerShell ISE</a>, that is much easier to use while working with scripts. This is available by default on Windows 7 and can be enabled as a feature on Windows Server 2008, using the following PowerShell command: <code class="powershell plain">Add</code><code class="powershell keyword">-WindowsFeature</code> <code class="powershell plain">PowerShell</code><code class="powershell keyword">-ISE </code>(a good example of when to use the Management Shell) You can now&nbsp;find PowerShell ISE shortcuts in the Start Menu &gt; Accessories&nbsp;(do not use (x86) with SharePoint). If you are using Windows 8, click Window button, enter PowerShell to find the Tile, right click&nbsp;and add it to the task bar. From now on,&nbsp;right click on the PowerShell Icon and click PowerShell ISE to load our new tool, see graphic below.</p>
<p class="entry-title"><em>Figure 1: Launching ISE from Windows 8</em></p>
<p class="entry-title"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/95/33/4572.2013-06-25%2015_29_49-.jpg" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-95-33/4572.2013_2D00_06_2D00_25-15_5F00_29_5F00_49_2D00_.jpg"><img src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/95/33/4572.2013-06-25%2015_29_49-.jpg" original-url="https://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-95-33/4572.2013_2D00_06_2D00_25-15_5F00_29_5F00_49_2D00_.jpg" alt="" width="293" height="217" border="0" /></a></p>
<p class="entry-title">&nbsp;</p>
<p class="entry-title"><em>Figure 2: PowerShell ISE in action</em></p>
<p class="entry-title"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/95/33/1781.PSISE.jpg" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-95-33/1781.PSISE.jpg"><img src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/95/33/1781.PSISE.jpg" original-url="https://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-95-33/1781.PSISE.jpg" alt="" border="0" /></a></p>
<p class="entry-content">&nbsp;</p>
<p class="entry-content">However, when you start PowerShell ISE, you&rsquo;ll find that it only works with Windows cmdlets. For PowerShell ISE to work with SharePoint cmdlets (or other technologies), you&rsquo;ll need to add a PowerShell Snapin with a few other recommended settings.&nbsp;You will want these setting to load every time ISE loads so&nbsp;modify your PowerShell Profile to host the correct commands as follows. (for Steps 1 - 3, copy and paste&nbsp;the code into a new Tab in&nbsp;ISE and run it by clicking F5)</p>
<p class="entry-content">1. Create a new profile page for all users</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp; if (!(test-path $profile.AllUsersAllHosts))&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp; {new-item -type file -path $profile.AllUsersAllHosts-force}<br />&nbsp;&nbsp;<br />2. Edit the new profile, this will load the newly created page in ISE<br />&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp; psEdit $profile.AllUsersAllHosts</p>
<p>3.&nbsp;&nbsp;In the open page, right in ISE,&nbsp;called profile1.ps1, add the following code&nbsp;to the page and click save&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp; $ver = $host | select version <br />&nbsp;&nbsp;&nbsp;&nbsp; if ($ver.Version.Major -gt 1) {$Host.Runspace.ThreadOptions = "ReuseThread"} <br />&nbsp;&nbsp;&nbsp;&nbsp; Add-PsSnapin Microsoft.SharePoint.PowerShell <br />&nbsp;&nbsp;&nbsp;&nbsp; Set-location $home<br />&nbsp;<br />&nbsp;&nbsp;<br />4.&nbsp; Save profile.ps1 page and close PowerShell ISE, re-open ISE and try running SharePoint commands such as Get-Command *SP* to return list of SharePoint&nbsp;cmdlets.</p>
<p>&nbsp;</p>
<p>I hope you enjoy your new found methodology to run PowerShell Scripts in SharePoint or most other Microsoft Technologies.</p>
<p class="entry-content">&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Document your Farm with SharePoint Lists using PowerShell - Part 3 Features</title>
      <link>https://docs.microsoft.com/archive/blogs/msjimblog/document-your-farm-with-sharepoint-lists-using-powershell-part-3-features</link>
      <pubDate>Thu, 01 Nov 2012 05:09:16 GMT</pubDate>
      <dc:creator><![CDATA[Jim E. Cox]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/msjimblog/2012/11/01/document-your-farm-with-sharepoint-lists-using-powershell-part-3-features/</guid>
      <description><![CDATA[This is Part 3, as promised a month ago, per my previous post  here, where I showed you how to...]]></description>
      <content:encoded><![CDATA[<p>This is Part 3, as promised a month ago, per my previous post <a href="https://gallery.technet.microsoft.com/office/Document-your-Farm-with-be9af7d8"> here</a>, where I showed you how to gather and save Farm Level Properties in a SharePoint List. We follow a similar pattern in this new script that will allow you to store and manage your existing Service Applications names and other properties in a second SharePoint list.</p>
<p>See the Script <a href="https://gallery.technet.microsoft.com/office/Document-your-Features-c1e10744">here up on TechNet</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Document your Farm with SharePoint Lists using PowerShell - Part 2 Service Apps</title>
      <link>https://docs.microsoft.com/archive/blogs/msjimblog/document-your-farm-with-sharepoint-lists-using-powershell-part-2-service-apps</link>
      <pubDate>Wed, 31 Oct 2012 17:59:00 GMT</pubDate>
      <dc:creator><![CDATA[Jim E. Cox]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/msjimblog/2012/10/31/document-your-farm-with-sharepoint-lists-using-powershell-part-2-service-apps/</guid>
      <description><![CDATA[This is Part 2, as promised a month ago, per my previous post  here, where I showed you how to...]]></description>
      <content:encoded><![CDATA[<p>This is Part 2, as promised a month ago, per my previous post <a href="https://gallery.technet.microsoft.com/office/Document-your-Farm-with-be9af7d8"> here</a>, where I showed you how to gather and save Farm Level Properties in a SharePoint List. We follow a similar pattern in this new script that will allow you to store and manage your existing Service Applications names and other properties in a second SharePoint list.</p>
<p>See the <a title="Script here up on TechNet" href="https://gallery.technet.microsoft.com/office/Document-your-Service-Apps-5e0c9c27" target="_blank">Script here up on TechNet</a></p>]]></content:encoded>
    </item>
    <item>
      <title>SharePoint 2007, 2010 or 2013 Application Warm-up Script</title>
      <link>https://docs.microsoft.com/archive/blogs/msjimblog/sharepoint-2007-2010-or-2013-application-warm-up-script</link>
      <pubDate>Sun, 30 Sep 2012 15:36:00 GMT</pubDate>
      <dc:creator><![CDATA[Jim E. Cox]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/msjimblog/2012/09/30/sharepoint-2007-2010-or-2013-application-warm-up-script/</guid>
      <description><![CDATA[SharePoint Applications should be warmed up in the morning before the Director launches your new...]]></description>
      <content:encoded><![CDATA[<p>SharePoint Applications should be warmed up in the morning before the Director launches your new SharePoint App. Why? Web Applications will recycle overnight and will no longer be resident in memory for fast page loading; it is usually an important member of the team who notices it, the Director. He will come to you and say the Farm is slow, speed it up. To avoid this situation run a scheduled script that will launch popular or important sites into memory ahead of time resulting in no one noticing a slow running web page.</p>
<p>Here is a PowerShell script that is designed to work in SharePoint 2007, 2010 and 2013. Comment out/in the sections that apply to your Farm. Set it to run as a scheduled task in the Windows Task Scheduler, for an appropriate time, shortly after the App Pools Recycle and before the important users starts using your system, typically at 5:00 AM.</p>
<p>If you have a load balancer in place, use IP addresses instead of the host header name. You may have to adjust your IIS settings to allow your site to respond to IP address directly.</p>
<p>&nbsp;</p>
<p><a href="https://gallery.technet.microsoft.com/office/SharePoint-2007-2010-or-d1884b4b">Here is a link to my Script</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Document your Farm with SharePoint Lists using PowerShell - Part 1 Farm Level</title>
      <link>https://docs.microsoft.com/archive/blogs/msjimblog/document-your-farm-with-sharepoint-lists-using-powershell-part-1-farm-level</link>
      <pubDate>Sun, 30 Sep 2012 14:32:00 GMT</pubDate>
      <dc:creator><![CDATA[Jim E. Cox]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/msjimblog/2012/09/30/document-your-farm-with-sharepoint-lists-using-powershell-part-1-farm-level/</guid>
      <description><![CDATA[If you are the sole&nbsp;Administrator of a SharePoint Farm, you will know your farm like the back...]]></description>
      <content:encoded><![CDATA[<p>If you are the sole&nbsp;Administrator of a SharePoint Farm, you will know your farm like the back of your hand but once&nbsp;it grows and becomes mission critical, it will be necessary for Team Administration resulting in an exponential growth of communication channels leading to errors. The Farm Administrator needs to know every detail including every configuration setting that could affect the Farm and when the Admin team grows, how do you continue to maintain control so you can collectively Administer and support the Farm? Communication and documentation how to&nbsp;win this battle.&nbsp;</p>
<p>Documenting a moving target is difficult, things are changing every day, features are added, content databases grow, quotas change etc.&nbsp;The first step is to baseline your configuration so you can compare settings to the previous months or years so when something goes wrong, you can compare and find out exactly what and when&nbsp;it changed. It is imperative to set up a process for documenting your Farm&nbsp;and will especially come in handy when troubleshooting problems. Implementing a manual process is doomed to failure. PowerShell and SharePoint lists to the rescue.</p>
<p>Why not create a SharePoint Site and store all your settings in various lists. You can use all of SharePoint goodness&nbsp;to filter, sort, search and compare. You have one place to go to check your settings and to find what you are looking for efficiently because this is what SharePoint is good at. But you do not have time to create lists and populate them with current data. The PowerShell script below is the first in&nbsp;a series of scripts I made that automates the entire process. I start with capturing the main Farm level objects and properties and will later capture Web Apps, Service Apps, Features, site collections until every property of every object is in a list for quick access to the Administrator or the Troubleshooter.</p>
<p>To see the script <a title="Click Here" href="https://gallery.technet.microsoft.com/office/Document-your-Farm-with-be9af7d8" target="_blank">click here</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Configure Project Server 2010 &amp; 2013 Reporting with PowerShell including BI Center, Excel, Secure Store etc.</title>
      <link>https://docs.microsoft.com/archive/blogs/msjimblog/configure-project-server-2010-2013-reporting-with-powershell-including-bi-center-excel-secure-store-etc</link>
      <pubDate>Fri, 17 Aug 2012 08:39:00 GMT</pubDate>
      <dc:creator><![CDATA[Jim E. Cox]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/msjimblog/2012/08/17/configure-project-server-2010-2013-reporting-with-powershell-including-bi-center-excel-secure-store-etc/</guid>
      <description><![CDATA[Installing Project Server through Central Admin is quite straight forward and easy to memorize the...]]></description>
      <content:encoded><![CDATA[<p>Installing Project Server through Central Admin is quite straight forward and easy to memorize the steps after you have done it a few times but the Reporting functionality has many steps and can take some time to configure so I made a script to configure all of this in one click. The script is meant for setting up your Lab or a Pilot system on a green field server. If you want to use it in Production you would need to set up some error handling and do lots of testing of course.</p>
<p>I have another <a href="https://gallery.technet.microsoft.com/office/Install-Server-2013-with-09d8eb59">script</a>&nbsp;that will install Project Server 2013 including the BI Center so between the 2 scripts, you don't have to use the UI at all to get Project Server 2013 Preview up and running&nbsp;on Prem.&nbsp;The whole process of going from green field server to running reports can take minutes not hours now. I also have a <a href="https://gallery.technet.microsoft.com/office/Create-projects-with-tasks-ae97329e">script </a>to populate the instance with Projects and Tasks so you can quickly start using Project Server 2013 to get a feel for the new feel including performance.</p>
<p>Here is a link to <a href="https://gallery.technet.microsoft.com/office/Configure-Server-2010-2013-3749415b">my Script</a></p>
<p>Enjoy</p>
<p><br />&nbsp;</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Bulk create projects in Project Server 2007, 2010 and 2013 with PowerShell</title>
      <link>https://docs.microsoft.com/archive/blogs/msjimblog/bulk-create-projects-in-project-server-2007-2010-and-2013-with-powershell</link>
      <pubDate>Sat, 11 Aug 2012 12:08:00 GMT</pubDate>
      <dc:creator><![CDATA[Jim E. Cox]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/msjimblog/2012/08/11/bulk-create-projects-in-project-server-2007-2010-and-2013-with-powershell/</guid>
      <description><![CDATA[I made a script that will create the&nbsp;Projects in bulk. Link to script
In my Project Server...]]></description>
      <content:encoded><![CDATA[<p>I made a script that will create the&nbsp;Projects in bulk. <a href="https://gallery.technet.microsoft.com/office/Create-projects-with-tasks-ae97329e" target="_blank">Link to script</a></p>
<p>In my Project Server 2013 lab I was able to create 100 projects in&nbsp;just over in&nbsp;5 minutes &nbsp;(10 tasks in each and 10 Resources on the Resource Sheet).&nbsp;My Lab is&nbsp;a Core i7 Laptop, 16 GB Ram and an SSD. I am using Windows 8&nbsp;Preview with&nbsp;Hyper-V. I allocated&nbsp;1 processor to the SQL VM and&nbsp;4 processors to the&nbsp;Project Server VM.&nbsp;The Project Server instance is Vanilla, no custom fields and no permission changes. On the same hardware and VM configuration, I created a vanilla 2010 instance and performed the same test, the result was a slight performance improvement. The testing did not go so well on 1 or 2 processors allocated to the Project Server VM.</p>
<p>There was considerable performance improvement in the usability of Project Server 2013 over 2010 version, meaning that loading Project Center and all other pages was considerably faster even when I loaded a 1000 projects into the system.&nbsp;&nbsp;In Project Center, it was incredible how fast I could filter out a&nbsp;few projects from a 1000 projects using&nbsp;Project Name field, it was instant.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Installing Project Server 2013 Preview the easy way, with PowerShell</title>
      <link>https://docs.microsoft.com/archive/blogs/msjimblog/installing-project-server-2013-preview-the-easy-way-with-powershell</link>
      <pubDate>Thu, 09 Aug 2012 19:35:00 GMT</pubDate>
      <dc:creator><![CDATA[Jim E. Cox]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/msjimblog/2012/08/09/installing-project-server-2013-preview-the-easy-way-with-powershell/</guid>
      <description><![CDATA[Installing Project Server 2013 the easy way, with a PowerShell Script. Once your Farm is up and...]]></description>
      <content:encoded><![CDATA[<p>Installing Project Server 2013 the easy way, with a PowerShell Script. Once your Farm is up and running, use this script to create the Web App, Service App, Project Web App and BI Center,&nbsp;then start entering projects and testing out the new Features in 2013. It is easier to just use Project Online but more fun to install and use On Prem Environment. I decided to not use claims but stay tuned for another Script when RTM Ships where I will implement claims on the Web App.</p>
<p><a href="https://gallery.technet.microsoft.com/office/Install-Server-2013-with-09d8eb59">Here is a link to my script,</a> please try it out and provide feedback.</p>]]></content:encoded>
    </item>
    <item>
      <title>Bulk create standard set of AD Groups and test Accounts for Project Server Lab</title>
      <link>https://docs.microsoft.com/archive/blogs/msjimblog/bulk-create-standard-set-of-ad-groups-and-test-accounts-for-project-server-lab</link>
      <pubDate>Thu, 02 Aug 2012 12:02:00 GMT</pubDate>
      <dc:creator><![CDATA[Jim E. Cox]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/msjimblog/2012/08/02/bulk-create-standard-set-of-ad-groups-and-test-accounts-for-project-server-lab/</guid>
      <description><![CDATA[Project Server 2013 has arrived and I have built a new 2013&nbsp;Farm in my Lab. I often wind...]]></description>
      <content:encoded><![CDATA[<p>Project Server 2013 has arrived and I have built a new 2013&nbsp;Farm in my Lab. I often wind up&nbsp;having to create&nbsp;new Active Directory servers and&nbsp;set up Project Server AD Groups populated with test accounts. This takes time away from more valuable tasks so I created a PowerShell script that will&nbsp;automate the work for me. Also when it comes time to perform load testing on Project Server it is necessary to populate the Resource Pool and&nbsp;User Groups with&nbsp;between 10,000 to 25,000 users. This script if perfect for creating the&nbsp;thousands of accounts&nbsp;where you can control creation of Project Manager, Team&nbsp;Member... accounts in&nbsp;AD for mapping to Project Server. The Admin panel in PWA&nbsp;allows the Project Server Application Administrator&nbsp;to map AD Groups generated by this script to Project Server Groups in order to Synchronize the two systems and thus creating the Project Server Resource Pool and User Access accounts with passwords.</p>
<p>Personally I like to use this script in PowerShell ISE environment.&nbsp;If you do not know about this tool here are some details.&nbsp;<a href="https://technet.microsoft.com/en-us/library/dd315244">https://technet.microsoft.com/en-us/library/dd315244</a> or <a href="https://technet.microsoft.com/en-US/library/dd819451.aspx">https://technet.microsoft.com/en-US/library/dd819451.aspx</a>. What I do is select portions of the script with my mouse and&nbsp;run with F8 command. This way you can see step by step what the script is doing. When you&nbsp;finish setting&nbsp;all the variables to suit your environment and test for a while, you can <a title="run in console" href="https://technet.microsoft.com/en-us/library/ee176949.aspx#EEAA" target="_parent">run it as a script in PowerShell Console</a>.&nbsp;If you want to&nbsp;use the ISE, you can&nbsp;install it on Windows Server 2008 R2&nbsp;from Server Manager, Add Feature.</p>
<p>Basically the scrip asks if you want to create a new OU or not, new AD Groups or not and new Accounts in these groups or not. When it asks to create accounts is asks how many, what Prefix to use, what AD group to drop them into&nbsp;and a starting point for sequential numbering of each user. If the OU or AD groups already exist it will notify you and keep going. If you try to enter duplicate users it will error and keep going.</p>
<p><a title="Here is link" href="https://gallery.technet.microsoft.com/office/Create-bulk-User-Accounts-06c3a4f8" target="_blank">&nbsp;Here is a link to my script, enjoy.</a></p>
<p><span style="font-size: small;"><em></em></span>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Where to store Your custom SQL Connection Strings in SharePoint</title>
      <link>https://docs.microsoft.com/archive/blogs/msjimblog/where-to-store-your-custom-sql-connection-strings-in-sharepoint</link>
      <pubDate>Tue, 31 Jul 2012 12:41:00 GMT</pubDate>
      <dc:creator><![CDATA[Jim E. Cox]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/msjimblog/2012/07/31/where-to-store-your-custom-sql-connection-strings-in-sharepoint/</guid>
      <description><![CDATA[&nbsp; This article is about SharePoint tools to control and manage your custom connection strings,...]]></description>
      <content:encoded><![CDATA[<p>&nbsp; This article is about SharePoint tools to control and manage your custom connection strings, and most importantly, the access accounts and passwords. With SharePoint multi-server Farms, managing custom SQL connection strings can be a challenge for the Farm Administrator and the Developer. We have two aspects here, Security and Manageability. For security, the password has to be secured at rest (on the disk through encryption), in memory in the application&nbsp;to avoid extracting it from memory dump and finally&nbsp;through the wire (or Air)&nbsp;(using SSL will do it). For Manageability, the more automated and&nbsp;centralized the better.&nbsp;If you have 2 or more web front end servers, each server will need a copy of the connection string and doing this manually is risky and error prone. Proper backup and restore policies must be simple and manageable&nbsp;because losing such data is critical for recovery. &nbsp;It doesn&rsquo;t matter which tools are used manage connection strings as long as it covers these requirements.</p>
<p>&nbsp; There are several storage mechanisms&nbsp; available, including the hierarchical object store, configuration files, property bags, and SharePoint lists. Each mechanism has advantages, disadvantages, and sometimes risks&mdash;for example, SharePoint property bags provide an easy-to-use storage mechanism, but developers risk corrupting the configuration database or the content database if they attempt to persist non-serializable types. This is a great MSDN article about the pros and cons of each mechanism. <a title="https://msdn.microsoft.com/en-us/library/ee413935.aspx" href="https://msdn.microsoft.com/en-us/library/ee413935.aspx">https://msdn.microsoft.com/en-us/library/ee413935.aspx</a>&nbsp; (applies to 2007 and 2010 versions of SharePoint).&nbsp;You should not store a connection string in a Web Part unless you find a way to encrypt it because a user can export the Web Part from a page and&nbsp;can see all properties, including any connection string data even access accounts and passwords if not done right.</p>
<h2><strong><span style="font-size: medium;" size="3">The most popular choice Web.Config</span></strong></h2>
<p></p>
<p>To add a connection string to the Web.config file, you can simply add a &ldquo;connectionStrings&rdquo; section between the closing (&lt;/SharePoint&gt;) and opening ( &lt;system.web&gt;) elements.</p>
<p>&lt;/SharePoint&gt; <br />&lt;connectionStrings&gt; <br />&lt;add name="MyConnectionString" connectionString="Data Source=serverName;Initial Catalog=DemoDB;Persist Security Info=True;User ID=userName;Password=password;"/&gt; <br />&lt;/connectionStrings &gt; <br />&lt;system.web&gt;</p>
<p>Another manual way to add a connection string to a web.config file is from IIS. In IIS 7 click on your Web Application and double click connection strings Icon (see graphic below) and simply add a connection by filling out the form. You can set an account and password but it will not be encrypted. It is equivalent to adding a string manually per above step, there is nothing special here. It is not a best practice in multi-server Farms with many servers because of extra manageability burden put onto the Farm Administrator. Manual configuration is never a best practice in multi-server Farms.</p>
<p><a href="https://jimecox.files.wordpress.com/2012/06/image.png"><img width="244" height="186" title="image" style="border-width: 0px; display: inline;" alt="image" src="https://jimecox.files.wordpress.com/2012/06/image_thumb.png" border="0" /></a></p>
<p>If you do decide to use the Web.config in production environments you should always encrypt passwords before storing them in files. For more information, see MSDN for encrypting connection information at: <a href="https://msdn.microsoft.com/en-us/library/ms178372.aspx">https://msdn.microsoft.com/en-us/library/ms178372.aspx</a>. This also needs to be done in the Web.config files of the target web applications on the destination servers, a very manual and error prone process.</p>
<p>Walkthrough: Encrypting Configuration Information <a href="https://msdn.microsoft.com/en-us/library/dtkwfdky.aspx" target="_blank">Using Protected Configuration</a></p>
<p><strong>Best Practice if choosing Web.config</strong></p>
<ol>
<li>Settings may be stored in the Web.config file only when SharePoint, Internet Information Services (IIS), or ASP.NET needs access to these settings to be able to operate.</li>
<li>When adding connection strings to web.config, your Developer&nbsp;should use the <a href="https://msdn.microsoft.com/en-us/library/bb861909.aspx" target="_blank">SPWebConfigModification</a> class in a feature event receiver in a WSP, this will update the SharePoint Web.config file automatically including all destination servers. Typically the web.config update will happen when the feature is activated (or removed when the feature is deactivated).</li>
<li>Never edit the web.config file by hand, these settings can disappear on you. See what <a href="https://joelblogs.co.uk/2009/12/03/wss-3-0-and-moss-2007-tips-7-popular-misconceptions-%E2%80%93-windows-sharepoint-services-web-application-%E2%80%93-no-touchy/" target="_blank">Joel</a> has to say about this.</li>
<li><a href="https://msdn.microsoft.com/en-us/library/ee855123.aspx" target="_blank">This is a must read article from MSDN</a>. <a title="https://msdn.microsoft.com/en-us/library/ee855123.aspx" href="https://msdn.microsoft.com/en-us/library/ee855123.aspx">https://msdn.microsoft.com/en-us/library/ee855123.aspx</a>. It provides options and sample code for storing configuration settings in SharePoint, it applies to 2007 and 2010 versions of SharePoint.</li>
</ol>
<p><strong><span style="font-size: medium;" size="3"></span></strong>&nbsp;</p>
<h2><strong><span style="font-size: medium;" size="3">Choosing to use the Secure Store</span></strong></h2>
<p>Using Secure Store in SharePoint 2010 is an optional and highly recommended&nbsp;place to store and encrypt the user name and password for access by custom coded solutions. The secure store service provides a way for Farm Administrator to store credentials securely rather than hard coding them in code or configuration files. This can simplify the manageability aspect of having to encrypt portions of the Web.config file plus if hands over more control to the Farm Administrator to centrally manage access accounts and passwords. Below is a sample code block from the SDK at this url <a title="https://msdn.microsoft.com/en-us/library/ff625799.aspx" href="https://msdn.microsoft.com/en-us/library/ff625799.aspx">https://msdn.microsoft.com/en-us/library/ff625799.aspx</a>. and it shows a way to get the credentials from Secure Store (assuming correct permission levels of course). The balance of the connection string data such as server name and database can be stored in a place of your choosing and many choose a SharePoint list in Central Admin site but remember about recoverability in disaster scenarios, the Central Admin site may not be restorable.</p>
<p>Secure Store&nbsp;can help you with NTLM &ldquo;double hop&rdquo; issues where credentials cannot be transferred across more than one computer boundary because typically the Secure Store is one hop away from the SQL data. . SP2010 is making it easier to create more sophisticated enterprise solutions.</p>
<p>private static string GetCurrentDMSUsername() <br />{ <br />&nbsp;&nbsp;&nbsp; string result = null;</p>
<p>&nbsp;&nbsp;&nbsp; ISecureStoreProvider secureStoreProvider = SecureStoreProviderFactory.Create();</p>
<p>&nbsp;&nbsp;&nbsp; using (SecureStoreCredentialCollection credentialCollection = secureStoreProvider.GetCredentials(SecureStoreApplicationID)) <br />&nbsp;&nbsp;&nbsp; { <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; foreach (SecureStoreCredential credential in credentialCollection) <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (credential.CredentialType == SecureStoreCredentialType.UserName) <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; result = GetStringFromSecureString(credential.Credential); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <br />&nbsp;&nbsp;&nbsp; }</p>
<p>&nbsp;&nbsp;&nbsp; return result; <br />}</p>
<p><strong>See another Code Snippet:</strong> <a href="https://msdn.microsoft.com/en-us/library/ff394459.aspx" target="_blank">Get User Credentials Using the Default Secure Store Provider</a></p>
<p></p>
<h2><span style="font-size: medium;" size="3"><strong>Application Setting Manager&nbsp;for Large Scale Farms</strong> <br /></span></h2>
<p>Because of the complexities in choosing and implementing an appropriate strategy for the storage of configuration data, such as connection strings, the SharePoint Guidance team has developed an optional reusable component named the <a href="https://msdn.microsoft.com/en-us/library/ff798327" target="_blank">Application Setting Manager.</a> You can use it in your SharePoint applications to provide an easy, consistent, and type-safe means of storing and retrieving configuration data at any level of the SharePoint hierarchy. Because it uses property bags as its underlying storage mechanism, the Application Setting Manager is not suitable for storing large payloads. If you need to store data exceeding 4kilobytes (KB) in size, you should choose an alternative approach to storage. For example, you can configure the Application Setting Manager to use <a href="https://msdn.microsoft.com/en-us/library/ff798463">list-based property bags</a>.</p>
<p></p>
<h2><strong><span style="font-size: medium;" size="3">Performance</span></strong></h2>
<p>The potential for a significant performance problem is very real if retrieving credentials or other settings is done incorrectly. Caching is usually needed in busy SharePoint custom solutions. SharePoint presents some unique challenges that must be taken into account mainly because of the multi-server nature of a typical SharePoint Farm. You must also be aware of the volume of content that you are storing in cache and make sure that this is not presenting the very same performance problems you are trying to prevent. Performance is always a trade-off and&nbsp; Knowledge of your application along with testing are the only ways to legitimately tune everything appropriately.</p>
<p>&nbsp;</p>
<h2><strong>Final Recommendations</strong></h2>
<p>So what is the right answer? Like so many things in SharePoint, the answer is inevitably it depends, or perhaps the answer is really a combination of these options. Global items should go into the hierarchical object storage or a property bag scoped to the farm or Web application. Items scoped at a lower level should be implemented via a property bag attached to the appropriate item - <code>SPSite</code>, <code>SPWeb</code>, <code>SPList</code>, <code>SPListItem</code>, etc. - or in a SharePoint List. Deciding which option(s) work for your application is a factor of many things, including a degree of personal preference.</p>
<p>Regardless of which option is chosen, a few recommendations can be applied globally:</p>
<ul>
<li>Consider caching frequently-used or expensive-to-retrieve values in memory. Your backend storage is still any one of the options presented here; you just have a mechanism for reducing the performance impact of accessing the values.</li>
<li>It is important that you have a standard mechanism for reading from and writing to the persistent store. Typically this is accomplished by means of a utility class with a bunch of static methods to handle retrieving and storing values. Besides the obvious benefits of this approach, it also allows you to easily change the back end storage without impacting any of the rest of your application. If all your application needs to do is make a call to <code>SettingsManager.GetValue()</code> and pass in the name of the setting value it needs, it doesn't matter whether that value is coming from a SharePoint List, an external database or the hierarchical object storage - the utility class insulates your application from those details.</li>
<li>Similar to above, have a common place where all settings for your application are managed - especially if you are using multiple storage options. Don't force administrators to know where each setting is stored (hierarchical object storage, list, property bag, etc.) to know where they need to go to in order to manage that setting. Have your application do the heavy lifting and pull all of that functionality together in one place for your application.</li>
<li>One final recommendation is to set your standards and stick with them. Few things can make an application seem less professional and less well-thought out than a seemingly arbitrary use of different options for storing configuration settings. Know why you are using each option and make sure that it is consistent with the rest of the options chosen for your environment.</li>
</ul>
<p><strong></strong>&nbsp;</p>
<p><strong>Additional Resources</strong></p>
<p><a title="https://msdn.microsoft.com/en-us/library/ff829215.aspx" href="https://msdn.microsoft.com/en-us/library/ff829215.aspx">https://msdn.microsoft.com/en-us/library/ff829215.aspx</a></p>
<p><a title="&shy;A step by step guide in designing BCS entities by using a SQL stored procedure (Jyoti Saikia)" href="https://blogs.msdn.com/b/sharepointdev/archive/2011/02/10/173-a-step-by-step-guide-in-designing-bcs-entities-by-using-a-sql-stored-procedure.aspx">&shy;A step by step guide in designing BCS entities by using a SQL stored procedure (Jyoti Saikia)</a></p>
<p><a title="https://msdn.microsoft.com/en-us/library/gg552610.aspx" href="https://msdn.microsoft.com/en-us/library/gg552610.aspx">https://msdn.microsoft.com/en-us/library/gg552610.aspx</a></p>
<p>Technologies for Creating SharePoint Applications <a title="https://msdn.microsoft.com/en-us/library/gg454784" href="https://msdn.microsoft.com/en-us/library/gg454784">https://msdn.microsoft.com/en-us/library/gg454784</a></p>
<p>&nbsp;</p>
<p><strong>Updates to this blog, Aug 1, 2012</strong></p>
<p>What about using odc files for your custom apps? Like they do in Excel, read this. &nbsp;<a href="https://blogs.msdn.com/b/sharepointdev/archive/2012/02/09/how-to-programmatically-update-an-odc-file-shubh-raj-singh.aspx">https://blogs.msdn.com/b/sharepointdev/archive/2012/02/09/how-to-programmatically-update-an-odc-file-shubh-raj-singh.aspx</a></p>]]></content:encoded>
    </item>
  </channel>
</rss>