############################################################################################################################################
# GetAllFeature_Scope_in_Total_Farm
# Parameters: N/A
# Created By : Suresh Kumar Durairaj
############################################################################################################################################
If ((Get-PSSnapIn -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null )
{ Add-PSSnapIn -Name Microsoft.SharePoint.PowerShell }
$host.Runspace.ThreadOptions = "ReuseThread"
$resultsarray =@()
#Function that gets the size of all the content databases
function Get-ContentDBSizes
{
try
{
$siteFeatures = Get-SPFeature | Where-Object {$_.Scope -eq "Farm" } # Farm, WebApp, Site and Web
if ($siteFeatures -ne $null)
{
foreach ($feature in $siteFeatures)
{
$contactObject = new-object PSObject
# Add our data to $contactObject as attributes using the add-member commandlet
$contactObject | add-member -membertype NoteProperty -name "features_Title" -Value $feature.DisplayName
$contactObject | add-member -membertype NoteProperty -name "feature_Hidden" -Value $feature.Hidden
$contactObject | add-member -membertype NoteProperty -name "Scope" -Value $feature.Scope
$contactObject | add-member -membertype NoteProperty -name "Feature ID" -Value $feature.ID
# Save the current $contactObject by appending it to $resultsArray ( += means append a new element to ‘me’)
$resultsarray += $contactObject
}
}
$siteFeatures = Get-SPFeature | Where-Object {$_.Scope -eq "WebApp" } # Farm, WebApp, Site and Web
if ($siteFeatures -ne $null)
{
foreach ($feature in $siteFeatures)
{
$contactObject = new-object PSObject
# Add our data to $contactObject as attributes using the add-member commandlet
$contactObject | add-member -membertype NoteProperty -name "features_Title" -Value $feature.DisplayName
$contactObject | add-member -membertype NoteProperty -name "feature_Hidden" -Value $feature.Hidden
$contactObject | add-member -membertype NoteProperty -name "Scope" -Value $feature.Scope
$contactObject | add-member -membertype NoteProperty -name "Feature ID" -Value $feature.ID
# Save the current $contactObject by appending it to $resultsArray ( += means append a new element to ‘me’)
$resultsarray += $contactObject
}
}
$siteFeatures = Get-SPFeature | Where-Object {$_.Scope -eq "Site" } # Farm, WebApp, Site and Web
if ($siteFeatures -ne $null)
{
foreach ($feature in $siteFeatures)
{
$contactObject = new-object PSObject
# Add our data to $contactObject as attributes using the add-member commandlet
$contactObject | add-member -membertype NoteProperty -name "features_Title" -Value $feature.DisplayName
$contactObject | add-member -membertype NoteProperty -name "feature_Hidden" -Value $feature.Hidden
$contactObject | add-member -membertype NoteProperty -name "Scope" -Value $feature.Scope
$contactObject | add-member -membertype NoteProperty -name "Feature ID" -Value $feature.ID
# Save the current $contactObject by appending it to $resultsArray ( += means append a new element to ‘me’)
$resultsarray += $contactObject
}
}
$siteFeatures = Get-SPFeature | Where-Object {$_.Scope -eq "Web" } # Farm, WebApp, Site and Web
if ($siteFeatures -ne $null)
{
foreach ($feature in $siteFeatures)
{
$contactObject = new-object PSObject
# Add our data to $contactObject as attributes using the add-member commandlet
$contactObject | add-member -membertype NoteProperty -name "features_Title" -Value $feature.DisplayName
$contactObject | add-member -membertype NoteProperty -name "feature_Hidden" -Value $feature.Hidden
$contactObject | add-member -membertype NoteProperty -name "Scope" -Value $feature.Scope
$contactObject | add-member -membertype NoteProperty -name "Feature ID" -Value $feature.ID
# Save the current $contactObject by appending it to $resultsArray ( += means append a new element to ‘me’)
$resultsarray += $contactObject
}
}
$resultsarray| Export-csv "C:\Temp\GetAllFeature_Scope_in_Total_Farm.csv" -notypeinformation
}
catch [System.Exception]
{
write-host -f red $_.Exception.ToString()
}
}
Start-SPAssignment –Global
Get-ContentDBSizes
Stop-SPAssignment –Global
Remove-PsSnapin Microsoft.SharePoint.PowerShell
# GetAllFeature_Scope_in_Total_Farm
# Parameters: N/A
# Created By : Suresh Kumar Durairaj
############################################################################################################################################
If ((Get-PSSnapIn -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null )
{ Add-PSSnapIn -Name Microsoft.SharePoint.PowerShell }
$host.Runspace.ThreadOptions = "ReuseThread"
$resultsarray =@()
#Function that gets the size of all the content databases
function Get-ContentDBSizes
{
try
{
$siteFeatures = Get-SPFeature | Where-Object {$_.Scope -eq "Farm" } # Farm, WebApp, Site and Web
if ($siteFeatures -ne $null)
{
foreach ($feature in $siteFeatures)
{
$contactObject = new-object PSObject
# Add our data to $contactObject as attributes using the add-member commandlet
$contactObject | add-member -membertype NoteProperty -name "features_Title" -Value $feature.DisplayName
$contactObject | add-member -membertype NoteProperty -name "feature_Hidden" -Value $feature.Hidden
$contactObject | add-member -membertype NoteProperty -name "Scope" -Value $feature.Scope
$contactObject | add-member -membertype NoteProperty -name "Feature ID" -Value $feature.ID
# Save the current $contactObject by appending it to $resultsArray ( += means append a new element to ‘me’)
$resultsarray += $contactObject
}
}
$siteFeatures = Get-SPFeature | Where-Object {$_.Scope -eq "WebApp" } # Farm, WebApp, Site and Web
if ($siteFeatures -ne $null)
{
foreach ($feature in $siteFeatures)
{
$contactObject = new-object PSObject
# Add our data to $contactObject as attributes using the add-member commandlet
$contactObject | add-member -membertype NoteProperty -name "features_Title" -Value $feature.DisplayName
$contactObject | add-member -membertype NoteProperty -name "feature_Hidden" -Value $feature.Hidden
$contactObject | add-member -membertype NoteProperty -name "Scope" -Value $feature.Scope
$contactObject | add-member -membertype NoteProperty -name "Feature ID" -Value $feature.ID
# Save the current $contactObject by appending it to $resultsArray ( += means append a new element to ‘me’)
$resultsarray += $contactObject
}
}
$siteFeatures = Get-SPFeature | Where-Object {$_.Scope -eq "Site" } # Farm, WebApp, Site and Web
if ($siteFeatures -ne $null)
{
foreach ($feature in $siteFeatures)
{
$contactObject = new-object PSObject
# Add our data to $contactObject as attributes using the add-member commandlet
$contactObject | add-member -membertype NoteProperty -name "features_Title" -Value $feature.DisplayName
$contactObject | add-member -membertype NoteProperty -name "feature_Hidden" -Value $feature.Hidden
$contactObject | add-member -membertype NoteProperty -name "Scope" -Value $feature.Scope
$contactObject | add-member -membertype NoteProperty -name "Feature ID" -Value $feature.ID
# Save the current $contactObject by appending it to $resultsArray ( += means append a new element to ‘me’)
$resultsarray += $contactObject
}
}
$siteFeatures = Get-SPFeature | Where-Object {$_.Scope -eq "Web" } # Farm, WebApp, Site and Web
if ($siteFeatures -ne $null)
{
foreach ($feature in $siteFeatures)
{
$contactObject = new-object PSObject
# Add our data to $contactObject as attributes using the add-member commandlet
$contactObject | add-member -membertype NoteProperty -name "features_Title" -Value $feature.DisplayName
$contactObject | add-member -membertype NoteProperty -name "feature_Hidden" -Value $feature.Hidden
$contactObject | add-member -membertype NoteProperty -name "Scope" -Value $feature.Scope
$contactObject | add-member -membertype NoteProperty -name "Feature ID" -Value $feature.ID
# Save the current $contactObject by appending it to $resultsArray ( += means append a new element to ‘me’)
$resultsarray += $contactObject
}
}
$resultsarray| Export-csv "C:\Temp\GetAllFeature_Scope_in_Total_Farm.csv" -notypeinformation
}
catch [System.Exception]
{
write-host -f red $_.Exception.ToString()
}
}
Start-SPAssignment –Global
Get-ContentDBSizes
Stop-SPAssignment –Global
Remove-PsSnapin Microsoft.SharePoint.PowerShell
No comments:
Post a Comment