<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>SharePoint; from an Engineer's Perspective</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/ritaylor/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/ritaylor/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 03:47:27 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Dodged a bullet!</title>
      <link>https://docs.microsoft.com/archive/blogs/ritaylor/dodged-a-bullet</link>
      <pubDate>Mon, 06 Nov 2017 00:35:50 GMT</pubDate>
      <dc:creator><![CDATA[Rick Taylor_SLKRCK]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/ritaylor/?p=535</guid>
      <description><![CDATA[Ever get that feeling like everything is going to blow up, where you start thinking it's better to...]]></description>
      <content:encoded><![CDATA[Ever get that feeling like everything is going to blow up, where you start thinking it's better to blow it all away and restore from backup, yada yada yada...but then you have a great idea and save the day?  Smells and feels and tastes SOOOO good, huh?

Here was the scenario:

Customer installs SQL Server on a server and later puts SharePoint 2013 on the same server to "test it out".  Later, SharePoint becomes a "critical" application and needs to be scaled out.  They add a front end and an application server to the farm and remove SharePoint from the SQL Server.  Incidentally, even though the SQL server no longer has SharePoint installed on it, it is still considered "part of the farm".  Now the client needs a third party application (Nintex) installed.  It fails.  Multiple times.  A call to their technical support and a marathon session of 3 hours tells us that "There is an orphaned server and our product is looking for it.  There is an entry in the Config DB referencing this server.  You can go in there and remove it and then try our installation again."    Right.

So when we ran Get-SPDatabase we got a list that looked like this:

<a href="https://msdnshared.blob.core.windows.net/media/2017/11/blog1.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2017/11/blog1.jpg" alt="" width="223" height="96" class="alignnone size-full wp-image-545" /></a>

Yeah...two different names for the SAME server.  Simply removing the server from Central Admin did not remove the names from the databases.  So going into each individual DB and removing the reference to this "other" server wasnt going to work.  So..What if we simply changed the name from one to the other?  In actuality it was the same machine and the databases were intact...so...hmmm?

So here is what we did:

<a href="https://msdnshared.blob.core.windows.net/media/2017/11/blog1b.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2017/11/blog1b-300x139.jpg" alt="" width="475" height="220" class="alignnone wp-image-555" /></a>

After we ran it, we installed the Nintex workflow application and it worked like a charm!]]></content:encoded>
    </item>
    <item>
      <title>Speaking at PowerShell Asia Conference</title>
      <link>https://docs.microsoft.com/archive/blogs/ritaylor/speaking-at-powershell-asia-conference</link>
      <pubDate>Thu, 07 Sep 2017 16:31:37 GMT</pubDate>
      <dc:creator><![CDATA[Rick Taylor_SLKRCK]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/ritaylor/?p=495</guid>
      <description><![CDATA[I will be speaking at the PowerShell Asia Conference 27-28 October 2017.  I am very excited to be...]]></description>
      <content:encoded><![CDATA[I will be speaking at the <a href="http://powershell.asia">PowerShell Asia Conference</a> 27-28 October 2017.  I am very excited to be speaking on the subject of PowerShell for IT Admins in the SharePoint realm.

<a href="https://msdnshared.blob.core.windows.net/media/2017/09/PoShConfAsia.jpg"><img src="https://msdnshared.blob.core.windows.net/media/2017/09/PoShConfAsia-300x128.jpg" alt="" width="563" height="240" class="alignnone  wp-image-505" /></a>]]></content:encoded>
    </item>
    <item>
      <title>European SharePoint Conference</title>
      <link>https://docs.microsoft.com/archive/blogs/ritaylor/european-sharepoint-conference</link>
      <pubDate>Thu, 06 Dec 2012 15:56:39 GMT</pubDate>
      <dc:creator><![CDATA[Rick Taylor_SLKRCK]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/ritaylor/2012/12/06/european-sharepoint-conference/</guid>
      <description><![CDATA[&#160;    I'm honored to be Speaking at the European SharePoint Conference 2013.  I'm speaking at...]]></description>
      <content:encoded><![CDATA[<p>&#160;</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/57/95/metablogapi/1805.EuroSPC_30C5D504.jpg" original-url="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-57-95-metablogapi/1805.EuroSPC_5F00_30C5D504.jpg"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="EuroSPC" border="0" alt="EuroSPC" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/57/95/metablogapi/5224.EuroSPC_thumb_5B320621.jpg" original-url="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-57-95-metablogapi/5224.EuroSPC_5F00_thumb_5F00_5B320621.jpg" width="244" height="110" /></a></p>  <p>I'm honored to be Speaking at the European SharePoint Conference 2013.</p>  <p>I'm speaking at the European SharePoint Conference 2013 and I’m delighted to be a part of this fantastic gathering of the SharePoint Community, Feb 4-7 2013, in Copenhagen, Denmark.</p>  <p>I will be conducting two sessions – “<a href="http://www.sharepointeurope.com/conferences/session/136/sharepoint--adfs--federation-made-easy-">SharePoint &amp; ADFS - Federation Made Easy</a>” and “<a href="http://www.sharepointeurope.com/conferences/session/171/whats-new-with-powershell-v3-for-sharepoint-2013-admins">What's New with Powershell V3 for SharePoint 2013 Admins</a>” both aimed at IT Professionals.</p>  <p>&#160;</p>  <h4><em><font style="font-weight: bold">SharePoint &amp; ADFS - Federation Made Easy </font></em></h4>  <p><em><strong>Supporting authentication and authorization for SharePoint can be challenging, especially if you have partner organizations involved. Claims-based authentication provides you with the ability to authenticate across multiple platforms. Come to this session and learn how the two products come together in order to support federation. </strong></em></p>  <p>&#160;</p>  <h4><em><font style="font-weight: bold">What's New with PowerShell V3 for SharePoint 2013 Admins </font></em></h4>  <p><em><strong>PowerShell made a huge difference in the administration of SharePoint 2010 with the inclusion of the SharePoint Management shell, and now there are over 100 new cmdlets for SharePoint 2013! Come and see the new power that PowerShell offers with the new version of SharePoint.</strong></em></p>  <p>&#160;</p>  <p>I am speaking alongside renowned experts on SharePoint as well as sharing the stage with some of Microsoft's product team from Redmond covering <b>Search</b>,<b> Apps</b>, <b>Social</b>, <b>Cloud</b>,<b> Project</b>, <b>Migration &amp; Upgrade</b>, <b>Governance</b> and <b>much more</b>. </p>  <p>With over 110 SharePoint sessions, keynotes, hands on labs, SharePoint Shootouts, ask the experts, community lounge, tutorials, Europe's largest SharePoint focused expo, SharePints, parties, meetings, networking events, competitions and more....&#160; this is a MUST attend event for all SharePoint enthusiasts! Check out the full Conference Programme to see all sessions and topics that are being covered by myself and many others.</p>  <p>Prices start as low as €995! There is also special <a href="http://www.sharepointeurope.com/attend/group-bookings">group discounts</a> for bookings of 3 or more people.</p>  <p><a href="http://www.sharepointeurope.com/attend/pricing">Book Now</a> and I’ll see you in Copenhagen this February.</p>]]></content:encoded>
    </item>
    <item>
      <title>PowerShell for SharePoint Admins–The REAL Primer–Series #6</title>
      <link>https://docs.microsoft.com/archive/blogs/ritaylor/powershell-for-sharepoint-adminsthe-real-primerseries-6</link>
      <pubDate>Mon, 28 May 2012 14:50:06 GMT</pubDate>
      <dc:creator><![CDATA[Rick Taylor_SLKRCK]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/ritaylor/2012/05/28/powershell-for-sharepoint-adminsthe-real-primerseries-6/</guid>
      <description><![CDATA[This is the sixth entry of my PowerShell for SharePoint Admins series. In this session, we will...]]></description>
      <content:encoded><![CDATA[<p>This is the sixth entry of my <a title="First PowerShell for SharePoint Admins session" href="http://blogs.technet.com/b/ritaylor/archive/2010/02/14/powershell-for-sharepoint-admins-the-real-primer-part-i.aspx" target="_blank">PowerShell for SharePoint Admins series</a>. In this session, we will configure Service Applications with corresponding databases.&#160; I am basing this series on what SharePoint Administrators have said are the most important tasks to accomplish in PowerShell. Here is the list:</p>  <p>&#160;</p>  <ol>   <li>     <h6>Create/Delete Sites, Webs and Web Applications</h6>   </li>    <li>     <h6>Backup and Restore Sites, Webs and Web Applications</h6>   </li>    <li>     <h6>Deploy Solutions and Features</h6>   </li>    <li>     <h6>Add/Delete Users</h6>   </li>    <li>     <h6>Logs</h6>   </li>    <li>     <h6>Configure Service Applications</h6>   </li>    <li>     <h6>Manage Content Databases</h6>   </li>    <li>     <h6>Manage Timer Jobs</h6>   </li>    <li>     <h6>Manage Content Deployment</h6>   </li>    <li>     <h6>Manage Search</h6>   </li> </ol>  <p>&#160;</p>  <h2>SharePoint service applications </h2>  <p>From MSDN: <em>The Service Application Framework provides over 20 services that are built into the core product. For example, SharePoint Search is implemented by Service Application Framework. The Service Application Framework is an API that is provided to build services that are hosted by back-end application servers and consumed by front-end Web servers.&#160; The Service Application Framework replaces the Shared Services Provider in Microsoft Office SharePoint Server 2007. The Service Application Framework model is much more flexible than the Shared Services Provider model. Service applications can be used by a single server farm or shared across farms, allowing centralized shared computing investments. Service Application Framework applications are easily scaled out for load balancing high-demand service applications.</em>&#160; </p>  <p>A good write up on them by Spence Harbar is <a title="SharePoint Service Applications in a Nutshell" href="http://www.harbar.net/articles/sp2010sa2.aspx" target="_blank">here</a>; or you could also watch my video on them <a title="Understanding the Service Applications of SharePoint 2010" href="http://technet.microsoft.com/en-us/video/Video/ff711423" target="_blank">HERE</a>. </p>  <p>Although neither of the previous links go into the installation and configuration at all, they do give a good overview of what they are and how they are implemented.&#160; In this session we will install and configure them using PowerShell.</p>  <h2>Scripting Hygiene</h2>  <p>So, when I was learning scripting for the first time WAY WAY back in the 80s…the thing that helped me most was understanding what it was that I was trying to do and then mapping out the steps to get there.&#160; The class I had asked us to write a script that had a figure get in and out of a car.&#160; It taught us how to think methodically.&#160; So in this session, we will look at the step by step process and write the corresponding script to get ‘er done.&#160; Sound like a plan?&#160; Let’s start:</p>  <p>When you start out writing PowerShell script (or anything) you should know that documenting is IMPORTANT.&#160; Making comments in your code will not only help others who are reading your script, but also YOU who will eventually update it and wonder what you were thinking when you wrote a certain line or section.&#160; So what I would suggest is start out in the PowerShell_ISE (or whatever IDE editor you want – I like <a title="NotePad ++ Editor download" href="http://notepad-plus-plus.org/" target="_blank">NotePad++</a>) and use the comment symbol ‘#’ to comment about what you are about to do. </p>  <p>So let’s start off with stating what this script does.&#160; type the following into your editor.</p>  <p><font color="#008000" size="2" face="Consolas"># This script configures the Microsoft Managed Metadata Service Application</font></p>  <p>The absolute next thing you want to do is make sure that the PowerShell snapin is loaded (unless you are using the PowerShell_ISE that we configured to automatically load it—but we’ll handle it even if it is).&#160; So skip a couple of lines down in your script and type the following:</p>  <p><font size="2" face="Consolas"><strong>Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue</strong></font></p>  <p>We added the parameter that will allow PowerShell to ignore the issue if the snapin is already loaded (-erroraction SilentlyContinue)</p>  <p>Now we want to add our variables for PowerShell to refer to in our script.&#160; These variables are things such as server names, database names, application pool names, etc. so that we don’t have to keep typing them in over and over again.&#160; Type the following a couple of lines below the last line you typed:</p>  <pre class="csharpcode"><span class="rem">#Variables</span>

$databaseServerName = SQL1
$AppPoolName = “AppPoolName”
$AppPoolUserAcct = “domain\appPoolAcct”
$ManagedMetadataName = “Managed Metadata Service Application”</pre>


<p>OK, so now we’ve defined the variables.&#160; Now we start writing the cmdlets that will configure the Service app.&#160; We will group some of the cmdlets in between the&#160; <strong>{ } </strong>symbols.&#160; Here are the next lines:</p>

<pre class="csharpcode"><strong>$AppPool = Get-SPServiceApplicationPool –Identity $AppPoolName

{

     $AppPoolAcct = Get-SPManagedAccount –Identity $AppPoolUserAcct

{ 
      Write-Host <span class="str">&quot;Please supply the password for the Service Account...&quot;</span>
      $appPoolCred = Get-Credential $appPoolUserName
      $appPoolAccount = New-SPManagedAccount -Credential $appPoolCred  
  } 
  
      $appPoolAccount = Get-SPManagedAccount -Identity $appPoolUserName 
  
      <span class="kwrd">if</span>($appPoolAccount <span class="preproc">-eq</span> $null) 

      { 
          Write-Host <span class="str">&quot;Cannot create or find the managed account <br clear="all" />$appPoolUserName, please ensure the account exists.&quot;</span>
    Exit -1 
  } 
  
  New-SPServiceApplicationPool -Name $saAppPoolName -Account <br clear="all" />$appPoolAccount       
}</strong> </pre>


<p>&#160;</p>

<p>WHOA!&#160; I threw a couple of new things in here.&#160; Let’s talk about them.&#160; First I threw the Write-Host cmdlet.&#160; All that does is put whatever follows in quotes on the screen; kinda like ECHO.&#160;&#160; The other thing I threw at you was the IF statement.&#160; The way IF statements work is when you want the script to do something on the condition that something else is in place (or not).&#160; In this script, we are telling the script that “If the application Pool account is blank….” (-eq $null means “Blank”) then what you do is to open a { symbol and put in what you want to happen.&#160; In this case we want PoSh to print out on screen “Cannot create or find …..” and then to exit out.&#160; That’s it.</p>

<p>OK, so what’s next?&#160; We have set our variables, told PoSh to create an application pool for the service using a managed account and now its time to set the Proxy. </p>

<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 700px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">Write-Host &quot;Creating Metadata Service and Proxy...&quot;
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">New-SPMetadataServiceApplication -Name $ManagedMetadataName -ApplicationPool $saAppPoolName -DatabaseServer $databaseServerName -DatabaseName&quot;MetadataDB&quot;
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">New-SPMetadataServiceApplicationProxy -Name &quot;$ManagedMetadataName Proxy&quot;-DefaultProxyGroup -ServiceApplication $ManagedMetadataName
</pre><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">Get-SPServiceInstance | where-object {$_.TypeName -eq &quot;Managed Metadata Web Service&quot;} | Start-SPServiceInstance</pre></pre>


<p>Next, you save the file as ManagedMetadata.ps1 and you’re done!</p>

<p>In our next session, we will get down and do some security stuff – Adding/Editing Users and Groups!</p>]]></content:encoded>
    </item>
    <item>
      <title>PowerShell for SharePoint Admins–The REAL Primer–Series #5</title>
      <link>https://docs.microsoft.com/archive/blogs/ritaylor/powershell-for-sharepoint-adminsthe-real-primerseries-5</link>
      <pubDate>Sat, 19 May 2012 19:34:21 GMT</pubDate>
      <dc:creator><![CDATA[Rick Taylor_SLKRCK]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/ritaylor/2012/05/19/powershell-for-sharepoint-adminsthe-real-primerseries-5/</guid>
      <description><![CDATA[This is the fifth entry of my PowerShell for SharePoint Admins series.&#160; In this session we will...]]></description>
      <content:encoded><![CDATA[<div class="wlWriterHeaderFooter" style="float:none; margin:0px; padding:4px 0px 4px 0px;"><iframe src="http://www.facebook.com/widgets/like.php?href=http://blogs.technet.com/b/ritaylor/archive/2012/05/19/powershell-for-sharepoint-admins-the-real-primer-series-5.aspx" scrolling="no" frameborder="0" style="border:none; width:450px; height:80px"></iframe></div><p><font size="2">This is the fifth entry of my PowerShell for SharePoint Admins series.&#160; In this session <font size="2">we will learn some PowerShell cmdlets that will give us some flexibility in being able to accomplish the Top Ten things for which SharePoint Admins use PowerShell .&#160; </font>I am basing this series on what SharePoint Administrators have said are the most important tasks to accomplish in PowerShell.&#160; Here is the list:</font></p>  <ol>   <li>     <h6><font size="2">Create/Delete Sites, Webs and Web Applications</font></h6>   </li>    <li>     <h6><font size="2">Backup and Restore Sites, Webs and Web Applications</font></h6>   </li>    <li>     <h6><font size="2">Deploy Solutions and Features</font></h6>   </li>    <li>     <h6><font size="2">Add/Delete Users</font></h6>   </li>    <li>     <h6><font size="2">Logs</font></h6>   </li>    <li>     <h6><font size="2">Configure Service Applications</font></h6>   </li>    <li>     <h6><font size="2">Manage Content Databases</font></h6>   </li>    <li>     <h6><font size="2">Manage Timer Jobs</font></h6>   </li>    <li>     <h6><font size="2">Manage Content Deployment</font></h6>   </li>    <li>     <h6><font size="2">Manage Search</font></h6>   </li> </ol>  <p><font size="2">In this session, as all the previous sessions,&#160; we are continuing on in our quest to become proficient in this shell language.&#160; We need to understand some of the “funny” symbols and stuff (remember, we’re OSITA’s and don’t want nuthin’ to do with “Codin’”) ---sigh…it’ll be OK, I promise.</font></p>  <h3>Symbols</h3>  <p><font size="2">Most of the symbols used in PowerShell you’ve seen before and aren’t that new.&#160; Some will be new, but I will attempt to make it as painless as possible.</font></p>  <p><font size="2"><strong>! </strong>= NOT.&#160; As in, if you see this symbol before something, it means NO/NOT/Does not exist.&#160; Where would you see this?&#160; Examine the following line:</font></p>  <pre class="csharpcode"><strong>(!(Test-Path $profile.AllUsersAllHosts))</strong></pre>

<pre class="csharpcode"><strong></strong><font face="Times New Roman">This would read (in English) = If the “All Users All Hosts” profile directory does NOT exist….that’s all that means.</font></pre>

<pre class="csharpcode"><font face="Times New Roman">Next:</font></pre>

<pre class="csharpcode"><font face="Times New Roman"><strong>{ or }</strong> = block of stuff.  More or less.  When you want PowerShell to treat something as a whole. </font></pre>

<pre class="csharpcode"><font face="Times New Roman">Here is an example:  </font></pre>

<pre class="csharpcode"><strong>C:\&gt; Get-SPWeb http://portal/* | where {$_.MasterUrl <span class="preproc">-like</span> “*/v4.master”}</strong></pre>


<p><font size="2">OOH…I slipped two on you that time!&#160; I will explain both the <strong>{}</strong> (called curly braces) and the<strong> |</strong> (called a pipe).</font></p>

<p><font size="2">In English the line above says, get all the sites (not site collections) that start with the URL <strong>http://portal/*</strong> (That is the Get-SPWeb)&#160; and then when that is done (that is where the pipe (|) comes in), show wherever there are those that are using the v4.master page to me.</font></p>

<p><font size="2">Next:</font></p>

<p><font size="2"><strong>$ </strong>= variable.&#160; This is self-explanatory.&#160; Here is an example:</font></p>

<div align="justify">
  <div class="csharpcode">
    <pre><span class="lnum">   1:  </span>$SiteName = <span class="str">&quot;Slick Rick's Site&quot;</span> </pre>

    <pre><span class="lnum">   2:  </span>$SiteUrl = <span class="str">&quot;http://intranet.osita.com/sites/&quot;</span> + $SiteName   </pre>

    <pre><span class="lnum">   3:  </span>$NewSite = New-SPSite –URL   </pre>

    <pre><span class="lnum">   4:  </span>$SiteUrl -OwnerAlias Administrator -Template STS<span class="rem"><font color="#000000">#0 –Name $SiteName</font>  </span></pre>

    <pre><span class="lnum">   5:  </span>$RootWeb = $NewSite.RootWeb</pre>

    <pre><span class="lnum">   6:  </span>$RootWeb.Title = <span class="str">&quot;Slick Rick's Site: &quot;</span> + $SiteName</pre>

    <pre>   <font color="#666666">7:</font>  $RootWeb.Update()</pre>

    <pre><span class="lnum">   8:  </span>Write-Host <span class="str">&quot;Site successfully created&quot;</span></pre>
  </div>
  </div>
<font size="2" face="Consolas"></font>

<div align="justify">
  <pre class="csharpcode"><font face="Times New Roman">So what we have above is this: We are creating a variable named $SiteName and giving it the name “Slick Rick’s Site”.  So everywhere you see $SiteName, PoSh will stick in “Slick Rick’s Site”.  Follow that logic for each of the lines that begin with ‘$’.  Line 3 is a little different in that it is saying that the cmdlet “New-SPSite” will be substituted for $NewSite.  So you can see that even cmdlets/commands/actions can be used in variables.</font></pre>
</div>

<div align="justify">
  <h3>Pulling it all together</h3>

  <pre class="csharpcode"><font face="Times New Roman">OK, so now is your test.  Jeapordy-style.  I will give you the answer and then you will give me the question: </font></pre>

  <pre class="csharpcode"><font face="Times New Roman">“This script means:  If there is no entry for $FarmPassphrase or if the entry for $FarmPassphrase is blank, tell the user to enter one.</font></pre>

  <pre class="csharpcode"><em><strong>start-Music.Jeopardy
{
start-sleep 30
} 
stop-Music.Jeopardy</strong></em></pre>
  

  <pre class="csharpcode"><font face="Times New Roman">OK! The Question is:</font></pre>

  <pre class="csharpcode"><font face="Times New Roman"><strong>What does the following line of script mean?</strong></font></pre>
</div>

<div align="justify">
  <pre class="csharpcode"><strong>If (!($FarmPassphrase) -or ($FarmPassphrase -eq <span class="str">&quot;&quot;</span>))</strong><pre class="csharpcode"><strong>    {
        Throw <span class="str">&quot; - You must enter a Farm Passphrase&quot;</span>
    }</strong></pre></pre>
</div>

<div align="justify">Did you get it?&#160; If so, YAY!&#160; If not, re-read this post until you understand the concepts.&#160; In the next session, we will configure Service Applications with corresponding databases.</div>]]></content:encoded>
    </item>
    <item>
      <title>PowerShell for SharePoint Admins–The REAL Primer–Series #4</title>
      <link>https://docs.microsoft.com/archive/blogs/ritaylor/powershell-for-sharepoint-adminsthe-real-primerseries-4</link>
      <pubDate>Tue, 16 Aug 2011 20:13:03 GMT</pubDate>
      <dc:creator><![CDATA[Rick Taylor_SLKRCK]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/ritaylor/2011/08/16/powershell-for-sharepoint-adminsthe-real-primerseries-4/</guid>
      <description><![CDATA[This is the fourth entry of my PowerShell for SharePoint Admins series.&#160; I am basing this...]]></description>
      <content:encoded><![CDATA[<div class="wlWriterHeaderFooter" style="float:none; margin:0px; padding:4px 0px 4px 0px;"><iframe src="http://www.facebook.com/widgets/like.php?href=http://blogs.technet.com/b/ritaylor/archive/2011/08/16/powershell-for-sharepoint-admins-the-real-primer-series-4.aspx" scrolling="no" frameborder="0" style="border:none; width:450px; height:80px"></iframe></div><p><font size="2">This is the fourth entry of my PowerShell for SharePoint Admins series.&#160; I am basing this series on what SharePoint Administrators have said are the most important tasks to accomplish in PowerShell.&#160; Here is the list:</font></p>  <ol>   <li>     <h6>Create/Delete Sites, Webs and Web Applications</h6>   </li>    <li>     <h6>Backup and Restore Sites, Webs and Web Applications</h6>   </li>    <li>     <h6>Deploy Solutions and Features</h6>   </li>    <li>     <h6>Add/Delete Users</h6>   </li>    <li>     <h6>Logs</h6>   </li>    <li>     <h6>Configure Service Applications</h6>   </li>    <li>     <h6>Manage Content Databases</h6>   </li>    <li>     <h6>Manage Timer Jobs</h6>   </li>    <li>     <h6>Manage Content Deployment</h6>   </li>    <li>     <h6>Manage Search</h6>   </li> </ol>  <p><font size="2">In this session we are continuing on in our quest to become proficient in this shell language.&#160; So now that we’ve created a SharePoint site in our last </font><a title="Real Primer Part 3" href="http://blogs.technet.com/b/ritaylor/archive/2011/08/07/powershell-for-sharepoint-admins-the-real-primer-part-3.aspx" target="_blank"><font size="2">session</font></a><font size="2">, we need to do what every responsible administrator should do: back it up.&#160; Now HERE is where there is no denying that PowerShell is the way to go.&#160; Even for us OSITAs…you *can’t* say that PowerShell in this case isn’t the preferred method (well, you *could*, but you’d be lying).</font> </p>  <p><font size="2">Let’s bring up the site:</font></p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/57/95/metablogapi/6545.image_0EF88C6B.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-57-95-metablogapi/6545.image_5F00_0EF88C6B.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/57/95/metablogapi/8524.image_thumb_71568B9E.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-57-95-metablogapi/8524.image_5F00_thumb_5F00_71568B9E.png" width="798" height="232" /></a></p>  <p><font size="2">Let’s add a doc to the default ‘Shared Documents’ document library.&#160; </font></p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/57/95/metablogapi/6471.image_2058C776.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-57-95-metablogapi/6471.image_5F00_2058C776.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/57/95/metablogapi/8117.image_thumb_45E244D7.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-57-95-metablogapi/8117.image_5F00_thumb_5F00_45E244D7.png" width="700" height="326" /></a></p>  <p>So to back up our site type the following in our pretty blue PowerShell prompt and type the word back and try that cool trick we did last time (hit the tab key) and you should see this:</p>  <p>&#160;</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/57/95/metablogapi/4403.image_1D6362C3.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-57-95-metablogapi/4403.image_5F00_1D6362C3.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/57/95/metablogapi/3326.image_thumb_7CDC2310.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-57-95-metablogapi/3326.image_5F00_thumb_5F00_7CDC2310.png" width="598" height="162" /></a></p>  <p><font size="2">Nice; but we don’t want to back up the configuration database, so hit the tab key again.&#160; hmmm..SPFarm…no, hit the tab key again.&#160; YEAH!!&#160; Now we’re talking!&#160; The command should now say Backup-SPSite.&#160; Now we want to back it up to a folder somewhere.&#160; Since all we have is one doc (and this is a demo) let’s save it the c:\temp directory.&#160; Normally we would have network share where we store our backups, right?&#160; RIGHT?</font></p>  <p><font size="2">Ok, so now you have Backup-SPSite, hit the space bar and then hyphen and hit the tab key.&#160; Identity?&#160; Yeah, its asking for the URL.&#160; So in our case type in the url WITH the port number.&#160; Then you will hit the space bar and then type a hyphen and the tab key until it asks for PATH.&#160; Type in c:\temp\osita.bak .&#160; So now you should be ready and the entire command should look like this:</font></p>  <table border="1"><tbody>     <tr>       <td>         <pre><font size="2">Backup-SPSite -Identity http://osita.com:8080 -Path c:\temp\osita.bak</font></pre>
      </td>
    </tr>
  </tbody></table>

<p><font size="2">Yes, there are a lot more parameters that we could use, but we will get to that later in the series.&#160; Right now just hit ENTER.&#160; Wait for it…and it’s done.&#160; OK now we can get crazy! How crazy?&#160; Delete the site.&#160; Yup…and you know what?&#160; Do it from the GUI…go ahead, I’ll let you digress and use the GUI this ONE time.&#160; There, feel better? </font></p>

<p><font size="2">OK, so now from the pretty blue PowerShell prompt, type Get-SPDeletedSite and hit enter.&#160; You should see something like this:</font></p>

<p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/57/95/metablogapi/3817.image_6307ECE1.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-57-95-metablogapi/3817.image_5F00_6307ECE1.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/57/95/metablogapi/4401.image_thumb_2265A072.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-57-95-metablogapi/4401.image_5F00_thumb_5F00_2265A072.png" width="603" height="186" /></a></p>

<p><font size="2">Now..if PowerShell gives you grief—it’s probably because you have upgraded to SP1 yet.&#160; This command is new with SharePoint SP1.&#160; So—for those of you who haven’t yet deployed SP1, sit back for a bit—don’t worry, we’ll restore your site using a cmdlet that you can use—just hold tight and watch some cool stuff here..</font></p>

<p><font size="2">OK, you see all those GUIDs?&#160; You will need to pay attention to the SiteID one.&#160; SharePoint kept track of all of the site collections we deleted (well, in our case just one).&#160; Now type the following command and hit enter and then ‘Y’ to confirm:</font></p>

<pre class="csharpcode">Restore-SPDeletedSite /</pre>


<p><font size="2">And voila!&#160; Your site was restored.&#160; Was that cool, or what?&#160; I know…you’re saying “Why did you want me to pay attention to the SiteID if I wasn’t going to need it?”&#160; You will in a minute but first let’s bring back our friends who have yet to plunge into the goodness that is SP1.&#160; OK, Pre-SP1 people—are you ready? At the prompt type the following command below, BUT DON’T HIT ENTER!!:</font></p>

<p>&#160;</p>

<table border="1"><tbody>
    <tr>
      <td>
        <pre><font size="2">restore-spsite -Identity http://osita.com:8080 -Path c:\temp\osita.bak -Force -Confirm:$false</font></pre>
      </td>
    </tr>
  </tbody></table>

<p>&#160;</p>

<p><font size="2">Let’s walk through this:&#160; the <strong>restore-spsite</strong> piece you should understand by now.&#160; <strong>-Identity</strong> is telling PowerShell what name of the URL (later I’ll show you how to change the name of a site), <strong>–Path</strong> is telling PowerShell from where to get the backup file, <strong>–force</strong> is saying “I don’t care if there is a lock or not on the db (there isn’t), just do it”, and the almighty <strong>–Confirm</strong> which I added a <strong><em>:$false</em></strong> which is telling PowerShell, “Do not ask me if I am sure that I want to do this; I am!”</font></p>

<p><font size="2">NOW hit Enter.</font></p>

<p><font size="2">OK…for those without SP1, now would be a good time to upgrade.&#160; I don’t want to have to type in separate instructions depending on version.&#160; What do you think this is, TechNet?</font></p>

<p><font size="2">Now let’s *<strong>suppose</strong>* that you wanted to remove EVERYTHING: Web Application, Content Database, IIS Web Site, the whole shebang.&#160; OK—so here is what you would type:</font></p>

<table border="1"><tbody>
    <tr>
      <td>
        <pre><font size="2">Remove-SPWebApplication -Identity http://osita.com:8080 -RemoveContentDatabases -DeleteIISSite -Confirm:$false</font></pre>
      </td>
    </tr>
  </tbody></table>

<p>&#160;</p>

<p><font size="2">Let’s walk through this: Remove-SPWebApplication –Identity is self-explanatory.&#160; Now there is another parameter that they *say* is required that is not in the above command---Zone.&#160; Had I had another URL in another zone with the same name (which could happen if I needed it for multiple auth, for instance), it would have deleted THAT one, too.&#160; In this case we only had one in the Internet Zone.&#160; So best practice would be to SPECIFY the Zone in your command.&#160; The –RemoveContentDatabases –DeleteIISSite is also self-explanatory.&#160; You already learned –Confirm:$false…look at THAT!&#160; You are already becoming an expert! &lt;sniff, sniff&gt; I’m so proud of you…</font></p>

<p><font size="2">For our next session we will learn some PowerShell cmdlets that will give us some flexibility in being able to accomplish the Top Ten things SharePoint Admins use PowerShell for.&#160; Stay tuned.</font></p>

<p><font size="2">&#160;</font></p>]]></content:encoded>
    </item>
    <item>
      <title>PowerShell for SharePoint Admins–The REAL Primer–Part 3</title>
      <link>https://docs.microsoft.com/archive/blogs/ritaylor/powershell-for-sharepoint-adminsthe-real-primerpart-3</link>
      <pubDate>Sun, 07 Aug 2011 23:48:54 GMT</pubDate>
      <dc:creator><![CDATA[Rick Taylor_SLKRCK]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/ritaylor/2011/08/07/powershell-for-sharepoint-adminsthe-real-primerpart-3/</guid>
      <description><![CDATA[I gave a talk last weekend at SharePoint Saturday NYC and took a poll. I asked the audience what...]]></description>
      <content:encoded><![CDATA[<p>I gave a talk last weekend at SharePoint Saturday NYC and took a poll. I asked the audience what were the 10 most common things SharePoint Administrators did in their jobs. Here is the list:</p>  <ol>   <li>     <h4><font size="2">Create/Delete Sites, Webs and Web Applications</font></h4>   </li>    <li>     <h4><font size="2">Backup and Restore Sites, Webs and Web Applications</font></h4>   </li>    <li>     <h4><font size="2">Deploy Solutions and Features</font></h4>   </li>    <li>     <h4><font size="2">Add/Delete Users</font></h4>   </li>    <li>     <h4><font size="2">Logs</font></h4>   </li>    <li>     <h4><font size="2">Configure Service Applications</font></h4>   </li>    <li>     <h4><font size="2">Manage Content Databases</font></h4>   </li>    <li>     <h4><font size="2">Manage Timer Jobs</font></h4>   </li>    <li>     <h4><font size="2">Manage Content Deployment</font></h4>   </li>    <li>     <h4><font size="2">Manage Search</font></h4>   </li> </ol>  <p>Oh and before I forget, my slide deck is posted <a href="http://www.slideshare.net/rickt287/powershell-for-sharepoint-admins" target="_blank">here on SlideShare</a>.</p>  <p>OK, so just so you know—blogging faithfully is a challenge for me; I will simply start a series. I thought that Part 3 was going to be the final piece but I can’t see doing the Top 10 all in one post—I just cant do that and post frequently, SO—I will devote a post each week to each of the Top 10.&#160; </p>  <p>We are going to create a Web Application to house a site collection that will have a site which will house an external list (yup we will provision BCS using PowerShell—fun, fun). We will back it up, delete it, then restore it (all using PowerShell), install and deploy a feature, add a user, move the site from one content database to another, and much much more.</p>  <p>So as an OSITA (Old School IT Admin), this can seem like a tall order; almost a reason NOT to want to use PowerShell because, well…I HATE coding or having to learn how to do ALL THAT at the command line. Well, don’t fret my fellow Admins—it’s not THAT BAD—actually not bad at all. I promise you, once you learn a few things it will become second nature to you, just like typing CLS to clear the screen or DIR to get the directory.</p>  <h5>Create/Delete Sites, Webs and Web Applications</h5>  <p>Yes, you can.&#160; You can create a site via Central Admin and you ask “So why would I ever use PowerShell to create a site?”&#160; I can think of two reasons: a) you can’t get to CA for some unknown reason or b) you try and it doesn’t work.&#160; Let me give you a couple of scenarios:</p>  <p>You are a SharePoint admin and you need to create a site for a group that is impatient.&#160; From the time you receive the request they are knocking on your door (like you don’t have a million other things to do) and so you say, fine—how long can this take?&#160; You type in the URL for Central Admin and it churns….and churns…hmmm, you say..that’s strange.&#160; You close the browser and try again.&#160; Nada.&#160; hmmm..you RDP into the server and try from there.&#160; 503 error.&#160; You go to IIS and see what’s up and the phone rings “Is it done yet?”&#160; </p>  <p>It probably took you 30 sec or less just to read the above paragraph, but it would have taken you much longer to actually do what the paragraph says.&#160; In that same amount of time you could have simply typed a simple cmdlet and been done with it.</p>  <p>Here’s the second scenario:&#160; You are a SharePoint admin and you need to create a site for a group that is impatient.&#160; Same thing…except CA works, but when you try to create the site, it fails.&#160; Multiple times.&#160; Multiple templates.&#160;&#160; Ok, so let’s say that for some reason the Timer Job Service is off and won’t turn back on.&#160; What do you do?&#160; You could spend time on working on that while the group keeps calling you or knocking on your door OR you could simply type a simple cmdlet and be done with it.</p>  <p>You see what I’m getting at?&#160; PowerShell will save you TONS of time and it’s SIMPLE.&#160; Especially creating sites.&#160; Here is how you do it:</p>  <p>Go to the run command and type PowerShell.&#160; OOOH, what a lovely blue background (for those who read and followed the previous post).</p>  <p>We will create a web application to host our site collection.&#160; Let’s call our Web Application OSITA.com.&#160; (If you are following this post by doing the exercises, make sure you put an entry in your hosts file so that this works).</p>  <h6>Cool Tricks</h6>  <p>So at the PowerShell prompt, type:&#160; New-SPWeb and hit the TAB key until the entire cmdlet reads: New-SPWebApplication.&#160; Then put a space after it, type a hyphen and hit the TAB key once more.&#160; What you should now see is the following:</p>  <table border="1"><tbody>     <tr>       <td>         <pre>New-SPWebApplication -Name</pre>
      </td>
    </tr>
  </tbody></table>

<p>What this cool little trick does is help you put in the information that you need to make the script run without errors.&#160; So, type in the name of the Web Application as “OSITA”, then type a space and a hyphen and hit the TAB key two times.&#160; It should now ask for the Application Pool.&#160; Let’s say OSITAAppPool.&#160; So now the line should look like this:</p>

<table border="1"><tbody>
    <tr>
      <td>
        <pre>New-SPWebApplication -Name OSITA -ApplicationPool OSITAAppPool</pre>
      </td>
    </tr>
  </tbody></table>

<p>I can tell you’re liking this TAB key thing, huh?&#160; You just keep hitting the TAB key to cycle through the various parameters and typing in the values. The parameters you really want to use in this example are the following:</p>

<p>-Name “OSITA”</p>

<p>-ApplicationPool “OSITAAppPool”</p>

<p>-Port “8080”</p>

<p>-ApplicationPoolAccount “&lt;your app Pool account&gt;”</p>

<p>-URL “http://osita.com”</p>

<p>When all those (and only those) parameters are typed in hit ENTER and it will churn for a little bit.&#160; When it is all done you should get a display similar to the following:</p>

<table border="1"><tbody>
    <tr>
      <td>
        <pre>DisplayName                    Url
-----------                    ---
OSITA                          http://osita.com:8080/</pre>
      </td>
    </tr>
  </tbody></table>

<p>&#160;</p>

<p>Now we are going to create a root site collection in this web application to use.&#160; Let’s keep the name the same. Remember to keep everything in quotes.&#160; Here is the list of parameters—I will let you type it all in using the TAB key trick I taught you above:</p>

<p>-Name “My First PoSH Site”</p>

<p>-URL “http://osita.com:8080”</p>

<p>-Template STS#0 (NOTE:&#160; This does NOT go in quotes—this template is the Team Site Template, more on those later)</p>

<p>-OwnerAlias “&lt;your_domain\your_username&gt;”</p>

<p>-Description “Slick Rick taught me how to use PowerShell to create this site”</p>

<p>-Confirm:$false (Type that in exactly as you see it.&#160;&#160; This will keep the prompt from asking you “Are you sure?”</p>

<p>OK, so for those of you who want a *picture* here it is:</p>

<table border="1"><tbody>
    <tr>
      <td>
        <pre>New-SPSite -Url &quot;http://osita.com:8080&quot; -Template STS#0 -Name &quot;My First PoSH Site&quot; -Description &quot;Slick Rick taught me how to use PowerShell to create this site&quot; -OwnerAlias &quot;mcc\rtaylor&quot; -Confirm:$false</pre>
      </td>
    </tr>
  </tbody></table>

<p>Now hit enter.&#160; It will churn and then you’ll get the lovely confirmation that your site is now created.&#160; But did it *really* work?&#160; Open up a browser and type in the URL (including the port number) and see.</p>

<p>It should prompt you for credentials and after you do that….voila!&#160; How cool is *THAT*!?&#160; You’ve done it!&#160; I recommend doing another and another until you are confident you have it down to a science.&#160; </p>

<p>Next week: We’ll back up our site, delete it and then restore it.</p>]]></content:encoded>
    </item>
    <item>
      <title>PowerShell for SharePoint Admins – The REAL primer PART 2</title>
      <link>https://docs.microsoft.com/archive/blogs/ritaylor/powershell-for-sharepoint-admins-the-real-primer-part-2</link>
      <pubDate>Tue, 02 Aug 2011 04:57:35 GMT</pubDate>
      <dc:creator><![CDATA[Rick Taylor_SLKRCK]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/ritaylor/2011/08/02/powershell-for-sharepoint-admins-the-real-primer-part-2/</guid>
      <description><![CDATA[&#160;  OK, so why haven’t I posted the second part in so long?&#160; LIFE.&#160; No other...]]></description>
      <content:encoded><![CDATA[<p>&#160;</p>  <p>OK, so why haven’t I posted the second part in so long?&#160; LIFE.&#160; No other reason.&#160; So—on to the next part:</p>  <p>In Part I I told you that aliases were important and we wanted to make sure we didn’t have to remember what they were and to make them specific. OK, so that means we have to learn a little about PowerShell profiles.</p>  <h1>Profiles</h1>  <h4>So what is a PowerShell profile? </h4>  <p>The PowerShell profile is a text file that has a .ps1 extension. The extension is looked at by PowerShell as a script and the text in the script tells PowerShell how to act. In this file it will tell PowerShell what aliases it should remember, what snap-ins to load, what colors to use, etc.</p>  <p>OK, now to confuse you a little bit—there are four of these profiles. Here they are, what they are, and where they are located: </p>  <p>a. All Users Profile – This profile is located in the windows directory\system32\WindowsPowerShell\v1.0\profile.ps1. This one is the profile that gets loaded when anyone invokes PowerShell.</p>  <p>b. All Users Host Profile – This profile is located in the windows directory\system32\WindowsPowerShell\v1.0\Microsoft.PowerShell_profile.ps1. This is the profile that gets loaded when anyone using a particular shell environment invokes PowerShell. Think of this one as the profile that pertains to the machine regardless of user.</p>  <p>c. Current User Profile – This profile is located in the %userprofile%\Documents\WindowsPowerShell\profile.ps1. This is the profile that gets loaded by the current logged on user that invokes PowerShell.</p>  <p>d. Current User’s Host Profile – This profile is located in the %userprofile%\Documents\WindowsPowerShell\Microsoft.Powershell.ps1. This is the profile that gets loaded when a user invokes PowerShell on a specific machine. Think of this one as the profile that pertains Shell environment on a machine but is specific to the particular user that invoked PowerShell.</p>  <p>Why is that all important? Well, you need to know which profile to change if you want to be able to benefit from the change. if I want a change to be “Global”, I need to update *all four* of the profiles.</p>  <p>Configuring my PowerShell environment</p>  <p>I want to make sure of at least three things when I enter the PowerShell world: that I have blue background with yellow lettering, that my aliases that I set up are loaded and that the PowerShell snap-ins are loaded for SharePoint. So how would I do that? Here is how:</p>  <p>First thing is to find out where your profile is. Go to the PowerShell command prompt and type $profile. It will give you an output of %userprofile%\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 . Now attempt to go to that location; what do you see? Nada. Nothing. Zilch. Goose egg. Now type this at the prompt: ‘</p>  <pre class="csharpcode">Test-Path $profile</pre>


<p>The output will be ‘FALSE’. So in order to “see” the path and the profile script that PowerShell is reading from type the following:</p>

<pre class="csharpcode">New-Item -path $profile -type file –force</pre>


<p>The output will be</p>

<table border="1"><tbody>
    <tr>
      <td>
        <pre>Mode                LastWriteTime     Length Name
----                -------------     ------ ----
-a---          8/5/2011  12:59 PM          0 Microsoft.PowerShell_profile.ps1</pre>
      </td>
    </tr>
  </tbody></table>

<p>Now if you were to attempt to browse to the path, you would see it. Cool, huh? OK, before we go any further, let’s make sure our envrionment is set up to change the contents of this file. If you are on a Windows 7 machine, you are already good to go, but if you are on Windows Server 2008 R2, you will need to type this command in the console:</p>

<pre class="csharpcode">Import-Module ServerManager;Add-WindowsFeature PowerShell-ISE</pre>


<p>After running those commands you should see the PowerShell ISE option as in the following diagram:</p>

<p><a href="http://mikefrobbins.files.wordpress.com/2011/06/ise3.png"><img title="ise3" alt="" src="http://mikefrobbins.files.wordpress.com/2011/06/ise3.png?w=224&amp;h=451" width="224" height="451" /></a></p>

<p>You will also see the following diagram if you were to right-click on the PowerShell icon on the taskbar:</p>

<p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/57/95/metablogapi/4064.image_5C71C424.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-57-95-metablogapi/4064.image_5F00_5C71C424.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/57/95/metablogapi/6116.image_thumb_16ECC3F9.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-57-95-metablogapi/6116.image_5F00_thumb_5F00_16ECC3F9.png" width="244" height="227" /></a></p>

<p>OK, now right-click the file profile.ps1 script and click OPEN. This will open the PowerShell ISE you will notice that it is empty. This means that PowerShell will simply load into memory and display the console. But we want to make it behave in a certain way, remember? So—let’s do that—first we want to make sure that the SharePoint snap-ins get loaded every time so that we don’t have to type in that long command that we can never remember. So in the script type the following:</p>

<pre class="csharpcode">Add-PSSnapin.Microsoft.SharePoint.PowerShell</pre>


<p>It should look like the following</p>

<p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/57/95/metablogapi/7612.image_6E6DE1E4.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-57-95-metablogapi/7612.image_5F00_6E6DE1E4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/57/95/metablogapi/5557.image_thumb_5837C692.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-57-95-metablogapi/5557.image_5F00_thumb_5F00_5837C692.png" width="684" height="517" /></a></p>

<p>Then click the green ‘RUN’ icon. It shouldn’t give you any errors, just load the snap-in for SharePoint. OK, now minimize this window and go back to the PowerShell console. </p>

<p>It’s just black with white text. You may like this—I don’t; and besides this will be good practice for you. (YES YES, I *KNOW* you can change all of that by right-clicking on the menu bar, yada yada—but you will thank me later for this)</p>

<p>Now, type Get-Host and click Enter. The output will look something like this:</p>

<table border="1" width="675"><tbody>
    <tr>
      <td width="673">
        <pre>Name             : Windows PowerShell ISE Host
Version          : 2.0
InstanceId       : e9c2a9ca-9ea3-4887-9067-f2e111b9db64
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterfaceCurrentCulture   : en-US
CurrentUICulture : en-US
PrivateData      : Microsoft.PowerShell.Host.ISE.ISEOptions
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace</pre>
      </td>
    </tr>
  </tbody></table>

<p>OK, so we are looking at the UI property. This is what we want to change from the default to a blue background with yellow letters. How do we do that? Well let’s talk through it-- we know that we have to invoke the ‘Get-Host’ cmdlet and we have to address the property UI. There is a property *inside* of UI that talks to the colors and its name is RawUI. To find out what we are currently using we need to invoke that property. So— at the run command type Powershell, and then type the following:</p>

<pre class="csharpcode">(Get-Host).UI.RawUI </pre>

<p>Remember to use the parentheses here around Get-Host, or you will get an error message. The reason is that you first want PowerShell to get the local environment and then give you the properties. When you hit enter, you will see something like this:</p>

<table border="1"><tbody>
    <tr>
      <td>
        <pre>ForegroundColor       : Gray
BackgroundColor       : Black
CursorPosition        : 0,1
WindowPosition        : 0,0
CursorSize            : 25
BufferSize            : 100,300
WindowSize            : 100,25
MaxWindowSize         : 100,48
MaxPhysicalWindowSize : 168,48
KeyAvailable          : False
WindowTitle           : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe</pre>
      </td>
    </tr>
  </tbody></table>

<p>OOOOOOH!!!! Now if this doesn’t get the wheels turning in your head, you’re more of an OSITA than I am, and you need to get with it! <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/57/95/metablogapi/3580.wlEmoticon-smile_7DC143F3.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-57-95-metablogapi/3580.wlEmoticon_2D00_smile_5F00_7DC143F3.png" /></p>


<p>So let’s change the colors. I hate the black background and gray/white lettering. I want a dark blue background with yellow lettering. So, how do we do that? Let’s walk through this-- you already know that the previous command we ran showed us what colors we were using, so all we have to do now is change them. So how do we *change* them? We know (Get-Host).UI.RawUI.BackgroundColor = Black; so let’s change it to Dark Blue. Simple—just remember that names must be in quotes and can’t have spaces. So, type the following and hit enter:</p>

<pre class="csharpcode">(Get-Host).UI.RawUI.BackgroundColor = “DarkBlue”</pre>

<pre class="csharpcode"><font size="3" face="Times New Roman">And the screen should look like this:</font></pre>

<pre class="csharpcode"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/57/95/metablogapi/0250.image_4B5D7074.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-57-95-metablogapi/0250.image_5F00_4B5D7074.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/57/95/metablogapi/0358.image_thumb_7F61E9FA.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-57-95-metablogapi/0358.image_5F00_thumb_5F00_7F61E9FA.png" width="830" height="437" /></a></pre>

<p>Notice how the background after the carriage return turned to dark blue? Now let’s change the lettering. Type the following and hit enter:</p>

<pre class="csharpcode">(Get-Host).UI.RawUI.ForegroundColor = “Yellow”</pre>

<p>And you should see this:</p>

<p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/57/95/metablogapi/4578.image_5AA0ACB6.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-57-95-metablogapi/4578.image_5F00_5AA0ACB6.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/57/95/metablogapi/6131.image_thumb_2B8E4B12.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-57-95-metablogapi/6131.image_5F00_thumb_5F00_2B8E4B12.png" width="820" height="435" /></a></p>

<p>Now clear the screen and what do you think? Now exit PowerShell and re-open it. What happened? Why did it go away? Because PowerShell loaded your profile. The changes we made pertained to our current session only and aren't yet part of your profile. So now let’s fix that. Type Notepad $profile and add the following lines of code:</p>

<pre class="csharpcode">set-alias wipe clear-host
wipe
(Get-Host).UI.RawUI.ForegroundColor = “Yellow”
(Get-Host).UI.RawUI.BackgroundColor = “DarkBlue”
wipe</pre>

<h1></h1>

<p>Save the file and re-open the PowerShell command. How ‘bout *THAT*?!! Now, for the ‘coup de grâce’ – open up the profile.ps1 file add the line ‘Add-PSSnapin Microsoft.SharePoint.PowerShell’ and save the file. Exit the PowerShell editor and reopen it. For those of you who have SharePoint installed on your machine, the snapins are now loaded and you can type any SharePoint specific cmdlet and PowerShell will understand you. For those of you who do *NOT* have SharePoint installed on your machine, you might see a flash of red before the screen ‘wipes’ or clears itself because PowerShell can’t load the snap-in if the SharePoint dlls don’t exist. But no worries, you have a pretty editor screen in front of you. <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/57/95/metablogapi/3580.wlEmoticon-smile_7DC143F3.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-57-95-metablogapi/3580.wlEmoticon_2D00_smile_5F00_7DC143F3.png" /></p>




<p>In Part 3 (Final Part)&#160; I talk about the Top Ten most common PowerShell actions for which a SharePoint Admin can use.</p>]]></content:encoded>
    </item>
    <item>
      <title>People still sending you MEGA attachments?</title>
      <link>https://docs.microsoft.com/archive/blogs/ritaylor/people-still-sending-you-mega-attachments</link>
      <pubDate>Fri, 09 Jul 2010 08:09:21 GMT</pubDate>
      <dc:creator><![CDATA[Rick Taylor_SLKRCK]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/ritaylor/2010/07/09/people-still-sending-you-mega-attachments/</guid>
      <description><![CDATA[I had a friend come to me and ask how to automatically send attachments to a certain folder as she...]]></description>
      <content:encoded><![CDATA[<p>I had a friend come to me and ask how to automatically send attachments to a certain folder as she was tired of downloading the attachments and saving them to her hard drive only to *re* upload them to a file share for consumption.</p>  <p>I’m not much of a VBScript guy, but I knew this could be done, so I sent her the following script:</p>  <blockquote>   <p><font size="2"><em>Sub SaveToFolder(MyMail As MailItem)          <br />Dim strID As String           <br />Dim objNS As Outlook.NameSpace           <br />Dim objMail As Outlook.MailItem           <br />Dim objAtt As Outlook.Attachment           <br />Dim c As Integer           <br />Dim save_name As String</em></font></p>   <font size="2">     <p>       <br /><em>'Place path to sav to on next line. Note that you must include the          <br />'final backslash</em></p>      <p>       <br /><em>Const save_path As String = &quot;&lt;location where you want the file saved&gt;&quot;          <br />StrID = MyMail.EntryID           <br />Set objNS = Application.GetNamespace(&quot;MAPI&quot;)           <br />Set objMail = objNS.GetItemFromID(strID)           <br />If objMail.Attachments.Count &gt; 0 Then           <br />For c = 1 To objMail.Attachments.Count           <br />Set objAtt = objMail.Attachments(c)           <br />Save_name = Left(objAtt.FileName, Len(objAtt.FileName) - 4)           <br />'save_name = save_name &amp; Format(objMail.ReceivedTime, &quot;_mm-dd-yyyy_hhmm&quot;)           <br />Save_name = save_name &amp; Right(objAtt.FileName, 4)           <br />ObjAtt.SaveAsFile save_path &amp; save_name           <br />Next           <br />End If           <br />Set objAtt = Nothing           <br />Set objMail = Nothing           <br />Set objNS = Nothing           <br />End Sub</em></p>   </font><font size="3">To make this work for your Outlook client, you first need to enable the Developer feature in Outlook options:</font></blockquote>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/57/95/metablogapi/1884.image_5E7C6E31.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-57-95-metablogapi/1884.image_5F00_5E7C6E31.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/57/95/metablogapi/0334.image_thumb_1280E7B8.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-57-95-metablogapi/0334.image_5F00_thumb_5F00_1280E7B8.png" width="426" height="347" /></a></p>  <p>Then go to Outlook and select the Visual Basic button</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/57/95/metablogapi/6204.image_7BDE9970.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-57-95-metablogapi/6204.image_5F00_7BDE9970.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/57/95/metablogapi/0841.image_thumb_76237FCA.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-57-95-metablogapi/0841.image_5F00_thumb_5F00_76237FCA.png" width="427" height="141" /></a></p>  <p>&#160;</p>  <p>Select ‘Insert Module’</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/57/95/metablogapi/3566.image_4DA49DB6.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-57-95-metablogapi/3566.image_5F00_4DA49DB6.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/57/95/metablogapi/0827.image_thumb_45ACFB54.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-57-95-metablogapi/0827.image_5F00_thumb_5F00_45ACFB54.png" width="355" height="253" /></a></p>  <p>Insert the code in the code window:</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/57/95/metablogapi/6201.image_4B1B6BF8.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-57-95-metablogapi/6201.image_5F00_4B1B6BF8.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/57/95/metablogapi/4628.image_thumb_34791DB1.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-57-95-metablogapi/4628.image_5F00_thumb_5F00_34791DB1.png" width="351" height="245" /></a></p>  <p>At this point you simply create a rule (which will run locally and only when your client runs Outlook) which runs the script when you receive the attachment.</p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/57/95/metablogapi/0434.image_52E35E9A.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-57-95-metablogapi/0434.image_5F00_52E35E9A.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/57/95/metablogapi/4544.image_thumb_1FA72531.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-57-95-metablogapi/4544.image_5F00_thumb_5F00_1FA72531.png" width="256" height="362" /></a>&#160;<a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/57/95/metablogapi/6786.image_3DA53325.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-57-95-metablogapi/6786.image_5F00_3DA53325.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/57/95/metablogapi/6281.image_thumb_7BBE4DD6.png" original-url="http://blogs.technet.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-57-95-metablogapi/6281.image_5F00_thumb_5F00_7BBE4DD6.png" width="284" height="361" /></a></p>  <p>&#160;</p>  <p>Then you are done! Every time you receive an email with an attachment, it will be stripped from the email and sent to the location you specified.&#160; If you only want *certain* attachments to be stripped and shipped, then specify that in the rule.   </p>]]></content:encoded>
    </item>
    <item>
      <title>PowerShell for SharePoint Admins – The REAL primer PART I</title>
      <link>https://docs.microsoft.com/archive/blogs/ritaylor/powershell-for-sharepoint-admins-the-real-primer-part-i</link>
      <pubDate>Sun, 14 Feb 2010 22:40:00 GMT</pubDate>
      <dc:creator><![CDATA[Rick Taylor_SLKRCK]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/ritaylor/2010/02/14/powershell-for-sharepoint-admins-the-real-primer-part-i/</guid>
      <description><![CDATA[I’m not a developer.&nbsp; I am a straight up ITPro/Admin/Infrastructure guy.&nbsp; Oh, I can...]]></description>
      <content:encoded><![CDATA[<P>I’m not a developer.&nbsp; I am a straight up ITPro/Admin/Infrastructure guy.&nbsp; Oh, I can code.&nbsp; I just don’t like it and only do it when I absolutely HAVE TO.&nbsp; I find no pleasure in creating “cool apps” that do “cool stuff”.&nbsp; Opening up Visual Studio doesn’t make me want to vomit or even make my eyes roll into the back of my head, but it *does* make me sigh heavily saying under my breath, “Is this absolutely necessary? “&nbsp; If so, then so be it.&nbsp; Mostly my development experience is looking at a Dev’s code and figuring out what he/she wrote that broke SharePoint.&nbsp; </P>
<P>So why, say some ITPros, are you blogging about PowerShell?&nbsp; ITPros are very reticent about anything that resembles having to “code”.&nbsp; Writing scripts is about as far as most are willing to go.&nbsp; Most ITPros (the traditional administrator) feel most comfortable at the command prompt somewhere between traversing directories, to writing batch files to carry out unattended installation operations.&nbsp; Some even feel comfortable at writing more complex operations using some scripting engine such as JScript, WScript, CScript or VBScript.&nbsp; Some have written WMI scripts to manage their network environments.</P>
<H5>What’s the Deal?</H5>
<P>Most ITPros (myself mostly as well) say, “Why write code to do what I can do from the GUI even faster?”&nbsp; For example, look at this:</P>
<P><EM>strComputer = "DC01" </EM></P>
<P><EM>Set wbemServices = GetObject("winmgmts:\\" &amp; strComputer) </EM><BR><EM>Set wbemObjectSet = wbemServices.InstancesOf("Win32_LogicalMemoryConfiguration") </EM></P>
<P><EM>For Each wbemObject In wbemObjectSet </EM><BR><EM>&nbsp;&nbsp;&nbsp; WScript.Echo "Total Physical Memory (kb): " &amp; wbemObject.TotalPhysicalMemory </EM><BR><EM>Next</EM></P>
<P>A typical old school ITPro admin (OSITA) would say “PFFT…just hit Ctrl-Alt-Del !” (Well…an old school admin may not know what the script does, but you get the picture).&nbsp; But what happens when I need to do something that, if I did it via GUI, would take F-O-R-E-V-E-R?&nbsp; Here’s a scenario:</P>
<P>You are the administrator of Contoso Inc.&nbsp; Your company has merged with another company, NWTraders and you need to import their users into your Active Directory database.&nbsp; Their AD will be decommissioned.&nbsp; They are explicit in their desire to simply created new users with new sIDs in Contoso’s AD.&nbsp; NWTraders had 10,000 users.&nbsp; A typical old school ITPro/admin (OSITA) would probably do one of two things:&nbsp; a) Get a third party tool to do it, or b) find a script online that will do it.&nbsp; Let’s modify the scenario and say Contoso will not pay for the third party tool.&nbsp; </P>
<P>Now you’re stuck,&nbsp; Mr./Ms Hard Core Old School ITPro/Admin.&nbsp; What are you going to do?&nbsp; What script will you use?&nbsp; How do you know that it will work?&nbsp; Here is a hint:&nbsp; Learn how to script; fast.&nbsp; As <A href="http://www.sharepoint911.com/" mce_href="http://www.sharepoint911.com">Shane Young</A> and <A href="http://www.toddklindt.com/blog/default.aspx" mce_href="http://www.toddklindt.com/blog/default.aspx">Todd Klindt</A> have said in their traveling minstrel shows: It’s not <EM>that</EM> bad. (and neither are their sessions)&nbsp; ;)</P>
<P>If you are like me, the quintessential ITPro, you have attempted to try to be a Dev once.&nbsp; ONCE.&nbsp; You took a few programming classes and at the end wondered why you wasted all that time trying to figure out how the new terms all fit together in any sort of coherent meaning.&nbsp; Object, Class, Argument, pass, etc…WHAT??&nbsp; </P>
<P>My first official class in object-oriented programming was Visual Basic 3.&nbsp; It was a 5-day course with the “Introduction” to VB being 2 days, the “Intermediate” being 2 days and “Advanced” being the last day.&nbsp; Ha!&nbsp; I held my own the first day, but struggled the second day.&nbsp; I was totally lost the third day and playing solitaire by the fourth day.&nbsp; I don’t even know why I even showed up on Friday.&nbsp; I didn’t try my hand again until about three years later when I took VB6.&nbsp; I was much better that time around and about four years after that I took ASP.NET.&nbsp; #FAIL!</P>
<P>I was fine looking at code and knowing what it was intending to do, but to actually *write* something was just too….hard.&nbsp; When SharePoint came around I knew I would have to pick it back up again, so I did.&nbsp; I got a C# book and just hacked my way through it.&nbsp; Not too hard, not my cup of tea—but meh…I did it.&nbsp; When PowerShell came out, I said…hmmm…this isn’t so bad.&nbsp; It’s like…batch scripting; almost—just more wordier.</P>
<H5>The What</H5>
<P>This brings us to “What is PowerShell”.&nbsp; You’ve probably heard of PowerShell and if you are a hard-core, old school ITPro admin (OSITA)—you’ve been putting off learning it because you think, well, it’s almost like writing code.&nbsp; Sigh…GET A GRIP!&nbsp; You learned learned how to use DIR, COPY, MD, RD, and maybe even CHOICE—so learning a few more things won’t hurt…much.&nbsp; I promise. And YES, it is important and YES you will need to know it because SharePoint 2010 administration will rely heavily upon it.</P>
<P>I understand your reluctance.&nbsp; I do.&nbsp; What I will attempt here is to walk you through a Pain-Free tutorial/primer in PowerShell for SharePoint. Powershell Primer for Serious Non-devs.&nbsp; You know what they say: No Pain, No Gain—well, I am about No Pain, No Pain.</P>
<P>Again, most old-school ITPro admins (OSITA) were all about the “How”.&nbsp; “Just show me how to do it so I can get on with more important things.”&nbsp; I get that.&nbsp; There is some value in knowing the “Why”.&nbsp; This is where the OSITAs get tripped up.&nbsp; The explaining in why this works.&nbsp; While I promise not to go into the workings, I will explain in layman’s terms what is happening.&nbsp; It’s important to know these things, because it helps in the long run when it comes time to build upon knowledge already garnered by previous experience.&nbsp; For example, if I wanted to order a directory listing alphabetically and only a page at a time, I would type DIR /O /P.&nbsp; I would know this only if I knew three things:&nbsp; a)that DIR was the command for a directory listing, b) that there were parameters that I could type with DIR and c) How to find out what the parameters were&nbsp; Same thing in PowerShell.&nbsp; I will teach you something extremely simple, where to use it, what (if any) parameters you can use with the cmdlet, and finally how to find out if there parameters you can use with it.</P>
<H5>The How</H5>
<P>OK, so now for what the OSITAs have been waiting for—”Just show me the goods”.&nbsp; Right. There are a few assumptions I will make:</P>
<BLOCKQUOTE>
<P>a) I am going to assume you know NOTHING. Absolutely NOTHING. If you are a Dev here trolling for something…you are put on notice—this will bore you.</P></BLOCKQUOTE>
<BLOCKQUOTE>
<P>b) I am going to assume you have a Windows 7 workstation or a Windows Server 2008 machine to type from. Don’t gripe if it works differently in Windows XP, Vista or Windows Server 2003.</P></BLOCKQUOTE>
<P>The first thing you need to know is how to get to the PowerShell command prompt. First, go to a command prompt and type ‘powershell’ (without quotes) as shown:</P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_technet/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/clip_image002_2.jpg" original-url="http://blogs.technet.com/blogfiles/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/clip_image002_2.jpg" mce_href="http://blogs.technet.com/blogfiles/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/clip_image002_2.jpg"><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="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_technet/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/clip_image002_thumb.jpg" original-url="http://blogs.technet.com/blogfiles/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/clip_image002_thumb.jpg" width=546 height=117 mce_src="http://blogs.technet.com/blogfiles/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/clip_image002_thumb.jpg"></A></P>
<P mce_keep="true">&nbsp;</P>
<P>That will bring you to the PowerShell prompt.&nbsp; How ‘bout that?</P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_technet/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_2.png" original-url="http://blogs.technet.com/blogfiles/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_2.png" mce_href="http://blogs.technet.com/blogfiles/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_2.png"><IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_technet/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_thumb.png" original-url="http://blogs.technet.com/blogfiles/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_thumb.png" width=542 height=161 mce_src="http://blogs.technet.com/blogfiles/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_thumb.png"></A> </P>
<P>This is where you will finally see that things aren't so bad.&nbsp; Most of the commands you are familiar with are available here; type DIR and see what happens.&nbsp; Here’s one:&nbsp; let’s create a directory for us to put our scripts into.&nbsp; Remember how to create a sub-directory?&nbsp; MKDIR or MD.&nbsp; Call it scripts.&nbsp; Your output should look like this:</P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_technet/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_4.png" original-url="http://blogs.technet.com/blogfiles/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_4.png" mce_href="http://blogs.technet.com/blogfiles/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_4.png"><IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_technet/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_thumb_1.png" original-url="http://blogs.technet.com/blogfiles/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_thumb_1.png" width=545 height=189 mce_src="http://blogs.technet.com/blogfiles/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_thumb_1.png"></A> </P>
<P>Now change to the scripts directory.&nbsp; Do you remember that command?&nbsp; CD.&nbsp; </P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_technet/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_6.png" original-url="http://blogs.technet.com/blogfiles/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_6.png" mce_href="http://blogs.technet.com/blogfiles/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_6.png"><IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_technet/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_thumb_2.png" original-url="http://blogs.technet.com/blogfiles/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_thumb_2.png" width=546 height=203 mce_src="http://blogs.technet.com/blogfiles/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_thumb_2.png"></A> </P>
<P>So, right now you should be feeling pretty good and comfortable.&nbsp; Nothing new so far.&nbsp; So let’s show you something new.&nbsp; Go back a directory and do a directory listings.&nbsp; That would be typing ‘CD..’ and then typing ‘DIR’ like this:</P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_technet/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_8.png" original-url="http://blogs.technet.com/blogfiles/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_8.png" mce_href="http://blogs.technet.com/blogfiles/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_8.png"><IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_technet/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_thumb_3.png" original-url="http://blogs.technet.com/blogfiles/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_thumb_3.png" width=550 height=318 mce_src="http://blogs.technet.com/blogfiles/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_thumb_3.png"></A> </P>
<P>Now for the new stuff.&nbsp; In PowerShell, the command that does the same thing as DIR is ‘Get-ChildItem’.&nbsp; Type ‘Get-ChildItem’ (without quotes).</P>
<P>Wow! You get the same thing!&nbsp; So now you are thinking—“Why type all of that when DIR will suffice?”&nbsp; Well, good question.&nbsp; The point is to understand syntax so that building upon this knowledge will help you in the future.&nbsp; So don’t just type dir anymore…use Get-ChildItem from now on.&nbsp; </P>
<H5>The Why</H5>
<P>Get-ChildItem is a PowerShell cmdlet (yeah, I slipped that new term in) that does the same thing as DIR.&nbsp;&nbsp; The way Powershell syntax works is a [Verb]-[Noun] pair.&nbsp; In the previous demo, we told it what to do (verb) with GET, and then we told it what we wanted (noun) with ChildItem.&nbsp; Let’s say we wanted to know the date.&nbsp; We would tell the system what do with a verb (in this case GET) and what we wanted with a noun (in this case DATE).&nbsp; Type Get-Date.</P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_technet/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_10.png" original-url="http://blogs.technet.com/blogfiles/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_10.png" mce_href="http://blogs.technet.com/blogfiles/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_10.png"><IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_technet/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_thumb_4.png" original-url="http://blogs.technet.com/blogfiles/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_thumb_4.png" width=566 height=93 mce_src="http://blogs.technet.com/blogfiles/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_thumb_4.png"></A> </P>
<P>In PowerShell, syntax is very important.&nbsp; Just know that when you want to use it, go at it with Verb-Noun and add any parameters you may need.&nbsp; But what parameters are available?&nbsp; Remember HELP ? In PowerShell, HELP is awesome!&nbsp; But it doesn’t just stop at HELP.&nbsp; Let’s say that I needed help on Get-Date.&nbsp; Let me type help Get-Date and see what I get.&nbsp; Notice what I point out in the help:</P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_technet/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_12.png" original-url="http://blogs.technet.com/blogfiles/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_12.png" mce_href="http://blogs.technet.com/blogfiles/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_12.png"><IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_technet/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_thumb_5.png" original-url="http://blogs.technet.com/blogfiles/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_thumb_5.png" width=573 height=374 mce_src="http://blogs.technet.com/blogfiles/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_thumb_5.png"></A> </P>
<P>Yeah, you can actually get *<STRONG>examples</STRONG>* of how to use the cmdlet.&nbsp; Let’s do this; type help Get-Date –examples &gt;&gt;get-date-example.txt&nbsp; Why?&nbsp; Because it will take what would normally print out on the screen and create a text file called get-date-example.txt and put that file in our scripts directory.&nbsp; Using the &gt;&gt; sign will “pipe” screen output to a file.&nbsp; More on “Piping” later. </P>
<P>After typing in the command you will get a text file with examples of how to use the Get-Date cmdlet.&nbsp; Cool, huh?&nbsp; What’s that you say?&nbsp; Too many cmdlets to remember? Not a problem, here’s a new one: NEW-ALIAS.&nbsp; This particular cmdlet is for us “memory challenged” admins.&nbsp; Why type Get-Date when all I might be able to type is ‘gd’?&nbsp; How does it work?&nbsp; Let me show you:</P>
<P><A href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_technet/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_16.png" original-url="http://blogs.technet.com/blogfiles/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_16.png" mce_href="http://blogs.technet.com/blogfiles/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_16.png"><IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_technet/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_thumb_7.png" original-url="http://blogs.technet.com/blogfiles/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_thumb_7.png" width=551 height=113 mce_src="http://blogs.technet.com/blogfiles/ritaylor/WindowsLiveWriter/PowerShellforSharePointAdminsTheREALprim_F8C1/image_thumb_7.png"></A> </P>
<P mce_keep="true">&nbsp;</P>
<P>That’s it!&nbsp; Now instead of typing Get-Date, you can type gd and it will give you the current date.&nbsp; Now for the bad news:&nbsp; It’s only good for this PowerShell session; so as soon as you type EXIT or close the command prompt, your new alias of ‘gd’ will get forgotten.&nbsp; Don’t worry, I’ll teach how to make it persistent in Part II of this Primer.</P>
<H5>Coming Up Next</H5>
<P>In Part II I will show you how to make aliases you create persistent as well as going a little deeper into what you can do with Aliases.&nbsp; I will also start showing you the specific cmdlets used in SharePoint administration.</P>]]></content:encoded>
    </item>
  </channel>
</rss>