[MissingSetupFile] - Delete MissingSetupFile issues from the SharePoint Health Analyzer using PowerShell
Paste this code in PowerShell:
function Run-SQLQuery ($SqlServer, $SqlDatabase, $SqlQuery)
{
$SqlConnection = New-Object System.Data.SqlClient.SqlConnection
$SqlConnection.ConnectionString = "Server =" + $SqlServer + "; Database =" + $SqlDatabase + "; Integrated Security = True"
$SqlCmd = New-Object System.Data.SqlClient.SqlCommand
$SqlCmd.CommandText = $SqlQuery
$SqlCmd.Connection = $SqlConnection
$SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
$SqlAdapter.SelectCommand = $SqlCmd
$DataSet = New-Object System.Data.DataSet
$SqlAdapter.Fill($DataSet)
$SqlConnection.Close()
$DataSet.Tables[0]
}
Set the parameters, sql instance name, the sql contentdatabase and the file path from the log of health analyzer:
Run-SQLQuery -SqlServer "SQLSERVERINSTANCE" -SqlDatabase "WSS_Intranet01" -SqlQuery "SELECT * from AllDocs where SetupPath = 'Features\WebParts_WebPats\ComunicationListWebPart\ComunicationListWebPart.webpart'" | select Id, SiteId, DirName, LeafName, WebId, ListId | Format-List
And get the SiteID, WebID and fileID and run the next script:
$site = Get-SPSite -Limit all | where { $_.Id -eq "f3e8e078-decc-49f8-9bd5-066653be4291" }
$web = $site | Get-SPWeb -Limit all | where { $_.Id -eq "6f017d1e-5611-438f-b874-95bb8a294fc0" }
$file = $web.GetFile([Guid]”b2226b33-15f0-42d6-b070-b37a0d0dd3b4”)
$file.Delete()
Repeat for all errors.
function Run-SQLQuery ($SqlServer, $SqlDatabase, $SqlQuery)
{
$SqlConnection = New-Object System.Data.SqlClient.SqlConnection
$SqlConnection.ConnectionString = "Server =" + $SqlServer + "; Database =" + $SqlDatabase + "; Integrated Security = True"
$SqlCmd = New-Object System.Data.SqlClient.SqlCommand
$SqlCmd.CommandText = $SqlQuery
$SqlCmd.Connection = $SqlConnection
$SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
$SqlAdapter.SelectCommand = $SqlCmd
$DataSet = New-Object System.Data.DataSet
$SqlAdapter.Fill($DataSet)
$SqlConnection.Close()
$DataSet.Tables[0]
}
Set the parameters, sql instance name, the sql contentdatabase and the file path from the log of health analyzer:
Run-SQLQuery -SqlServer "SQLSERVERINSTANCE" -SqlDatabase "WSS_Intranet01" -SqlQuery "SELECT * from AllDocs where SetupPath = 'Features\WebParts_WebPats\ComunicationListWebPart\ComunicationListWebPart.webpart'" | select Id, SiteId, DirName, LeafName, WebId, ListId | Format-List
And get the SiteID, WebID and fileID and run the next script:
$site = Get-SPSite -Limit all | where { $_.Id -eq "f3e8e078-decc-49f8-9bd5-066653be4291" }
$web = $site | Get-SPWeb -Limit all | where { $_.Id -eq "6f017d1e-5611-438f-b874-95bb8a294fc0" }
$file = $web.GetFile([Guid]”b2226b33-15f0-42d6-b070-b37a0d0dd3b4”)
$file.Delete()
Repeat for all errors.
Comments
Post a Comment