简单的Powershell脚本,用于识别然后从站点删除root .aspx文件 [英] Simple Powershell script to identify and then delete root .aspx files from Site

查看:58
本文介绍了简单的Powershell脚本,用于识别然后从站点删除root .aspx文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果这个答案已经存在,请提前道歉......我已经做了很多寻找这个解决方案。


背景:



  • 在继承的ContentDb上运行Test-SPContentDatabase后,我有1000个Missingwebpart引用要删除(不是重新安装!)。测试SPContentDatabase的输出中显示了82个此类引用的示例:

"消息: WebPart类[ff8accb7-afc5-66d9-b6b3-10d05a7f9f45]被引用[ 82]数据库中的时间[xxx] ...."




任务:



  • 因此,我需要将一个简单的PowerShell脚本放在一起,删除这些脚本,因为手动(从SharePoint Designer)执行此操作需要数周时间。
  • 从sql查询中我知道需要删除的所有这些"引用"(所有.aspx文件)的位置 - 它们存在于网站集的根目录或它的50多个子站点的根。从检查此输出我知道主要有大约
    45问题.aspx文件存在于大约50个子网站(以及网站集根目录本身)
  • 有人可以提供简单的PowerShell脚本首先列出,然后选择删除这些?显然我不想删除所有Root文件,因此我需要能够识别我识别出的45个文件。

我想要实现的逻辑


  1. $ Location =<网站集的路径> (或"当我解决这些问题时,网站收集/子网站的路径")
  2. <列出上述位置的根文件夹中的所有文件>所以我可以在进展之前看到所有文件。
  3. $ WebPartReferenceToDelete ="< Get RootFolder>"其中filename ="1.aspx"或"2.aspx"....或"45.aspx"
  4. < List $ WebPartReferenceToDelete>删除之前
  5. #Delete $ WebPartReferenceToDelete中的已识别文件(我将在开始时将其取消开启。)

这将允许我删除网站上的45个文件,我对此非常满意。显然,如果它可以选择循环遍历一个有用的站点列表,我相信这些文件可以一举进行。

解决方案

Hello Jason,


您可以找到清理脚本您想要执行 https://gallery.technet.microsoft.com/sharepoint/post-upgrade -cleanup-35099a7a


最好的问候,



Apologies in advance if this answer is already out there…I have done a fair bit of searching for this solution.

Background:

  • After running Test-SPContentDatabase on an inherited ContentDb I have 1000’s of Missingwebpart references to delete (not reinstall!). An example of 82 such references is shown in the output from Test-SPContentDatabase here:

"Message: WebPart class [ff8accb7-afc5-66d9-b6b3-10d05a7f9f45] is referenced [82] times in the database [xxx]…."

Task:

  • I need therefore to put a simple PowerShell script together that will delete these as doing it manually (from SharePoint Designer) would take weeks.
  • From a sql query I know the location of all these ‘references’ (all .aspx files) that need to be deleted – and they exist at the root of either the Site Collection or the root of its 50-odd sub sites. From examining this output I know that there are mainly 45 problem .aspx files that exist on about 50 subsites (as well as the Site Collection root itself)
  • Could someone provide a simple PowerShell script to firstly list and then with the option of deleting these? Obviously I don’t want to delete all Root files so I need the ability to identify the 45 I’ve identified.

Logic of what I'm looking to achieve

  1. $Location = <Path of Site Collection> (or ‘Path of Site Collection/Subsite’ for when I address these)
  2. <List all files in root folder for above location> so I can see all the files before progressing
  3. $WebPartReferenceToDelete = "<Get RootFolder>" where filename = "1.aspx" or "2.aspx" …. or "45.aspx"
  4. <List $WebPartReferenceToDelete> prior to deletion
  5. #Delete above identified files in $WebPartReferenceToDelete (which I will unhash once happy to proceed.)

This would allow me to delete the 45 files on a site by site basis and I’d be very happy with that. Obviously if it could optionally loop through a list of sites that would be useful to use once I’m confident that these files can go in one fell swoop.

解决方案

Hello Jason,

You can find the scripts for the cleanup you want to perform https://gallery.technet.microsoft.com/sharepoint/post-upgrade-cleanup-35099a7a

Best Regards,


这篇关于简单的Powershell脚本,用于识别然后从站点删除root .aspx文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆