<#
******-----------------------------------------------------------------------******
Author -> Shiv Mangal Singh
Date -> 11th Nov - 2015
Description -> This Script will get the Object cache's details of SharePoint Publishing Site at Webapplication level.
Path of csv file->$path = "D:\Test\Shiv\ps\blobcache.csv"
Web Application Name --> Publishing Site collections level
# Local
$outputFil "D:\contosoSSPU_MW_Team\shiv\objectcache\"
******-----------------------------------------------------------------------******
#>
Add-pssnapin "microsoft.sharepoint.powershell"
$webapp=Get-SPWebAPPLication -Identity "https://ms.contoso.net/"
#give the path where .csv file will be saved
$path = "D:\contosoSSPU_MW_Team\shiv\objectcache\"+$webapp.Name+"_Webapplication"+".csv"
$csv = "SiteCollection,Object Cache Size `r`n"
$fso = new-object -comobject scripting.filesystemobject
$file = $fso.CreateTextFile($path,$true)
$file.write($csv)
foreach ($site in $webapp.Sites)
{
$cacheSettings = New-Object Microsoft.SharePoint.Publishing.SiteCacheSettingsWriter($site)
$csv =$site.Url+","+$cacheSettings.ObjectCacheSize+" `n";
$file.write($csv)
}
==================================================================================================
<#
******-----------------------------------------------------------------------******
Author -> Shiv Mangal Singh
Date -> 11th Nov - 2015
Description -> This will get the SharePoint Publishing Site Output cache's details.
Path of csv file->$path = "D:\contosoSSPU_MW_Team\shiv\outputcache\"
Web Application Name --> Publishing Site collection level
# Local
$outputFil "D:\contosoSSPU_MW_Team\shiv\outputcache\"
******-----------------------------------------------------------------------******
#>
#Add-pssnapin "microsoft.sharepoint.powershell"
$webapp=Get-SPWebAPPLication -Identity "https://ms.contoso.net/"
echo $webapp.Name
echo $webapp.Url
#give the path where .csv file will be saved
$path = "D:\contosoSSPU_MW_Team\shiv\outputcache\"+$webapp.Name+"_Webapplication1"+".csv"
$csv = "SiteCollection,Cache Status `r`n"
$fso = new-object -comobject scripting.filesystemobject
$file = $fso.CreateTextFile($path,$true)
$file.write($csv)
foreach ($site in $webapp.Sites)
{
$cacheSettings = New-Object Microsoft.SharePoint.Publishing.SiteCacheSettingsWriter($site)
$csv =$site.Url+","+$cacheSettings.EnableCache+" `n";
$file.write($csv)
}
******-----------------------------------------------------------------------******
Author -> Shiv Mangal Singh
Date -> 11th Nov - 2015
Description -> This Script will get the Object cache's details of SharePoint Publishing Site at Webapplication level.
Path of csv file->$path = "D:\Test\Shiv\ps\blobcache.csv"
Web Application Name --> Publishing Site collections level
# Local
$outputFil "D:\contosoSSPU_MW_Team\shiv\objectcache\"
******-----------------------------------------------------------------------******
#>
Add-pssnapin "microsoft.sharepoint.powershell"
$webapp=Get-SPWebAPPLication -Identity "https://ms.contoso.net/"
#give the path where .csv file will be saved
$path = "D:\contosoSSPU_MW_Team\shiv\objectcache\"+$webapp.Name+"_Webapplication"+".csv"
$csv = "SiteCollection,Object Cache Size `r`n"
$fso = new-object -comobject scripting.filesystemobject
$file = $fso.CreateTextFile($path,$true)
$file.write($csv)
foreach ($site in $webapp.Sites)
{
$cacheSettings = New-Object Microsoft.SharePoint.Publishing.SiteCacheSettingsWriter($site)
$csv =$site.Url+","+$cacheSettings.ObjectCacheSize+" `n";
$file.write($csv)
}
==================================================================================================
<#
******-----------------------------------------------------------------------******
Author -> Shiv Mangal Singh
Date -> 11th Nov - 2015
Description -> This will get the SharePoint Publishing Site Output cache's details.
Path of csv file->$path = "D:\contosoSSPU_MW_Team\shiv\outputcache\"
Web Application Name --> Publishing Site collection level
# Local
$outputFil "D:\contosoSSPU_MW_Team\shiv\outputcache\"
******-----------------------------------------------------------------------******
#>
#Add-pssnapin "microsoft.sharepoint.powershell"
$webapp=Get-SPWebAPPLication -Identity "https://ms.contoso.net/"
echo $webapp.Name
echo $webapp.Url
#give the path where .csv file will be saved
$path = "D:\contosoSSPU_MW_Team\shiv\outputcache\"+$webapp.Name+"_Webapplication1"+".csv"
$csv = "SiteCollection,Cache Status `r`n"
$fso = new-object -comobject scripting.filesystemobject
$file = $fso.CreateTextFile($path,$true)
$file.write($csv)
foreach ($site in $webapp.Sites)
{
$cacheSettings = New-Object Microsoft.SharePoint.Publishing.SiteCacheSettingsWriter($site)
$csv =$site.Url+","+$cacheSettings.EnableCache+" `n";
$file.write($csv)
}
nice blogs about Mastering PowerShell Scripting at The
ReplyDeleteMastering PowerShell Scripting training in bangalore