Thursday, November 13, 2014

Get All Farm Information with Web application,Site Collection, no of sub sites/webs ,content db name and size with powershell

Add-PSSnapin Microsoft.SharePoint.Powershell
$farm = [Microsoft.SharePoint.Administration.SPFarm]::Local
$websvcs = $farm.Services | where -FilterScript {$_.GetType() -eq [Microsoft.SharePoint.Administration.SPWebService]}
foreach ($websvc in $websvcs)
{
    foreach ($webapp in $websvc.WebApplications)
    {
        echo $webapp.Name
        echo $webapp.Url
        #give the path where .csv file will be saved
          $path = "D:\mycsvfolder\Test\"+$webapp.Name+"_Webapplication"+".csv"
             $csv = "WebApplication,SiteCollection,Sub Sites,Content Database,Size of Site Collection`r`n"
         
                 $fso = new-object -comobject scripting.filesystemobject
$file = $fso.CreateTextFile($path,$true)
   $file.write($csv)
  try{    
         Write-Host $webapp.Sites
         Write-Host $webapp.Sites.Count
          foreach ($site in $webapp.Sites)
         {
            echo $site.HostName $site.Url $site.LastContentModifiedDate $site.ContentDatabase.Name $site.WebApplication.Name
         try{
       
         Write-Host $site.AllWebs
             Write-Host "Count:"$site.AllWebs.Count
         
                 #echo $web.Title $web.Url $web.Created $web.LastItemModifiedDate $web.WebTemplate $web.Site.
           
              #$urlweb=$web.Url
         
                       $csv =$webapp.Url+","+$site.Url+","+$site.AllWebs.Count+","+$site.ContentDatabase.Name+","+$site.Usage.Storage+ "`n";
           $file.write($csv)
     
           
           
                         }
                        catch
                        {
                              $csv =$webapp.Url+","+$site.Url+","+"No access"+","+$site.ContentDatabase.Name+","+$site.Usage.Storage+ "`n";
           $file.write($csv)
                        }
                       
                       
             }}
             catch{
             Write-Host "Webapplication does not have site collection"
             }
        }

#$file.close()
       
    }


Thursday, September 4, 2014

How to Enable Windows Powershell ISE in Windows Server 2008 R2

Hi 
Run the below command in Windows Powershell to enable Windows Powershell ISE
Import-Module ServerManager 
 Add-WindowsFeature PowerShell-ISE
 
For more please follow Guru Pratap's blog
http://blogs.msdn.com/b/guruketepalli/archive/2012/11/06/enable-powershell-ise-from-windows-server-2008-r2.aspx

Tuesday, June 3, 2014

Important links for custom membership provider in .net

http://www.codeproject.com/Articles/165159/Custom-Membership-Providers

http://logcorner.wordpress.com/2013/08/28/how-to-configure-custom-membership-provider-using-asp-net-mvc4-with-external-login-like-facebook-yahoo-google-or-other-relying-party-accounts-2/

http://www.devx.com/asp/Article/29256/0/page/3

http://www.codeproject.com/Articles/689801/Understanding-and-Using-Simple-Membership-Provider