Pages

Showing posts with label SharePoint 2010 Administration. Show all posts
Showing posts with label SharePoint 2010 Administration. Show all posts

Wednesday, 21 January 2015

Useful PowerShell Commands for SharePoint 2010

  • To get the current verion of SharePoint Installed:
     get-spfarm | select BuildVersion
 
  • Export a list from SharePoint 2010
    
    Export-SPWeb "http://sitecollection/subsite/subsubsite/subsubsubsite/" -itemurl "/subsite/subsubsite/subsubsubsite/Lists/myList" -path "e:\backups\myList.cmp"
    
    

Tuesday, 11 June 2013

How to get a list of all activated features for a site collection and a sub site in SharePoint 2010 using powershell

To get a list of Site collection features:

Get-SPSite http://sharepoint2010 | % {

    $results = @()

    Get-SPFeature -Site $_ -Limit All | % {

    $feature = $_; 
        $featuresDefn = (Get-SPFarm).FeatureDefinitions[$_.ID]; 
        $cc = [System.Globalization.CultureInfo]::CurrentCulture;

        $obj = New-Object PSObject;
        $obj | Add-Member NoteProperty  Title  $($featuresDefn.GetTitle($cc));
        $obj | Add-Member NoteProperty  Hidden $($feature.Hidden);
        
        $results += $obj;
    }
    $results | FT -auto;
}
 
 
To get a list of features for a sub site:
 
Get-SPWeb http://sharepoint2010/subsite | % {

    $results = @()

    Get-SPFeature -Web $_ -Limit All | % {

        $feature = $_; 
        $featuresDefn = (Get-SPFarm).FeatureDefinitions[$_.ID]; 
        $cc = [System.Globalization.CultureInfo]::CurrentCulture;

        $obj = New-Object PSObject;
        $obj | Add-Member NoteProperty  Title  $($featuresDefn.GetTitle($cc));
        $obj | Add-Member NoteProperty  Hidden $($feature.Hidden);
        
        $results += $obj;
    }
    $results | FT -Auto;
} 


Shows both hidden and non-hidden features
 
Thanks to  Joe Rodgers (blogs.msdn.com/b/josrod/archive/2013/01/04/
powershell-to-list-activated-features-for-a-site-and-web.aspx)

Permissions for all authenticated users was corrupted in a Classic mode web application sharepoint 2010

Recently I was working on a Form library which stopped inheriting permissions from the parent.

Issue:

"All authenticated users" were added to the form library, however none of the users were able to access this list.

Upon investigating further (by clicking on the user account), found out that for some reason the account was claims based, even though the web application was classic mode;

This is what was displayed:
Account: (c:0(.s|true) 
Name: All Authenticated Users

Fix:

Deleted the account and re-added

Monday, 6 May 2013

Restore a deleted site collection using PowerShell

In order to delete a sub site, one can recover using admin recyclebin. You can restore a sub site which has been deleted using the UI not SharePoint designer. But if you have to recover a site collection then you will need to use powershell.

Thanks to  Salaudeen Rajack


Get-SPDeletedSite - Displays list of sites deleted. 
Restore-SPDeletedSite - Restore a deleted site 
Remove-SPDeletedSite - To permanently remove the deleted site collection.

Permanently remove the deleted site collection:
Get-SPDeletedSite -webapplication http://sharepoint.company.com | Remove-SPDeletedSite

Wednesday, 1 May 2013

How to get the SharePoint farm configuration

Occasionally you would want to get the entier SharePoint Farm configuration. Well, there is this awesome Executable on codeplex which just does this:

http://spsfarmreport.codeplex.com