我有一个大型XML文件。它包含我的SharePoint 2010迁移检查日志(我们正准备进行07到10的迁移)。我对显示所有缺失的webpart所在的部分感兴趣,特别是他们的URL。我一直在尝试使用PS SP10工具发现的每个guid来识别相关的站点URL。我对Powershell比较陌生,如果有一种简单的方法来获取数据,我很好奇吗?
get-childitem R:\testfile.xml | select-string -pattern "c7843aae-4c86-8206-0125-d00117cb461c"
返回每个实例,例如: testfile.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>
答案 0 :(得分:0)
您可以这样做:
$xml.SelectNodes("//Web") | %{
if($_.SelectNodes("./WebParts/WebPart") | ?{ $_.id -eq "f6bfd4dd-e6b5-7cb0-e080-e7674fcdd856" } ){
$_.Url
}
}
在这里,我正在寻找guid f6bfd4dd-e6b5-7cb0-e080-e7674fcdd856
并返回/ssp/admin/xxxxa
,即网络的网址