Showing posts with label Scripts. Show all posts
Showing posts with label Scripts. Show all posts

Friday, March 20, 2015

Restore of deleted site collection by power shell



Restore of deleted site collection by power shell

This happens many times with the SharePoint administrators that someone deletes the site unfortunately and want it back. What happens if it’s also delete from the recycle bin.

We can still restore the deleted site by using the power shell commands.

Initially get all the sites that were deleted, this provides the sites deleted list with the Site ID

Get-spdeletedsite | select path,siteID

Once you get the details, Restore the site with the below command.

Restore-spdeletedsite –identity siteID(which we got in last command)
 


I hope the above information will help you to resolve the issue, in case of any queries/questions regarding the above mentioned information then please let me know. I would be more than happy to help you as well as resolves your issues, Thank you.

Thursday, March 19, 2015

Windows Power Shell for SharePoint 2013



Windows Power Shell for SharePoint 2013

I found a very good article from MS, which provides and contains all power shell commands that every administrator use in their daily work.

 
IIS:https://technet.microsoft.com/en-us/library/ee790599.aspx

I hope the above information will help you to resolve the issue, in case of any queries/questions regarding the above mentioned information then please let me know. I would be more than happy to help you as well as resolves your issues, Thank you.

Friday, February 6, 2015

Create SharePoint 2013 Claims Web Application With Power Shell



Create SharePoint 2013 Claims Web Application With Power Shell

This script will create claims-based web applications in SharePoint 2013.  This script may also work in SharePoint 2010.  This script will also set your object cache user accounts, as well as configuring your object cache accounts for your web applications

https://gallery.technet.microsoft.com/office/Create-SharePoint-2013-1d7c3337/view/Discussions#content

I hope the above information will help you to resolve the issue, in case of any queries/questions regarding the above mentioned information then please let me know. I would be more than happy to help you as well as resolves your issues, Thank you.

Friday, August 8, 2014

Script to add or remove a user as site collection administrator in many site collections



Script to add or remove a user as site collection administrator in many site collections

Description: many times as a SharePoint administrator we required to perform a task that to add a user as administrator in many site collections. This is very difficult if has 100’s of site collections. In this article I am providing the script how to achieve this with one click.

Instructions: Follow the Instructions below to run successfully.

1.   Copy the script in notepad and save as .PS1
2.   Do modifications as said below
3.   Open power shell as Admin,Ensure your in the same location where Script is copied.
4.   Run ./Script.ps1
5.   You see a below screen once its run successfully

Modifications: You need to do below modifications according to your requirements.

1.   $newSiteCollectionAdminLoginName = "Name of user"
2.   $newSiteCollectionAdminEmail = " user  mail ID"
3.   $newSiteCollectionAdminName = " Name of user "
4.   $siteURL = " siteURL " #URL to any site in the web application.
Script:

# This script will add named Site Collection Administrator
# to all Site Collections within a Web Application.
#
# Author: Anil Avula
######################## Start Variables ########################
$newSiteCollectionAdminLoginName = ""Name of user "
$newSiteCollectionAdminEmail = " user  mail ID "
$newSiteCollectionAdminName = " Name of user "
$newSiteCollectionAdminNotes = ""
$siteURL = " siteURL " #URL to any site in the web application.
$add = 1 # 1 for adding this user, 0 to remove this user
######################## End Variables ########################
Clear-Host
$siteCount = 0
[system.reflection.assembly]::loadwithpartialname("Microsoft.SharePoint")
$site = new-object microsoft.sharepoint.spsite($siteURL)
$webApp = $site.webapplication
$allSites = $webApp.sites
foreach ($site in $allSites)
{
   
    $web = $site.openweb()
    $web.allusers.add($newSiteCollectionAdminLoginName, $newSiteCollectionAdminEmail, $newSiteCollectionAdminName, $newSiteCollectionAdminNotes)
   
    $user = $web.allUsers[$newSiteCollectionAdminLoginName]
    $user.IsSiteAdmin = $add
    $user.Update()
    $web.Dispose()
    $siteCount++
}
$site.dispose()
write-host "Updated" $siteCount "Site Collections."

 

I hope the above information will help you to resolve the issue, in case of any queries/questions regarding the above mentioned information then please let me know. I would be more than happy to help you as well as resolves your issues, Thank you.

ShareThis

X