Tuesday 25 March 2014

Add/Update Site Collection Administrator using PowerShell



  
Add-PSSnapin "Microsoft.SharePoint.PowerShell" 

 $collabWebs =  Get-SPWebApplication "http://localdevrtm" | Get-

SPSite -Limit All | where 

{$_.Url like "http://test.dev.local/sites/qw*"}
  
 $collabWebs | % { $web = $_
    
  if($web.IsRootWeb)

  {

   $NewAdmin = $web.EnsureUser("devuser\manju")

   $NewAdmin .IsSiteAdmin = $true

   $NewAdmin .Update()
  
  }

    }





# collabwebs object contains list of Site urls from WebApp http://localdevrtm which starts with  http://..../sites/qw*

#$_ is the Current object

# Url is property which has list of Sitecollections

# % is for looping through list of urls which we got from $collabwebs
   
# check if $web is a root web if so go ahead and add the SiteCollection Admininstrator


PowerShell script to Update SiteCollection Admin  for Single SiteCollection



cls
  
Add-PSSnapin "Microsoft.SharePoint.PowerShell" 

 $site =  Get-SPSite -Identity "http://test.dev.local/sites/qw"
  
 $web=$site.RootWeb;

  if($web.IsRootWeb)

  {

   $NewAdmin = $web.EnsureUser("devuser\manju")

   $NewAdmin .IsSiteAdmin = $true

   $NewAdmin .Update()
    
   Write-Host " Site Collection Admin Successfully Added"
  
  }

 else
{
 Write-Host " Site Collection Admin is not updated "
}
    


OutPut:


Tuesday 11 March 2014

Sort Page Navigation in SharePoint 2013



Steps to change  Page Navigation in SharePoint 2013


In SharePoint 2013 Publishing Sites we can change the display order of pages on the left hand side. 

Below are steps 




Click on Edit item and Change the display order as per your requirement and click on Ok Button