{"id":1961,"date":"2012-04-25T00:19:39","date_gmt":"2012-04-25T00:19:39","guid":{"rendered":"https:\/\/www.wapshere.com\/missmiis\/?p=1961"},"modified":"2012-04-25T00:19:39","modified_gmt":"2012-04-25T00:19:39","slug":"using-powershell-to-update-an-rcdc-configuration","status":"publish","type":"post","link":"https:\/\/www.wapshere.com\/missmiis\/using-powershell-to-update-an-rcdc-configuration","title":{"rendered":"Using Powershell to update an RCDC configuration"},"content":{"rendered":"<p>I was stuck\u00c2\u00a0in one of those loops where you&#8217;re trying to track down an error in a RCDC by commenting out sections of the configuration file, uploading, recycling app pool, refreshing your browser, testing, go back to the beginning&#8230; I thought &#8220;there&#8217;s got to be a better way!&#8221; &#8211; and, as is so often the case, the better way is to write a quick powershell script.<\/p>\n<p><!--more--><\/p>\n<p>This script updates the ConfigurationData attribute of the named RCDC with the contents of a file. It then recycles the Sharepoint &#8211; 80 app pool.<\/p>\n<pre>PARAM($RCDCName, $FilePath)\r\n\r\n# Get FIMPowershell.ps1 from http:\/\/technet.microsoft.com\/en-us\/library\/ff720152(v=ws.10).aspx\r\n. .\/FIMPowershell.ps1\r\n\r\n# Update Configuration\r\n\r\n$content = Get-Content $FilePath\r\n\r\n$filter = \"\/ObjectVisualizationConfiguration[DisplayName = '\" + $RCDCName + \"']\"\r\n$RCDC = export-fimconfig -customconfig ($filter)\r\n\r\n$ModifyImportObject = ModifyImportObject -TargetIdentifier $RCDC.ResourceManagementObject.ObjectIdentifier -ObjectType \"ObjectVisualizationConfiguration\"\r\nSetSingleValue $ModifyImportObject \"ConfigurationData\" $content\r\nimport-fimconfig -importObject $ModifyImportObject\r\n\r\n# Recycle App Pool\r\n\r\n$AppPool = \"W3SVC\/APPPOOLS\/SharePoint - 80\"\r\n$Path = \"IISApplicationPool.Name='$AppPool'\"\r\n\r\nInvoke-WMIMethod Recycle -Path $Path  -Namespace root\\MicrosoftIISv2 -Authentication PacketPrivacy<\/pre>\n<p>&nbsp;<\/p>\n<p>The one thing this won&#8217;t do is stop that first connection error when you go to test. I tried Thomas&#8217; <a href=\"http:\/\/setspn.blogspot.com.au\/2011\/06\/fim-2010-warm-up-your-portal-iis.html\">warm up FIM <\/a>approach but it didn&#8217;t work for me &#8211; possibly because I was testing using a different account to the one that had &#8220;touched&#8221; the Portal.<\/p>\n<p>In case you&#8217;re wondering whether I&#8217;m so random in my RCDC changes that I couldn&#8217;t just back out the last change &#8211; it was a transfer of configuration between environments that triggered the error, and actually permissions were at fault, but I didn&#8217;t know which permissions until I&#8217;d identified the faulty RCDC controls. Somehow two attributes appeared to be in the MPR, but the rights weren&#8217;t\u00c2\u00a0assigned.\u00c2\u00a0I removed and re-added the attributes and then the RCDC worked properly. Some kind of issue with the config migration I guess.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was stuck\u00c2\u00a0in one of those loops where you&#8217;re trying to track down an error in a RCDC by commenting out sections of the configuration file, uploading, recycling app pool, refreshing your browser, testing, go back to the beginning&#8230; I thought &#8220;there&#8217;s got to be a better way!&#8221; &#8211; and, as is so often the&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":[]},"categories":[42,23,51],"tags":[],"class_list":["post-1961","post","type-post","status-publish","format-standard","hentry","category-fim-2010","category-powershell","category-rcdc"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pkp1o-vD","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts\/1961","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/comments?post=1961"}],"version-history":[{"count":7,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts\/1961\/revisions"}],"predecessor-version":[{"id":1968,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/posts\/1961\/revisions\/1968"}],"wp:attachment":[{"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/media?parent=1961"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/categories?post=1961"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wapshere.com\/missmiis\/wp-json\/wp\/v2\/tags?post=1961"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}