<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>My SharePoint of View &#187; Script</title>
	<atom:link href="http://mysharepointofview.com/category/script/feed/" rel="self" type="application/rss+xml" />
	<link>http://mysharepointofview.com</link>
	<description>Thoughts, reflections and solutions from the field in SharePoint land</description>
	<lastBuildDate>Tue, 10 Aug 2010 18:23:23 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>psconfig and secureresources</title>
		<link>http://mysharepointofview.com/2010/04/psconfig-and-secureresources/</link>
		<comments>http://mysharepointofview.com/2010/04/psconfig-and-secureresources/#comments</comments>
		<pubDate>Wed, 14 Apr 2010 15:53:17 +0000</pubDate>
		<dc:creator>Mattias Karlsson</dc:creator>
				<category><![CDATA[Script]]></category>
		<category><![CDATA[MOSS]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[PSCONFIG]]></category>
		<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[The book]]></category>

		<guid isPermaLink="false">http://mysharepointofview.com/?p=831</guid>
		<description><![CDATA[I&#8217;m currently writing a chapter (PowerShell for Microsoft SharePoint 2010 Administrators) about scripted installations in SharePoint 2010 using PowerShell. In 2010 there are a couple of cmdlets that does more or less the same thing as you do with psconfig when scripting installations today.
One of the cmdlets that needs to be used when scripting a [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently writing a chapter (<a href="http://sharepointandpowershell.com" target="_self">PowerShell for Microsoft SharePoint 2010 Administrators</a>) about scripted installations in SharePoint 2010 using PowerShell. In 2010 there are a couple of cmdlets that does more or less the same thing as you do with psconfig when scripting installations today.</p>
<p>One of the cmdlets that needs to be used when scripting a 2010 farm using PowerShell is the <em>Initialize-SPResourceSecurity </em>This does the same as psconfig -cmd secureresources. A have used this hundreds of times and knows that it is, according to the <a href="http://technet.microsoft.com/en-us/library/cc263093.aspx" target="_blank">technet command line reference</a>  &#8221;Performs SharePoint Products and Technologies resource security enforcement on the server. For example, security is enforced on files, folders, and registry keys&#8221;. Earlier I have been happy with that explanation since it&#8217;s quite obvious what it does right? But what does this really mean, what security is set and on what folders and files? It turns out that if you Google on it, everyone mentioning it says more or less the same as the sentence mentioned on Technet. This made me even more curios, and to find out you can actually run the command from the command line and get the result there or you can pipe it out to a txt file like this:</p>
<p><em>psconfig -cmd secureresources &gt; c:\temp\secureresources.txt</em></p>
<p>The below is a copy of the result (Moss) and should give you a hint on what it actually does and what files, foldres and registry keys are affected.</p>
<p>Successfully secured resource &#8216;HKEY_LOCAL_MACHINE\Software\Microsoft\Office Server\12.0\LoadBalancerSettings&#8217; of type &#8216;RegKey&#8217; by granting security group &#8216;LocalService&#8217; &#8216;Read&#8217; permissions .</p>
<p>Successfully secured resource &#8216;E:\Microsoft Office servers\12.0\WebServices\Root&#8217; of type &#8216;Directory&#8217; by granting security group &#8216;Users&#8217; &#8216;Read, Execute&#8217; permissions .</p>
<p>Successfully secured resource &#8216;HKEY_LOCAL_MACHINE\Software\Microsoft\Office Server\12.0\LoadBalancerSettings&#8217; of type &#8216;RegKey&#8217; by granting security group &#8216;WSS_WPG&#8217; &#8216;Read, Write&#8217; permissions .</p>
<p>Successfully secured resource &#8216;HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VSS&#8217; of type &#8216;RegKey&#8217; by granting security group &#8216;WSS_ADMIN_WPG&#8217; &#8216;Full Control&#8217; permissions .</p>
<p>Successfully secured resource &#8216;HKEY_LOCAL_MACHINE\Software\Microsoft\Office Server\12.0\LauncherSettings&#8217; of type &#8216;RegKey&#8217; by granting security group &#8216;LocalSystem&#8217; &#8216;Read&#8217; permissions .</p>
<p>Successfully secured resource &#8216;E:\Microsoft Office servers\12.0\&#8217; of type &#8216;Directory&#8217; by granting security group &#8216;WSS_WPG&#8217; &#8216;Read, Execute&#8217; permissions .</p>
<p>Successfully secured resource &#8216;E:\Microsoft Office servers\12.0\WebServices\Root&#8217; of type &#8216;Directory&#8217; by granting security group &#8216;NetworkService&#8217; &#8216;Read, Execute&#8217; permissions .</p>
<p>Successfully secured resource &#8216;HKEY_LOCAL_MACHINE\Software\Microsoft\Shared Tools\Web Server Extensions\12.0\WSS\Diagnostics&#8217; of type &#8216;RegKey&#8217; by granting security group &#8216;WSS_WPG&#8217; &#8216;Read, Write&#8217; permissions .</p>
<p>Successfully secured resource &#8216;E:\Microsoft Office Servers\12.0\Data\&#8217; of type &#8216;Directory&#8217; by granting security group &#8216;WSS_ADMIN_WPG&#8217; &#8216;Full Control&#8217; permissions .</p>
<p>Successfully secured resource &#8216;HKEY_LOCAL_MACHINE\Software\Microsoft\Office Server\12.0\Diagnostics&#8217; of type &#8216;RegKey&#8217; by granting security group &#8216;WSS_WPG&#8217; &#8216;Read, Write&#8217; permissions .</p>
<p>Successfully secured resource &#8216;E:\Microsoft Office servers\12.0\&#8217; of type &#8216;Directory&#8217; by granting security group &#8216;Users&#8217; &#8216;Read, Execute&#8217; permissions .</p>
<p>Successfully secured resource &#8216;E:\Microsoft Office servers\12.0\WebServices&#8217; of type &#8216;Directory&#8217; by granting security group &#8216;WSS_WPG&#8217; &#8216;Read&#8217; permissions .</p>
<p>Successfully secured resource &#8216;HKEY_CLASSES_ROOT\APPID\{6002D29F-1366-4523-88C1-56D59BFEF8CB}&#8217; of type &#8216;RegKey&#8217; by granting security group &#8216;WSS_ADMIN_WPG&#8217; &#8216;Full Control&#8217; permissions .</p>
<p>Successfully secured resource &#8216;E:\Microsoft Office servers\12.0\Logs\&#8217; of type &#8216;Directory&#8217; by granting security group &#8216;WSS_ADMIN_WPG&#8217; &#8216;Full Control&#8217; permissions .</p>
<p>Successfully secured resource &#8216;HKEY_LOCAL_MACHINE\Software\Microsoft\Shared Tools\Web Server Extensions\12.0\Search&#8217; of type &#8216;RegKey&#8217; by granting security group &#8216;WSS_ADMIN_WPG&#8217; &#8216;Full Control&#8217; permissions .</p>
<p>Successfully secured resource &#8216;C:\WINDOWS\System32\drivers\etc\HOSTS&#8217; of type &#8216;File&#8217; by granting security group &#8216;WSS_ADMIN_WPG&#8217; &#8216;Read, Write&#8217; permissions .</p>
<p>Successfully secured resource &#8216;E:\Microsoft Office servers\12.0\Bin\&#8217; of type &#8216;Directory&#8217; by granting security group &#8216;LocalService&#8217; &#8216;Read, Execute&#8217; permissions .</p>
<p>Successfully secured resource &#8216;HKEY_LOCAL_MACHINE\Software\Microsoft\Office Server\12.0\LauncherSettings&#8217; of type &#8216;RegKey&#8217; by granting security group &#8216;WSS_ADMIN_WPG&#8217; &#8216;Read, Write&#8217; permissions .</p>
<p>Successfully secured resource &#8216;E:\Microsoft Office servers\12.0\Logs&#8217; of type &#8216;Directory&#8217; by granting security group &#8216;Users&#8217; &#8216;Read, Execute, Write&#8217; permissions .</p>
<p>Successfully secured resource &#8216;E:\Microsoft Office servers\12.0\Logs\&#8217; of type &#8216;Directory&#8217; by granting security group &#8216;WSS_WPG&#8217; &#8216;Read, Write&#8217; permissions .</p>
<p>Successfully secured resource &#8216;HKEY_LOCAL_MACHINE\Software\Microsoft\Shared Tools\Web Server Extensions\12.0\WSS\ComponentsToRegister&#8217; of type &#8216;RegKey&#8217; by granting security group &#8216;WSS_ADMIN_WPG&#8217; &#8216;Read, Write&#8217; permissions .</p>
<p>Successfully secured resource &#8216;E:\Microsoft Office Servers\12.0\Data\Office Server\&#8217; of type &#8216;Directory&#8217; by granting security group &#8216;WSS_ADMIN_WPG&#8217; &#8216;Full Control&#8217; permissions .</p>
<p>Successfully secured resource &#8216;HKEY_LOCAL_MACHINE\Software\Microsoft\Office Server\12.0\Search&#8217; of type &#8216;RegKey&#8217; by granting security group &#8216;WSS_ADMIN_WPG&#8217; &#8216;Full Control&#8217; permissions .</p>
<p>Successfully secured resource &#8216;HKEY_CLASSES_ROOT\APPID\{58F1D482-A132-4297-9B8A-F8E4E600CDF6}&#8217; of type &#8216;RegKey&#8217; by granting security group &#8216;WSS_ADMIN_WPG&#8217; &#8216;Full Control&#8217; permissions .</p>
<p>Successfully secured resource &#8216;E:\Microsoft Office servers\12.0\Bin&#8217; of type &#8216;Directory&#8217; by granting security group &#8216;Users&#8217; &#8216;Read, Execute&#8217; permissions .</p>
<p>Successfully secured resource &#8216;HKEY_LOCAL_MACHINE\Software\Microsoft\Office Server\12.0\Search\Setup&#8217; of type &#8216;RegKey&#8217; by granting security group &#8216;NetworkService&#8217; &#8216;Read&#8217; permissions .</p>
<p>Successfully secured resource &#8216;C:\WINDOWS\Tasks&#8217; of type &#8216;Directory&#8217; by granting security group &#8216;WSS_ADMIN_WPG&#8217; &#8216;Full Control&#8217; permissions .</p>
<p>Successfully secured resource &#8216;HKEY_LOCAL_MACHINE\Software\Microsoft\Office Server\12.0\LoadBalancerSettings&#8217; of type &#8216;RegKey&#8217; by granting security group &#8216;WSS_ADMIN_WPG&#8217; &#8216;Read, Write&#8217; permissions .</p>
<p>Successfully secured resource &#8216;HKEY_LOCAL_MACHINE\Software\Microsoft\Shared Tools\Web Server Extensions\12.0\Search&#8217; of type &#8216;RegKey&#8217; by granting security group &#8216;WSS_WPG&#8217; &#8216;Read&#8217; permissions .</p>
<p>Successfully secured resource &#8216;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Server\12.0&#8242; of type &#8216;RegKey&#8217; by granting security group &#8216;WSS_WPG&#8217; &#8216;Read&#8217; permissions .</p>
<p>Successfully secured resource &#8216;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Server\12.0&#8242; of type &#8216;RegKey&#8217; by granting security group &#8216;WSS_ADMIN_WPG&#8217; &#8216;Full Control&#8217; permissions .</p>
<p>Successfully secured resource &#8216;E:\Microsoft Office servers\12.0\WebServices&#8217; of type &#8216;Directory&#8217; by granting security group &#8216;WSS_ADMIN_WPG&#8217; &#8216;Read, Write&#8217; permissions .</p>
<p>Successfully secured resource &#8216;E:\Microsoft Office servers\12.0\&#8217; of type &#8216;Directory&#8217; by granting security group &#8216;WSS_ADMIN_WPG&#8217; &#8216;Full Control&#8217; permissions .</p>
<p>Successfully secured resource &#8216;HKEY_LOCAL_MACHINE\Software\Microsoft\Office\12.0\Registration\{90120000-110D-0000-1000-0000000FF1CE}&#8217; of type &#8216;RegKey&#8217; by granting security group &#8216;WSS_ADMIN_WPG&#8217; &#8216;Read, Write&#8217; permissions .</p>
<p>Successfully secured resource &#8216;HKEY_LOCAL_MACHINE\Software\Microsoft\Office Server\12.0\LauncherSettings&#8217; of type &#8216;RegKey&#8217; by granting security group &#8216;WSS_WPG&#8217; &#8216;Read, Write&#8217; permissions .</p>
<p>Successfully secured resource &#8216;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Server&#8217; of type &#8216;RegKey&#8217; by granting security group &#8216;WSS_ADMIN_WPG&#8217; &#8216;Read&#8217; permissions .</p>
<p>Thanks for the tip Andrija!</p>
]]></content:encoded>
			<wfw:commentRss>http://mysharepointofview.com/2010/04/psconfig-and-secureresources/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Update of SP-Upgrade script</title>
		<link>http://mysharepointofview.com/2010/04/update-of-sp-upgrade-script/</link>
		<comments>http://mysharepointofview.com/2010/04/update-of-sp-upgrade-script/#comments</comments>
		<pubDate>Fri, 02 Apr 2010 09:42:08 +0000</pubDate>
		<dc:creator>Mattias Karlsson</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[Cumulative update]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[sp-upgrade]]></category>
		<category><![CDATA[Upgrade]]></category>

		<guid isPermaLink="false">http://mysharepointofview.com/?p=828</guid>
		<description><![CDATA[After some feedback I have updated the SP-Upgrade script created 2 weeks ago. First there was a bug in the script related to the export of Web Application names and then I added switch that makes i possible to only export the content database information to an XML File. This is how the help looks [...]]]></description>
			<content:encoded><![CDATA[<p>After some feedback I have updated the SP-Upgrade script created 2 weeks ago. First there was a bug in the script related to the export of Web Application names and then I added switch that makes i possible to only export the content database information to an XML File. This is how the help looks now and you find more information about the script here: <a href="http://mysharepointofview.com/2010/03/automate-sharepoint-patching-with-powershell/">http://mysharepointofview.com/2010/03/automate-sharepoint-patching-with-powershell/</a></p>
<p>SYNTAX:<br />
SP-Upgrade -help<br />
Displays the help topic for the script</p>
<p>SP-Upgrade -Binaries<br />
Installs the wss and MOSS Binaries on the local machine</p>
<p>SP-Upgrade -Binaries -DetacheContentDBs<br />
Detaches all content databases and installs the wss and MOSS Binaries on the local machine</p>
<p>SP-Upgrade -PSConfig<br />
Runs the SharePoint Product and Configuration Wizard</p>
<p>SP-Upgrade -PSConfig -AttachContentDBs<br />
Runs the SharePoint Product and Configuration Wizard and attaches all content databases</p>
<p>SP-Upgrade -OnlyAttach<br />
Attaches all Content databases found in ContentDatabases.xml</p>
<p>SP-Upgrade -OnlyExport<br />
Exports all Content databases found to ContentDatabases.xml</p>
]]></content:encoded>
			<wfw:commentRss>http://mysharepointofview.com/2010/04/update-of-sp-upgrade-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automate SharePoint patching with PowerShell</title>
		<link>http://mysharepointofview.com/2010/03/automate-sharepoint-patching-with-powershell/</link>
		<comments>http://mysharepointofview.com/2010/03/automate-sharepoint-patching-with-powershell/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 16:55:54 +0000</pubDate>
		<dc:creator>Mattias Karlsson</dc:creator>
				<category><![CDATA[Script]]></category>
		<category><![CDATA[Cumulative update]]></category>
		<category><![CDATA[Patching]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[PSCONFIG]]></category>

		<guid isPermaLink="false">http://mysharepointofview.com/?p=799</guid>
		<description><![CDATA[My last addition to the community is a script that can help you with the patching of SharePoint environments. The script was from the beginning made for Cumulative Updates but can be used in other scenarios as well. As in all CU installations it&#8217;s done in two steps; install Binaries and then run the SharePoint [...]]]></description>
			<content:encoded><![CDATA[<p>My last addition to the community is a script that can help you with the patching of SharePoint environments. The script was from the beginning made for Cumulative Updates but can be used in other scenarios as well. As in all CU installations it&#8217;s done in two steps; install Binaries and then run the SharePoint Configuration Wizard/PSConfig. What I wanted the script to do was they key things.</p>
<ol>
<li>Log the amount of time it takes to install the updates to estimate downtime in produciton environment</li>
<li>Be able to reuse it without having to change any code</li>
<li>Be able to choose if I wanted to detach all content databases before the binaries and then attach it after psconfig and then have that automated.</li>
</ol>
<p>The first two things are actually not that tricky but the last point needed some more efforts.</p>
<ol>
<li>This is how you work with the script:<br />
Download it from <a href="http://mysharepointofview.com/wp-content/plugins/download-monitor/download.php?id=10" title="SharePoint Patching">here</a> of from the <a href="http://mysharepointofview.com/downloads">download</a> section, and put it on the SharePoint server/servers that are about to be upgraded.</li>
<li>Create a folder on the same level as the SP-Upgrade.ps1 file and name it Media.</li>
<li>Download and extract the CU or the patches that should be installed and put it in the Media folder.</li>
<li>Rename the .exe files in the Media folder so that they have a digit in the beginning representing in what order they should be installed.<br />
For instance, if you want to upgrade your MOSS environment you have both the WSS and MOSS CU name the WSS CU 01[WSSFilename].exe and 02[MossFileName].exe</li>
<li>Open up a PowerShell command window with enough priviliges to run the setup.</li>
<li>Depending on your environment and what approach you want to use, run SP-Upgrade with any of the following switches.</li>
</ol>
<table>
<tbody>
<tr>
<td><strong>Switches</strong></td>
<td> </td>
</tr>
<tr>
<td>-Binaries</td>
<td>Installs the binaries located in the Media folder</td>
</tr>
<tr>
<td>-PSConfig</td>
<td>Runs the SharePoint Product and Configuration Wizard using: <br />
psconfig -cmd upgrade -inplace b2b -wait -force <em>(complete command-line reference found here: </em><a href="http://technet.microsoft.com/en-us/library/cc263093.aspx"><em>http://technet.microsoft.com/en-us/library/cc263093.aspx</em></a><em>)</em></td>
</tr>
<tr>
<td>-DetachContentDBs</td>
<td>Used together with -Binaries. Detaches content databases before installing the media and stores them in a xml file named ContentDatabases.xml located in the same folder as your SP-Upgrade.ps1 file</td>
</tr>
<tr>
<td>-AttachContentDBs</td>
<td>Used together with -PSConfig. Attach content databases after PSConfig. Note that if you have several SharePoint Server this should be used on the last server when -PSConfig is run on all other servers.</td>
</tr>
<tr>
<td>-OnlyAttach</td>
<td>Will only attach databases using ContentDatabases.xml. Used if you have run PSConfig on all servers and then just want to attach it.</td>
</tr>
<tr>
<td>-OnlyExport</td>
<td>Will only export databases to ContentDatabases.xml.</td>
</tr>
<tr>
<td>-help</td>
<td>Displays the help topic</td>
</tr>
</tbody>
</table>
<p>When the script is run it will create a Log folder and put all logs in that folder. Except for the log files generated by the installation I create a log file named Upgradelog.log and will contain the steps taken by the script together with time stamps. The time stamps are also printed to the screen and can display installation times, detach and attach times of content db&#8217;s.</p>
<p>When detaching the content databases the following information is stored in the ContentDatabases.xml file:</p>
<p>Web Application URL<br />
Content Database Name<br />
Content Database Max Site Count<br />
Content Database Site Warning Level<br />
Content Database Read Only<br />
Content Database Status<br />
Content Database Server Name<br />
Detached Time<br />
Reattached Time <em>(Used when attached)</em></p>
<p><strong>Syntax examples</strong></p>
<p>SP-Upgrade -help<br />
Displays the help topic for the script</p>
<p>SP-Upgrade -Binaries<br />
Installs the wss and MOSS Binaries on the local machine</p>
<p>SP-Upgrade -Binaries -DetacheContentDBs<br />
Detaches all content databases and installs the wss and MOSS Binaries on the local machine</p>
<p>SP-Upgrade -PSConfig<br />
Runs the SharePoint Product and Configuration Wizard</p>
<p>SP-Upgrade -PSConfig -AttachContentDBs<br />
Runs the SharePoint Product and Configuration Wizard and attaches all content databases</p>
<p>SP-Upgrade -OnlyAttach<br />
Attaches all Content databases found in ContentDatabases.xml</p>
<p>Feedback and ideas for improvement is more then welcome!</p>
]]></content:encoded>
			<wfw:commentRss>http://mysharepointofview.com/2010/03/automate-sharepoint-patching-with-powershell/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cancel multiple SharePoint Workflows using PowerShell</title>
		<link>http://mysharepointofview.com/2010/02/cancel-multiple-sharepoint-workflows-using-powershell/</link>
		<comments>http://mysharepointofview.com/2010/02/cancel-multiple-sharepoint-workflows-using-powershell/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 12:49:45 +0000</pubDate>
		<dc:creator>Mattias Karlsson</dc:creator>
				<category><![CDATA[Script]]></category>
		<category><![CDATA[MOSS]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Workflow]]></category>
		<category><![CDATA[WSS]]></category>

		<guid isPermaLink="false">http://mysharepointofview.com/?p=764</guid>
		<description><![CDATA[Have you ever been in a situation where you have had a lot of workflows that has been started and ended up in a Error Occurred state? Where you tired of terminating them one by one before you could start the workflow again? Well I was, so I wrote a small and simple PowerShellScript for it.
What the [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever been in a situation where you have had a lot of workflows that has been started and ended up in a Error Occurred state? Where you tired of terminating them one by one before you could start the workflow again? Well I was, so I wrote a small and simple PowerShellScript for it.</p>
<p>What the script does is that you specify a site, list and workflow name and then all workflows will be terminated so that you can run them again. I also included the option to include already running Workflows and also a Restart parameter that could actually be used to start multiple Workflows only.</p>
<p><strong>This is how it looks:</strong></p>
<p><em>DESCRIPTION:<br />
NAME: Cancel-SPWorkflow<br />
Cancel SharePoint Workflows and restart them if wanted</em></p>
<table border="0" cellspacing="1" cellpadding="0" width="450">
<tbody>
<tr>
<td><em>PARAMETERS:</em></td>
<td><em> </em></td>
</tr>
<tr>
<td><em>-Site</em></td>
<td><em>Url to the SharePoint Site</em></td>
</tr>
<tr>
<td><em>-List</em></td>
<td><em>Name of the list</em></td>
</tr>
<tr>
<td><em>-Workflowname</em></td>
<td><em>Name of the workflow</em></td>
</tr>
<tr>
<td><em>-Restart</em></td>
<td><em>Optional if you want to restart the workflows</em></td>
</tr>
<tr>
<td><em>-IncludeRunning</em></td>
<td><em>Optional if you want to include running workflows</em></td>
</tr>
<tr>
<td><em>-help</em></td>
<td><em>Displays the help topic</em></td>
</tr>
</tbody>
</table>
<p><em>SYNTAX:<br />
Cancel-SPWorkflow -help<br />
Displays the help topic for the script</em></p>
<p><em>Cancel-SPWorkflow -site </em><em>http://yourSPSite</em> <em>-list Listname -Workflowname YourWorkflow<br />
Terminates all workflows with the specific workflow name</em></p>
<p><em>Cancel-SPWorkflow -site </em><em>http://yourSPSite</em> <em>-list Listname -Workflowname YourWorkflow -Includerunning<br />
Terminates all workflows with the specific workflow name and include running workflows</em></p>
<p><em>Cancel-SPWorkflow -site </em><em>http://yourSPSite</em> <em>-list Listname -Workflowname YourWorkflow -restart<br />
Terminates all workflows with the specific workflow name and then restart the workflow for all items</em></p>
<p>The key in the script is how we cancel the workflow. That is done through the SPWorkflowManager and done like.</p>
<p><em>[Microsoft.SharePoint.Workflow.SPWorkflowManager]::CancelWorkflow($Workflow)</em></p>
<p>And when we want to start a workflow we first need the workflow association and association data together with the SharePoint item to start it for.</p>
<p><em>$SPList.Parentweb.site.workflowmanager.startworkflow($item, $WFAssociation, $WFAssociation.AssociationData)</em></p>
<p>You find the whole script <a href="http://mysharepointofview.com/wp-content/plugins/download-monitor/download.php?id=9" title="Cancel-SPWorkflow">here</a> or from the <a href="http://mysharepointofview.com/downloads">Downloads</a> section</p>
<p>Hope you find it useful</p>
]]></content:encoded>
			<wfw:commentRss>http://mysharepointofview.com/2010/02/cancel-multiple-sharepoint-workflows-using-powershell/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Copy list items to folder using PowerShell</title>
		<link>http://mysharepointofview.com/2010/01/copy-list-items-to-folder-using-powershell/</link>
		<comments>http://mysharepointofview.com/2010/01/copy-list-items-to-folder-using-powershell/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 15:32:46 +0000</pubDate>
		<dc:creator>Mattias Karlsson</dc:creator>
				<category><![CDATA[Script]]></category>
		<category><![CDATA[MOSS]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[WSS]]></category>

		<guid isPermaLink="false">http://mysharepointofview.com/?p=743</guid>
		<description><![CDATA[Here comes a quick PowerShell tip at the end of the week. Earlier I have posted a script (found at the download section) that helps copy SharePoint List Items from one list to another, read more about it here.
But today I wanted to use the script to copy items to a specific folder in that [...]]]></description>
			<content:encoded><![CDATA[<p>Here comes a quick PowerShell tip at the end of the week. Earlier I have posted a script (found at the <a href="http://mysharepointofview.com/downloads">download section</a>) that helps copy SharePoint List Items from one list to another, read more about it <a href="http://mysharepointofview.com/2009/09/copy-items-from-one-list-to-another-using-powershell/">here</a>.</p>
<p>But today I wanted to use the script to copy items to a specific folder in that list and it was a bit tricky at the first to understand how this could be done. But after some testing I figured it out and this is how you do.</p>
<p># First open the list to create the new item in.<br />
<em>$TargetWeb = New-Object Microsoft.SharePoint.SPSite(</em><em>http://yoursite</em><em>)<br />
$OpenTargetWeb = $TargetWeb.OpenWeb()<br />
$OpenTargetList = $OpenTargetWeb.Lists[$TargetList]</em></p>
<p># Then we need to get the folder name and set the objecttype<br />
<em>$FSObjectytype = [microsoft.sharepoint.SPFilesystemobjecttype]::File<br />
$Folder = $targetweb.GetFolder(</em><a href="http://urlToFolder"><em>http://urlToFolder</em></a><em>)</em></p>
<p># Now we can create the new Item<br />
<em>$NewItem = $OpenTargetList.items.Add($Folder.Folder.ServerRelativeUrl, $FSObjectytype, $null)</em></p>
<p># Add values<br />
<em>$NewItem["Title"] = &#8220;Yada Yada&#8221;</em></p>
<p># Finally use update to create the new item<br />
<em>$NewItem.update()</em></p>
<p>My intention is to add this to my <a href="http://mysharepointofview.com/downloads">copy items</a> script later on.</p>
]]></content:encoded>
			<wfw:commentRss>http://mysharepointofview.com/2010/01/copy-list-items-to-folder-using-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enumerate all content databases using PowerShell</title>
		<link>http://mysharepointofview.com/2010/01/enumerate-all-content-databases-using-powershell/</link>
		<comments>http://mysharepointofview.com/2010/01/enumerate-all-content-databases-using-powershell/#comments</comments>
		<pubDate>Mon, 11 Jan 2010 20:38:25 +0000</pubDate>
		<dc:creator>Mattias Karlsson</dc:creator>
				<category><![CDATA[Script]]></category>
		<category><![CDATA[Content database]]></category>
		<category><![CDATA[Enumerate]]></category>
		<category><![CDATA[MOSS]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[WSS]]></category>

		<guid isPermaLink="false">http://mysharepointofview.com/?p=723</guid>
		<description><![CDATA[It&#8217;s time for another PowerShell script. This one I wrote in a project where I needed to know what content databases was used by each farm. We had a large SQL cluster and more then one farm was using it. Since there is no enum content databases in stsadm i made this simple PowerShell script.
What [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s time for another PowerShell script. This one I wrote in a project where I needed to know what content databases was used by each farm. We had a large SQL cluster and more then one farm was using it. Since there is no enum content databases in stsadm i made this simple PowerShell script.</p>
<p>What it does basically is that it connects to the SPWebService and for each web application it finds it lists all SharePoint Content Databases and writes it to a text file.</p>
<p>This is how you use it:</p>
<p><em>.\SP-EnumContentDBs -path e:\contentdb.txt</em></p>
<p>And now in the first version you will get the following information:<br />
Web Application name<br />
Content Database Name<br />
Content Database ID(GUID)<br />
Current amount of sites in DB<br />
Maximum site count allowed in DB<br />
Read only state</p>
<p>But it&#8217;s easy to add more attributes by just adding more properties to the code. You can find all available properties at msdn: <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spcontentdatabase_properties">http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spcontentdatabase_properties.</a></p>
<p>If you want to make a comparison to what you have on the SQL server you can easily run the script, import it to e.g. Excel and then run the following on the SQL server to get the list of databases:</p>
<p><em>select name from master..sysdatabases where dbid&gt;4 order by name</em></p>
<p>You can download the script by clicking <a href="http://mysharepointofview.com/wp-content/plugins/download-monitor/download.php?id=8" title="Enumerat Content Databases">here</a>, or it&#8217;s available at the <a href="http://mysharepointofview.com/downloads">download</a> section.</p>
<p>Finally thanks to Travis Lingenfelder who with his blog post helped me with some strugeling getting the names out since it differs some from c#.</p>
<p><a href="http://blogs.catapultsystems.com/tlingenfelder/archive/2009/06/26/using-non-cls-compliant-types-in-powershell.aspx">http://blogs.catapultsystems.com/tlingenfelder/archive/2009/06/26/using-non-cls-compliant-types-in-powershell.aspx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://mysharepointofview.com/2010/01/enumerate-all-content-databases-using-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hide the quick launch navigation &#8211; the easy way</title>
		<link>http://mysharepointofview.com/2010/01/hide-the-quick-launch-navigation-the-easy-way/</link>
		<comments>http://mysharepointofview.com/2010/01/hide-the-quick-launch-navigation-the-easy-way/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 12:18:50 +0000</pubDate>
		<dc:creator>Mattias Karlsson</dc:creator>
				<category><![CDATA[How to]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[Solution]]></category>
		<category><![CDATA[CEWP]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[MOSS]]></category>
		<category><![CDATA[Quick Launch]]></category>
		<category><![CDATA[Stylesheet]]></category>
		<category><![CDATA[WSS]]></category>

		<guid isPermaLink="false">http://mysharepointofview.com/?p=707</guid>
		<description><![CDATA[Sometimes you have SharePoint lists or sites where you want to hide the Left hand navigation bar commonly called the Quick Launch. For instance it&#8217;s common that people want their News or Announcement lists that the visitor only have read access to, to only show all the news items and not the Quick Launch. Usually, if you have [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes you have SharePoint lists or sites where you want to hide the Left hand navigation bar commonly called the Quick Launch. For instance it&#8217;s common that people want their News or Announcement lists that the visitor only have read access to, to only show all the news items and not the Quick Launch. Usually, if you have set the permissions correctly this is not a problem from an security point of view because of the Security trimming SharePoint have but it might look better.</p>
<p>There is a verry easy way to hide the Quick Launch if you only want to do this on or two pages.</p>
<p>This is how you do:</p>
<p>1. Go to the site or list where you want to hide the Quick Launch.</p>
<p>2. Go to <em>Site Settings</em> and select<em> Edit Page</em></p>
<p>3. Add a <em>Content Editor Web Part</em> to any of your <em>Web Part Zones</em> (This web part will be hidden so it doesn&#8217;t matter where you put it).</p>
<p><a href="http://mysharepointofview.com/wp-content/uploads/2010/01/AddWebPart.jpg"><img class="alignnone size-medium wp-image-710" title="AddWebPart" src="http://mysharepointofview.com/wp-content/uploads/2010/01/AddWebPart-300x139.jpg" alt="AddWebPart" width="300" height="139" /></a></p>
<p>4. Make sure that you select the <em>Hidden</em> attribute for the <em>Web Part</em> and the click on <em>Source Editor&#8230;</em></p>
<p><a href="http://mysharepointofview.com/wp-content/uploads/2010/01/EditContentEditorWebPart.jpg"><img class="alignnone size-medium wp-image-711" title="EditContentEditorWebPart" src="http://mysharepointofview.com/wp-content/uploads/2010/01/EditContentEditorWebPart-187x300.jpg" alt="EditContentEditorWebPart" width="187" height="300" /></a></p>
<p>5. A little bit depending on if it&#8217;s on a site, what kind of list, theme and if you have any custom styles on your site the below code could change but it will work in most cases and I will describe how you find make it work in case it doesn&#8217;t.<br />
Copy the below code and past it in the <em>Source editor</em></p>
<p>&lt;style&gt;</p>
<p>.ms-pagetitleareaframe<br />
{<br />
display: none;<br />
}<br />
.ms-navframe<br />
{<br />
display: none;<br />
}<br />
.ms-titleareaframe<br />
{<br />
display: none;<br />
}<br />
&lt;/style&gt;</p>
<p><a href="http://mysharepointofview.com/wp-content/uploads/2010/01/HideQuickLaunchCode.jpg"><img class="alignnone size-medium wp-image-712" title="HideQuickLaunchCode" src="http://mysharepointofview.com/wp-content/uploads/2010/01/HideQuickLaunchCode-300x172.jpg" alt="HideQuickLaunchCode" width="300" height="172" /></a></p>
<p>6. Click <em>Save </em>and then <em>Ok</em> in the Web Part Settings frame and finally exit the <em>Editing Mode</em></p>
<p>7. You should now have a page that does not show the <em>Quick Launch </em>and we have done this by overriding the style sheet. If parts of the navigation is still showing you need to override more attributes and to know which ones I recommend you to use the IE Developer Toolbar.</p>
<p>This IE plugin from Microsoft makes it easy to click on an object on a web site and show what attributes or classes it is using. If you are using IE 6 or 7 you can download it from here: <a href="http://www.microsoft.com/downloads/details.aspx?familyid=e59c3964-672d-4511-bb3e-2d5e1db91038&amp;displaylang=en">http://www.microsoft.com/downloads/details.aspx?familyid=e59c3964-672d-4511-bb3e-2d5e1db91038&amp;displaylang=en</a></p>
<p>And if you are running IE 8 which is default in Windows 7 you have it already built in, how to use it can be found here:<br />
<a href="http://msdn.microsoft.com/sv-se/library/dd565628(en-us,VS.85).aspx">http://msdn.microsoft.com/sv-se/library/dd565628(en-us,VS.85).aspx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://mysharepointofview.com/2010/01/hide-the-quick-launch-navigation-the-easy-way/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>How web.config changes are handled by SharePoint</title>
		<link>http://mysharepointofview.com/2009/12/how-web-config-changes-are-handled-by-sharepoint/</link>
		<comments>http://mysharepointofview.com/2009/12/how-web-config-changes-are-handled-by-sharepoint/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 08:03:47 +0000</pubDate>
		<dc:creator>Mattias Karlsson</dc:creator>
				<category><![CDATA[Script]]></category>
		<category><![CDATA[MOSS]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[web.config]]></category>
		<category><![CDATA[WSS]]></category>

		<guid isPermaLink="false">http://mysharepointofview.com/?p=698</guid>
		<description><![CDATA[Have you ever thought about how SharePoint handles web.config changes? Honestly I haven’t put much attention to it either, until I recently where involved in joining a new Web Front End server to a farm. The Web Applications that was on the farm had a few customizations in the web.config file added programmatically using the [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever thought about how SharePoint handles web.config changes? Honestly I haven’t put much attention to it either, until I recently where involved in joining a new Web Front End server to a farm. The Web Applications that was on the farm had a few customizations in the web.config file added programmatically using the <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spwebconfigmodification.aspx" target="_blank">SPWebConfigModification</a> class. But there were also one setting that was added manually.</p>
<p>There is a big difference in how this is handled within SharePoint. Because if you do it through the API, all changes become “SharePoint aware” in the sense that all those entries are not only added to all web.config file on all the WFE servers but it is actually added to the config db (Objects table). So when in this case adding a new server, SharePoint takes the web.config template and then pulls the customized entries from the config db. Any manually added entries will therefor not be provisioned out to the new WFE server.</p>
<p>The entries added to web.config through the API can be found in the object table and if you want, you can make the following query against the table in SQL Server Management Studio to see all the entries you have.</p>
<p><span style="color: #3366ff;">Select * from <span style="color: #000000;">dbo.objects nolock </span>where <span style="color: #000000;">name</span> like <span style="color: #ff0000;">&#8216;webconfigchanges%&#8217;</span></span></p>
<p>So a best practice is to always use the API to make changes in web.config and if something is not possible to add programmatically into it, make sure to document it properly.</p>
<p>Mark Wagnar has written an excellent post with more information on how to modify the web.config using the <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spwebconfigmodification.aspx" target="_blank">SPWebConfigModification</a> class found here: <a href="http://www.crsw.com/mark/Lists/Posts/Post.aspx?ID=32">http://www.crsw.com/mark/Lists/Posts/Post.aspx?ID=32</a></p>
]]></content:encoded>
			<wfw:commentRss>http://mysharepointofview.com/2009/12/how-web-config-changes-are-handled-by-sharepoint/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Updated version of the Create Web Application script</title>
		<link>http://mysharepointofview.com/2009/12/updated-version-of-the-create-web-application-script/</link>
		<comments>http://mysharepointofview.com/2009/12/updated-version-of-the-create-web-application-script/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 08:58:54 +0000</pubDate>
		<dc:creator>Mattias Karlsson</dc:creator>
				<category><![CDATA[Script]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Site Collection]]></category>
		<category><![CDATA[Web Application]]></category>

		<guid isPermaLink="false">http://mysharepointofview.com/?p=688</guid>
		<description><![CDATA[I have got a lot of good feedback on the WebApplicationBuilder script that I did during the summer. I have finally got some time to update it to make it bit better, but be patient, there are still a lot of room improvements.
This is what is done.
You now execute the script by using the following:
SP-WebAppBuilder.ps1 -configpath [...]]]></description>
			<content:encoded><![CDATA[<p>I have got a lot of good feedback on the WebApplicationBuilder script that I did during the summer. I have finally got some time to update it to make it bit better, but be patient, there are still a lot of room improvements.</p>
<p>This is what is done.</p>
<p>You now execute the script by using the following:</p>
<p>SP-WebAppBuilder.ps1 -configpath [path to configfile.xml] -Webapplication [yes/no] -SiteCollection [yes/no]</p>
<p>The configpath is same as before. It&#8217;s created from an Excel file found in the Zip-file. More information on how to use it is found here:</p>
<p>What is new is that I have added two switches. -<em>WebApplication</em> and -<em>SiteCollection. </em>This gives the possibility to choose if you only want to create the Web Applications, only the Site Collections or both. This is especially useful in scenarios where the Site templates are added in a soluion. In those Cases you need to first add the Web Application, Add the solution with the Template inside and then create the SiteCollection.</p>
<p>What I have also done is to add a -help switch to be able to see the syntax and reference.</p>
<p>You find the updated code <a href="http://mysharepointofview.com/wp-content/plugins/download-monitor/download.php?id=1" title="SP-WebApplicationBuilder">here</a> or in the <a href="/downloads">download</a> section. More about the script itself from  can be found in my older post: <a href="http://mysharepointofview.com/2009/09/copy-items-from-one-list-to-another-using-powershell/">Web Application Builder</a>.</p>
<p>In next updated version I&#8217;m thinking of adding logging and better error handling, or should I say, add error handling. Hey, don&#8217;t muck me, I&#8217;m an Admin, not a Developer <img src='http://mysharepointofview.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://mysharepointofview.com/2009/12/updated-version-of-the-create-web-application-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Update of Copy-SPItems script</title>
		<link>http://mysharepointofview.com/2009/10/update-of-copy-spitems-script/</link>
		<comments>http://mysharepointofview.com/2009/10/update-of-copy-spitems-script/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 13:05:50 +0000</pubDate>
		<dc:creator>Mattias Karlsson</dc:creator>
				<category><![CDATA[Script]]></category>
		<category><![CDATA[List]]></category>
		<category><![CDATA[MOSS]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[WSS]]></category>

		<guid isPermaLink="false">http://mysharepointofview.com/?p=567</guid>
		<description><![CDATA[I have been doing a small update my Copy-SPItems script that I wrote about here. The last version required that (at least if don&#8217;t want a lot of error messages) that the target list had the same columns. The script is now updated so that I check wheather or not the SharePoint list field exisit [...]]]></description>
			<content:encoded><![CDATA[<p>I have been doing a small update my Copy-SPItems script that I wrote about <a href="http://mysharepointofview.com/2009/09/copy-items-from-one-list-to-another-using-powershell/">here</a>. The last version required that (at least if don&#8217;t want a lot of error messages) that the target list had the same columns. The script is now updated so that I check wheather or not the SharePoint list field exisit or not.</p>
<p>This is done by using an &#8220;where&#8221; statement like this.</p>
<p>if($OpenTargetList.Fields | Where { $_.InternalName –eq $OpenSourceListField.InternalName}) {</p>
<p>}</p>
<p>To dowload the script click <a href="http://mysharepointofview.com/wp-content/plugins/download-monitor/download.php?id=7" title="Copy-SPItems">Download</a> or you will find it on my <a href="http://mysharepointofview.com/downloads">downloads</a> section</p>
]]></content:encoded>
			<wfw:commentRss>http://mysharepointofview.com/2009/10/update-of-copy-spitems-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
