【发布时间】:2012-01-09 02:07:15
【问题描述】:
我有一个很大的 XML 文件。它包含我的 SharePoint 2010 迁移检查日志(我们正在为 07 到 10 的迁移做好准备)。我对显示所有缺少的 web 部件所在位置的部分感兴趣,特别是它们的 URL。我一直在尝试使用每个被 PS SP10 工具发现有问题的 guid 来识别关联的站点 URL。我对 Powershell 比较陌生,想知道是否有一种简单的方法来获取数据?
get-childitem R:\testfile.xml | select-string -pattern "c7843aae-4c86-8206-0125-d00117cb461c"
返回每个实例,例如: 测试文件.xml:112644: 但是,我需要与 webpart 关联的 URL。
$xml.databases.Database[1].Site[0].Webs.Web
(这与 testfile 相同) 是存储此信息的级别(给我 ID、URL、LanguageId、TemplateName、TemplateId、Features、EventRecieverAssemblies、WebParts、CustomListViews、SetupFiles)。
有没有办法组合这些命令?我只需要找到该 guid 的每个实例及其相关网站的 URL。感谢您的帮助,我是 PowerShell 的新手,我认为它可能可以帮助我完成此文档,而无需手动操作(该 gui 的实例显示了大约 85 次)。
非常感谢。还有,长期潜伏者,第一次发帖。
尼克
<Databases>
<Database SiteCount="2" Name="WSS_Content" DataSource="xxx">
<Site Id="ef5d110e-3562-4e4f-bdf4-0ee688e92701" OwnerLogin="xxxx" InSiteMap="True">
<Webs Count="1">
<Web Id="eb0591b4-0ccd-4834-8f97-abe9974b8a32" Url="site/xxxxxxa" LanguageId="1033" TemplateName="xxx#0" TemplateId="10001">
<Features>
<Feature Id="00bfea71-c796-4402-9f2f-0eb9a6e71b18" Count="1" DisplayName="WebPageLibrary" InstallPath="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\Template\Features\WebPageLibrary" Status="Installed" />
</Features>
<EventReceiverAssemblies>
<EventReceiverAssembly Name="Microsoft.Office.InfoPath.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Status="Installed" />
</EventReceiverAssemblies>
<WebParts>
<WebPart Id="ce9aa113-48cf-ddee-0c03-597445e5b7ab" Count="1" Status="Installed" Type="Microsoft.SharePoint.WebPartPages.ImageWebPart" />
<WebPart Id="293e8d0e-486f-e21e-40e3-75bfb77202de" Count="35" Status="Installed" Type="Microsoft.SharePoint.WebPartPages.ListFormWebPart" />
<WebPart Id="2242cce6-491a-657a-c8ee-b10a2a993eda" Count="35" Status="Installed" Type="Microsoft.SharePoint.WebPartPages.ListViewWebPart" />
</WebParts>
<CustomListViews />
<SetupFiles>
<SetupFile Path="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\Template\1033\STS\doctemp\word\wdtmpl.doc" Count="3" Status="Installed" />
<SetupFile Path="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\Template\Features\BasicWebParts\MSContentEditor.dwp" Count="1" Status="Installed" />
</SetupFiles>
</Web>
</Webs>
</Site>
<Site Id="389fa2ac-4b8a-4704-ad98-e49619c981a0" OwnerLogin="xxx\srv-xxx" InSiteMap="True">
<Webs Count="2">
<Web Id="3820015a-56cf-41b8-9607-bbed7775f514" Url="/site/xxxxx" LanguageId="1033" TemplateName="OSRV#0" TemplateId="40">
<Features>
<Feature Id="00bfea71-5932-4f9c-ad71-1557e5751100" Count="1" DisplayName="IssuesList" InstallPath="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\Template\Features\IssuesList" Status="Installed" />
</Features>
<EventReceiverAssemblies>
<EventReceiverAssembly Name="Microsoft.Office.InfoPath.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Status="Installed" />
<EventReceiverAssembly Name="Microsoft.Office.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Status="Installed" />
</EventReceiverAssemblies>
<WebParts>
<WebPart Id="d55b3b6b-6281-707b-73d0-0c49581475ad" Count="1" Status="Installed" Type="Microsoft.Office.Server.Search.WebControls.SearchStatsWebPart" />
<WebPart Id="6172b769-e922-1e5e-b706-1073173cbce3" Count="1" Status="Installed" Type="Microsoft.Office.Server.Search.WebControls.CompletedCrawls" />
<WebPart Id="bc0158dd-a329-57ce-3563-1afacb17ec6c" Count="1" Status="Installed" Type="Microsoft.Office.Server.Search.WebControls.SystemStatus" />
<WebPart Id="f5c3ff60-e752-3a90-84f8-3677f8384e2d" Count="2" Status="Installed" Type="Microsoft.Office.Server.Search.WebControls.CoreResultsWebPart" />
<WebPart Id="f2c50a02-9894-4ace-bb3f-4146a24cd940" Count="2" Status="Installed" Type="Microsoft.Office.Server.Search.WebControls.SearchPagingWebPart" />
<WebPart Id="c54a0f4e-d855-ad45-ef85-4e67abf15a4d" Count="1" Status="Installed" Type="Microsoft.Office.Server.Search.WebControls.ActiveCrawls" />
<WebPart Id="e60f6c95-e86c-4717-2c0d-6d8563c9caf7" Count="1" Status="Installed" Type="Microsoft.SharePoint.WebPartPages.ContentEditorWebPart" />
<WebPart Id="293e8d0e-486f-e21e-40e3-75bfb77202de" Count="29" Status="Installed" Type="Microsoft.SharePoint.WebPartPages.ListFormWebPart" />
<WebPart Id="2242cce6-491a-657a-c8ee-b10a2a993eda" Count="19" Status="Installed" Type="Microsoft.SharePoint.WebPartPages.ListViewWebPart" />
<WebPart Id="74bd016c-baa0-14a8-d5d8-b75dc7e6f429" Count="1" Status="Installed" Type="Microsoft.SharePoint.Portal.WebControls.ContactFieldControl" />
<WebPart Id="fb35a198-aea0-3c26-e40c-df473fe9b07b" Count="2" Status="Installed" Type="Microsoft.Office.Server.Search.WebControls.HighConfidenceWebPart" />
<WebPart Id="669602d9-e116-ccb8-eea3-e37ad589b14b" Count="1" Status="Installed" Type="Microsoft.Office.Server.Search.WebControls.SearchSummaryWebPart" />
<WebPart Id="f5897322-ddd4-c990-d012-f9d4fe2180ad" Count="2" Status="Installed" Type="Microsoft.SharePoint.Portal.WebControls.SearchBoxEx" />
</WebParts>
<CustomListViews />
<SetupFiles>
<SetupFile Path="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\Template\1033\STS\doctemp\word\wdtmpl.doc" Count="2" Status="Installed" />
</SetupFiles>
</Web>
<Web Id="d2e7ca33-fc74-4907-a34f-4c5ae1dbde84" Url="/ssp/admin/xxxxa" LanguageId="1033" TemplateName="PROFILES#0" TemplateId="51">
<Features>
<Feature Id="00bfea71-c796-4402-9f2f-0eb9a6e71b18" Count="1" DisplayName="WebPageLibrary" InstallPath="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\Template\Features\WebPageLibrary" Status="Installed" />
</Features>
<EventReceiverAssemblies />
<WebParts>
<WebPart Id="293e8d0e-486f-e21e-40e3-75bfb77202de" Count="6" Status="Installed" Type="Microsoft.SharePoint.WebPartPages.ListFormWebPart" />
<WebPart Id="2242cce6-491a-657a-c8ee-b10a2a993eda" Count="5" Status="Installed" Type="Microsoft.SharePoint.WebPartPages.ListViewWebPart" />
<WebPart Id="f6bfd4dd-e6b5-7cb0-e080-e7674fcdd856" Count="1" Status="Installed" Type="Microsoft.SharePoint.Portal.WebControls.BusinessDataDetailsWebPart" />
</WebParts>
<CustomListViews />
<SetupFiles>
<SetupFile Path="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\Template\1033\STS\doctemp\word\wdtmpl.doc" Count="1" Status="Installed" />
</SetupFiles>
</Web>
</Webs>
</Site>
</Database>
【问题讨论】:
-
你能举一个你正在使用的xml的例子吗?
-
当然这是 xml
<Databases> <Database> <Site> <Webs> <Web> (this level contains the site URL) <Features> <Feature> <WebParts> <WebPart> (this level has the ID used to Identify the part)的文件结构如果你想看到实际代码让我知道,我必须在某个地方有一个文件主机。感谢您的帮助 -
编辑您的问题并附加一个具体的 xml,可能来自 testfile.xml (不像您上面的内容)。相关代码也会有所帮助
-
添加了一些testfile.xml,编辑了一些信息以适应这里。到目前为止,谢谢。
标签: xml sharepoint powershell migration