When I try to run this cmdlet, I receive the following errors (only sometimes):
Disabling feature: SPFeatureDefinition Name=FeatureDefinition/b89234a6-xxxx-xxxx-xxxx-200dd03e1fdd ( XXXStructures_XXXContentTypes , b89234a6-xxxx-xxxx-xxxx-200dd03e1fdd ) VERBOSE: Leaving BeginProcessing Method of Disable-SPFeature. VERBOSE: Performing operation "Disable-SPFeature" on Target "Site Scope |b89234a6-xxxx-xxxx-xxxx-200dd03e1fdd". Disable-SPFeature : Cannot complete this action. Please try again.
The part of the script that is producing this is...
foreach ($feature in $features) {
if ($feature -ne $null) {
Write-Host "`nDisabling feature: " $feature "(" $feature.DisplayName "," $feature.ID ")"
Disable-SPFeature $feature -url <my URL> -Confirm:$false -Force -verbose
Start-Sleep -Seconds 10
}