<?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>Tyler Butler &#187; powershell</title>
	<atom:link href="http://www.tylerbutler.com/tags/powershell/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tylerbutler.com</link>
	<description></description>
	<lastBuildDate>Fri, 14 Aug 2009 22:09:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PowerShell for Fun and Profit</title>
		<link>http://www.tylerbutler.com/2009/06/powershell-for-fun-and-profit/</link>
		<comments>http://www.tylerbutler.com/2009/06/powershell-for-fun-and-profit/#comments</comments>
		<pubDate>Mon, 15 Jun 2009 19:20:29 +0000</pubDate>
		<dc:creator>Tyler</dc:creator>
				<category><![CDATA[Work]]></category>
		<category><![CDATA[content deployment]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[sharepoint]]></category>

		<guid isPermaLink="false">http://www.tylerbutler.com/?p=460</guid>
		<description><![CDATA[Stefan Goßner has a great post on his blog covering some common problems that people have with Content Deployment in SharePoint. Problem 13 has to do with the default timeout window for Content Deployment jobs. Stefan provides some sample code that you can use to adjust the timeout value, since it’s not exposed through the [...]]]></description>
			<content:encoded><![CDATA[<p>Stefan Goßner has a great post on his blog covering <a href="http://blogs.technet.com/stefan_gossner/pages/content-deployment-best-practices.aspx">some common problems</a> that people have with Content Deployment in SharePoint. Problem 13 has to do with the default timeout window for Content Deployment jobs. Stefan provides some sample code that you can use to adjust the timeout value, since it’s not exposed through the UI, but I find writing and running sample code on a server a bit of a pain. Instead of writing code, you can actually use PowerShell to do this directly from the PS prompt.</p>
<p>The key to doing this is loading the SharePoint DLLs into your PowerShell environment. You can do this using the <span class="monospace">System.Reflection.Assembly</span> class. Take a look at this sample script:</p>
<pre class="brush: plain; wrap-lines: false;">param( $newTimeout = 600 )

[System.Reflection.Assembly]::Load(&quot;Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c&quot;)

$cdconfig = [Microsoft.SharePoint.Publishing.Administration.ContentDeploymentConfiguration]::GetInstance()

$cdconfig.RemoteTimeout = $newTimeout
$cdconfig.Update()

&quot;Updated RemoteTimeout to $newTimeout seconds.&quot;</pre>
<p>In line 3, I load up the <span class="monospace">Microsoft.SharePoint.Publishing</span> DLL, then I grab the <span class="monospace">ContentDeploymentConfiguration</span> (line 5) using the <span class="monospace">GetInstance()</span> static method. I update the <span class="monospace">RemoteTimeout</span> property, then call <span class="monospace">Update()</span>, and we’re done. No code to write and compile.</p>
<p>This example uses the <span class="monospace">param</span> keyword, which means you can save it as <span class="monospace">ChangeRemoteTimeout.ps1</span>, then run it like this:</p>
<p><code>PS C:\&gt; ChangeRemoteTimeout –newTimeout 1200</code> </p>
<p>This is completely optional, of course, but if you find yourself doing this a lot, it might be worth saving it as a reusable script.</p>
<p>You might also want to make changes to some of the options that are exposed through the UI already. Here’s an example:</p>
<pre class="brush: plain; wrap-lines: false;">PS C:\&gt; [System.Reflection.Assembly]::Load(&quot;Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c&quot;)
PS C:\&gt; $cdconfig = [Microsoft.SharePoint.Publishing.Administration.ContentDeploymentConfiguration]::GetInstance()
PS C:\&gt; $cdconfig.AcceptIncomingJobs = $true
PS C:\&gt; $cdconfig.RequiresSecureConnection = $false
PS C:\&gt; $cdconfig.Update()</pre>
<p>In this case, I’m configuring the farm to accept incoming deployment jobs and not require secure connections. You can also make additional changes to other properties, such as FileMaxSize and RemotePollingInterval using this method. Stefan covers these properties in his <a href="http://blogs.technet.com/stefan_gossner/archive/2008/05/28/pimp-my-content-deployment-job.aspx">Pimp My Content Deployment Job</a> post.</p>
<p>One other note… Using .NET DLLs in PowerShell is generally supported across the board. It’s not limited to the SharePoint DLLs. There’s some pretty exciting stuff you can do here once you start playing around.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tylerbutler.com/2009/06/powershell-for-fun-and-profit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
