PowerShell kullanarak SharePoint'teki Tüm Site Koleksiyonlarında Özelliği Etkinleştirme-Devre Dışı Bırakma
SharePoint 2013'te “Enable-SPFeature” ve ” Disable-SPFeature” PowerShell cmdlet'lerini kullanıyoruz/SharePoint 2016 sitelerinin özelliklerini etkinleştirmek veya devre dışı bırakmak için diğer makalemdeki gibi: SharePoint'te Özellikler Nasıl Etkinleştirilir-Devre Dışı Bırakılır. Bazen özelliği tüm site koleksiyonları için etkinleştirmemiz veya özelliği tüm sitelerde devre dışı bırakmamız gerekebilir. İşte bunu yapmak için PowerShell komut dosyalarım.
SharePoint'teki tüm site koleksiyonları için bir özelliği etkinleştirin:
Benim durumumda, lisans sınırlaması nedeniyle belgelerin Office web uygulamaları yerine Microsoft Word gibi Office istemcilerinde açılmasını zorlamak için bir web uygulaması altındaki her site koleksiyonunda “Belgeleri İstemci Uygulamalarında Aç” özelliğini etkinleştirmek zorunda kaldım.
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
#variables
#$WebAppURL = "https://intranet.crescent.com"
$FeatureName ="OpenInClient"
#Get the Web Application
$webApp = Get-SPWebApplication -Identity $WebAppURL
#Get all site collections with in the web app
$SitesCollection = $WebApp | Get-SPSite -limit all
#Iterate through each site
foreach ($site in $SitesCollection)
{
#Check if feature is already activated
$feature = Get-SPFeature -site $site.Url | Where-object {$_.DisplayName -eq $FeatureName}
if($feature -eq $null)
{
#Enable the feature
Enable-SPFeature -Identity $FeatureName -url $site.url -Confirm:$False
Write-host "Feature Activated on $($site.URL)" -ForegroundColor Green
}
else
{
Write-host "Feature is already Active on $($site.URL)" -ForegroundColor Red
}
}
PowerShell Özelliğini Tüm Sitelerde Devre Dışı Bırakacak:
Gereksinim: SharePoint 2013 web uygulamasındaki tüm sitelerde "Mobil Yönlendirme" özelliğini devre dışı bırakın.
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
#Variables
$WebAppURL = "https://intranet.crescent.com"
$FeatureName = "MobilityRedirect"
#Disable Mobile View feature on all sites in the web application
$WebsCollection = Get-SPWebApplication $WebAppURL | Get-SPSite -Limit ALL | Get-SPWeb -Limit ALL
#Itereate through each web
ForEach($Web in $WebsCollection)
{
#Check if feature is already activated
$feature = Get-SPFeature -web $Web.Url | Where-object {$_.DisplayName -eq $FeatureName}
if($feature -ne $null)
{
#Disable the Mobile browser view feature
Disable-SPFeature -identity $FeatureName -URL $Web.URL -Force -Confirm:$false
write-host "Mobile Redirect feature deactivated at site: $($Web.Url)"
}
}