SharePoint 2013 Missing server side dememdencies

Bob Kemmerer 21 Reputation points
2022-12-28T19:43:14.997+00:00

Using a PS script to remove missing features, however I have a few hundred missing features with multiple Site IDs. Looking for a way to make this less painfull. Not sure how to do a foreach on the site ids so commenting and uncommenting for each feature. Using this script

$featureID = "c4615dbf-c594-4fe2-b1c0-f939eb41af9d"

$siteID = "95BDFCA4-751D-476D-BFBE-04565B9DEA89"

$siteID = "0C80A1A4-32B0-48FB-A2A5-57EEA6A47435"

$siteID = "19EA148E-C8BA-433B-B44D-58732DFE32B3"

$siteID = "EAB46BF9-C017-42D3-8A8E-B5A11C2C06DB"

$siteID = "8FAC17C6-7444-4939-8128-FE3DB744DDD0"

Display site information

$site = Get-SPSite $siteID
Write-Host "Checking Site:" $site.Url

Remove the feature from all subsites

ForEach ($web in $Site.AllWebs)
{
If($web.Features[$featureID])
{
Write-Host "nFound Feature $featureID in web:"$Web.Url"nRemoving feature"
$web.Features.Remove($featureID, $true)
}
else
{
Write-Host "`nDid not find feature $featureID in web:" $Web.Url
}
}

Remove the feature from the site collection

If ($Site.Features[$featureID])
{
Write-Host "nFound feature $featureID in site:"$site.Url"nRemoving Feature"
$site.Features.Remove($featureID, $true)
}
else
{
Write-Host "Did not find feature $featureID in site:" $site.Url
}

SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
3,470 questions
0 comments No comments
{count} votes

Accepted answer
  1. Xyza Xue_MSFT 29,526 Reputation points Microsoft External Staff
    2022-12-29T06:41:28.97+00:00

    Hi @Bob Kemmerer ,
    You can put all the siteIDs into a .csv file, and then automatically call them in sequence through foreach.
    Here are steps:
    1.Enter all siteID in a .csv file. Stored in C:\ path.
    274656-image.png
    2.Form siteID as table(Title is "siteID")
    274696-image.png
    Execute a foreach for siteID, like this:

    #Config Variables  
    $siteID = Import-CSV -path "C:\siteID.csv" -Header("siteID") #Site Relative Path of the Library  
    
    foreach ($ID in $siteID )  
    {  
    $site = Get-SPSite $ID.siteID  
    Write-Host "Checking Site:" $site.Url  
    Remove the feature code......  
    }   
    

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.