kwizcom banner advertisement

Copy SharePoint Alerts from One User to Another using PowerShell

October 31, 2015    , , , , ,
Requirement: Copy SharePoint Alerts from one user to Another. PowerShell script to copy SharePoint Alerts from one user to another: We wanted to create alerts for a new user as same as an existing user who is moving out of organization. Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue Function Copy-SPAlerts($SiteURL, $SourceUserAccount, $TargetUserAccount) { #Get the Site $Site = Get-SPSite $SiteURL #Iterate through each web foreach($web in $site.AllWebs) { #Resolve users $SourceUser=$web.EnsureUser($SourceUserAccount) $TargetUser = $web.EnsureUser($TargetUserAccount) #Get all alerts from the source user $SourceAlertCollection=$SourceUser.Alerts #loop through each alert of the source user and copy it to target suer foreach($SourceAlert in $SourceAlertCollection) { Write-host "Copying Alert from: $($Web.Url)/$($SourceAlert.ListUrl)" #Copy alerts from sou
Copy SharePoint Alerts from One User to Another using PowerShell Copy SharePoint Alerts from One User to Another using PowerShell Reviewed by Salaudeen Rajack on October 31, 2015 Rating: 5

How to Stop and Start All SharePoint 2013 Farm Services using PowerShell?

October 31, 2015    , , , ,
Prior to SharePoint patching, its a best practice to Stop all SharePoint 2013 and its related services and then start once patching is completed. If you don't do this, your service pack or patch installation will take longer than its expected. So what are all the services to be stopped? SharePoint 2013 Search Service (OSearch15 - OSearch16 in SharePoint 2016) SharePoint 2013 Timer Job (SPTimerV4) SharePoint 2013 Administration (SPAdminV4) SharePoint 2013 Tracing (SPTraceV4) SharePoint 2013 VSS Writer (SPWriterV4) SharePoint 2013 User Code Host (SPUserCodeV4) SharePoint Search Host Controller (SPSearchHostController) Forefront Sync Service (FIMSynchronizationService) Forefront Service (FIMService) World Wide Web Publishing Service (W3SVC) Internet Information Services (IIS) Don't forget to do it in all your SharePoint Servers of the farm! Stop all SharePoint 2013 Services Lets use PowerShell to stop and start all SharePoint services: Add-PSSnapin Microsoft
How to Stop and Start All SharePoint 2013 Farm Services using PowerShell? How to Stop and Start All SharePoint 2013 Farm Services using PowerShell? Reviewed by Salaudeen Rajack on October 31, 2015 Rating: 5

SharePoint 2013 Search Crawl Log History Report

October 31, 2015    , , , ,
Requirement: Generate SharePoint 2013 search crawl report on daily basis. Solution: Crawl history can be viewed from SharePoint 2013 search service application as in the below screen. It gives the crawl log history report for all content sources. Why don't we automate it with PowerShell, so that we'll get crawl history report in E-mail? PowerShell to get crawl log history in E-mail: This PowerShell script extracts crawl history data and sends out Email. Add-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue #Get the search service application $SSA = Get-SPEnterpriseSearchServiceApplication #-Identity "Search Service Application Name" #Get all content sources $ContentSources = Get-SPEnterpriseSearchCrawlContentSource -SearchApplication $SSA #| where {$_.Name -eq $ContentSourceName} $ReportDate = Get-Date -format "dd-MM-yyyy" #CSS Styles for the Table $style = "Crawl History Report: " $style = $style + "<sty
SharePoint 2013 Search Crawl Log History Report SharePoint 2013 Search Crawl Log History Report Reviewed by Salaudeen Rajack on October 31, 2015 Rating: 5

SharePoint Online: Delete All List Items using PowerShell

October 23, 2015    , , ,
Requirement: SharePoint Online PowerShell to Delete List items We've a list in SharePoint online - Office 365 site with bunch of items. Need them to be deleted in bulk rather deleting one by one from SharePoint web UI. Delete List Items in SharePoint Online using PowerShell: Here is the script to delete all list items in SharePoint online Office 365 using client side object model (CSOM) with PowerShell. #Load SharePoint CSOM Assemblies Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll" Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll" #Variables for Processing $SiteUrl = "https://crescent.sharepoint.com/" $ListName="Projects" $UserName="admin@crescent.com $Password ="Password goes here" #Setup Credentials to connect $Credentials = New-Object Microsoft.Sha
SharePoint Online: Delete All List Items using PowerShell SharePoint Online: Delete All List Items using PowerShell Reviewed by Salaudeen Rajack on October 23, 2015 Rating: 5

How to Delete a List in SharePoint Online using CSOM-PowerShell?

October 23, 2015    , , ,
Requirement: Delete a list in SharePoint Online using PowerShell. Important: Make sure, you have SharePoint Online client run time installed on the client machine before proceeding. Download it from here: https://www.microsoft.com/en-us/download/details.aspx?id=42038 PowerShell Script to delete a List in SharePoint Online: #Load SharePoint CSOM Assemblies Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll" Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll" ##Variables for Processing $SiteUrl = "https://crescent.sharepoint.com/" $ListName="Projects" $UserName="admin@crescent.com" $Password ="Password goes here" #Setup Credentials to connect $Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName,(ConvertTo-SecureString $Pass
How to Delete a List in SharePoint Online using CSOM-PowerShell? How to Delete a List in SharePoint Online using CSOM-PowerShell? Reviewed by Salaudeen Rajack on October 23, 2015 Rating: 5

How to Change Service Accounts in SharePoint 2013 using PowerShell

October 21, 2015    , , , , ,
Change Service Accounts in SharePoint 2013 If you have created a new managed account or want to change the mapping of managed Account with SharePoint 2013 Services, Go to: Central Administration >> Security  Under the General Security section, click Configure Service accounts.  Pick the Appropriate Service and Service Account from the Drop downs Click "OK" to Save your changes Read more: http://www.sharepointdiary.com/2014/09/configuring-managed-accounts-in-sharepoint-2013.html PowerShell way: How to Change Service Accounts in SharePoint 2013? Why? because not all accounts can be changed via SharePoint Central Administration UI. Here are my scripts to change various service accounts in SharePoint using PowerShell. Please note there are Four type of Service accounts we have to take care: SharePoint Service Instances like Distribution cache, Claims to windows token service, etc SharePoint Farm Service Service Application's AppPool Account  Web A
How to Change Service Accounts in SharePoint 2013 using PowerShell How to Change Service Accounts in SharePoint 2013 using PowerShell Reviewed by Salaudeen Rajack on October 21, 2015 Rating: 5

How to Delete a Service Application in SharePoint 2013 using PowerShell?

October 21, 2015    , , , , , ,
Requirement: Delete SharePoint 2010/2013 Service Application using PowerShell. How to Delete a Service Application in SharePoint 2013: Go to SharePoint 2013 Central Administration site  Navigate to Application Management >> Manage service applications In the Manage Service Applications page, Select the Service application that you want to delete. click Delete button from the Ribbon. You'll get a confirmation dialog, select "Delete data associated with the Service Applications" if you want to delete the service application database. leave this check box if you don't want to delete the Service application's database. Click OK to delete the service application. Once deleted, you'll get the confirmation dialog. Delete a Service Application in SharePoint 2013 using PowerShell At times you may have to use PowerShell in scenarios such as you are unable to delete a Service application as it may corrupted.To get rid of a Service Application and r
How to Delete a Service Application in SharePoint 2013 using PowerShell? How to Delete a Service Application in SharePoint 2013 using PowerShell? Reviewed by Salaudeen Rajack on October 21, 2015 Rating: 5

Configure Variations Feature in SharePoint 2013 - Step by Step

October 20, 2015    , , ,
What is Variation in SharePoint 2013? Variations feature provides multi-lingual support for SharePoint 2013 sites. It help us to manage multilingual sites by making the same content available to specific language audiences across different sites by maintaining customizable copies of the content from the source variation in each target variation. A variation consists of a set of labels (sub-sites: Each site for one variation) that is used to create a set of sites in a site collection. For example, if you want four language variations of your site, you must create four labels, one for each language. In Short, Variation is a mechanism how SharePoint handles multi-lingual sites. SharePoint takes care of redirecting users to respective language site based on their browser settings. Important: Variations feature relies on Language packs and "SharePoint Server Publishing feature", So it works only on Publishing site template or sites with publishing feature activated! Confi
Configure Variations Feature in SharePoint 2013 - Step by Step Configure Variations Feature in SharePoint 2013 - Step by Step Reviewed by Salaudeen Rajack on October 20, 2015 Rating: 5

Remove User from SharePoint Group using PowerShell

October 18, 2015    , , , , , ,
Remove user from SharePoint group: From SharePoint Web interface, if you want to remove user from SharePoint group, Login as a SharePoint Administrator, navigate to: Click on Site Settings Gear icon >> Click on Site Settings From the Site settings page, Click on "People and Groups" link under "Users and Permissions" group Select the group from the left navigation by Click on the group from which you want to remove users. Select the user(s) and click on Actions Menu >> Choose "Remove users from Group" Confirm by clicking "OK". Selected users are now removed from the SharePoint Group. Delete user from SharePoint group using PowerShell:  If you want to remove user from SharePoint group, this PowerShell script can help: Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue Function RemoveUser-FromGroup($SiteURL, $GroupName, $UserAccount) { try { $ErrorActionPreference = "Stop"
Remove User from SharePoint Group using PowerShell Remove User from SharePoint Group using PowerShell Reviewed by Salaudeen Rajack on October 18, 2015 Rating: 5

Hide "Upload" Button of a Document Library in SharePoint 2013

October 17, 2015    , , ,
Requirement: Disable upload button in SharePoint document library! But why? Because, we wanted users to fill the form by creating new document from the New drop-down and not to upload any existing documents with Upload button. So we need to hide upload button in SharePoint 2013. Solution: CSS! Place this CSS either in Master page or script editor/content editor of the target page. CSS Styles to hide Upload button in SharePoint 2013: <style type="text/css"> #Ribbon\.Documents\.New\.AddDocument-Large, #Ribbon\.Documents\.New-MediumMedium-0-1 { display:none !important; } </style> Hide "Open with Explorer" button in SharePoint 2013 ribbon: You may also want to disable "Open in Explorer" as it allows multiple file upload. Use this CSS to hide "Open in Explorer" from SharePoint 2013 ribbon. #Ribbon\.Library\.Actions-LargeMedium-1-1 Result: Upload button disabled in SharePoint 2013 document library! Disab
Hide "Upload" Button of a Document Library in SharePoint 2013 Hide "Upload" Button of a Document Library in SharePoint 2013 Reviewed by Salaudeen Rajack on October 17, 2015 Rating: 5

Copy Alerts from One SharePoint List or Library to Another - Using PowerShell

October 14, 2015    , , , , ,
Requirement: Copy Alerts from one SharePoint list to another list. Solution: Use this PowerShell script to copy alerts between SharePoint lists or libraries. My scenario is: We've a list with number of alerts created for various users. We copied that list to a new site through "Save list as template" and the requirement of copying alerts came! Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue function Copy-SPAlerts($SourceWebUrl,$SourceList, $TargetWebUrl, $TargetList) { #Get the source Web & List objects $SourceWeb = Get-SPWeb $SourceWebUrl $SourceList= $SourceWeb.lists.TryGetList($SourceList) #Get the Target Web & List objects $TargetWeb = Get-SPWeb $TargetWebUrl $TargetList= $TargetWeb.lists.TryGetList($TargetList) #Get All Alerts of the Source list $SourceAlertsColl = $SourceWeb.Alerts | Where-Object { ($_.List.Title -eq $SourceList.Title)} write-host Found $SourceAlertsColl.coun
Copy Alerts from One SharePoint List or Library to Another - Using PowerShell Copy Alerts from One SharePoint List or Library to Another - Using PowerShell Reviewed by Salaudeen Rajack on October 14, 2015 Rating: 5

PowerShell Error: Add-Type: Could not load file or assembly 'file:///C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded

October 09, 2015    , , ,
Problem:  When trying to write a client side PowerShell script for SharePoint online, got an error: Error: Add-Type : Could not load file or assembly 'file:///C:\Program Files\Common Files\Micros oft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll' or one of its  dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. Verified SharePoint Server 2013 Client Components SDK is already installed to use Client side assemblies. (if not,  You can download it from: http://www.microsoft.com/en-us/download/details.aspx?id=35585) Solution: You need to have PowerShell 3.0 to use Client side assemblies of SharePoint online. So, download and install "Windows Management Framework 3.0" at https://www.microsoft.com/en-us/download/details.aspx?id=34595 Tips: To get your currently installed PowerShell version, type: $PSVersionTable
PowerShell Error: Add-Type: Could not load file or assembly 'file:///C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded PowerShell Error: Add-Type: Could not load file or assembly 'file:///C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded Reviewed by Salaudeen Rajack on October 09, 2015 Rating: 5

Copy List Items Between SharePoint Lists using PowerShell

October 06, 2015    , , , , , ,
Requirement: Copy List Items Between SharePoint Lists using PowerShell One of our SharePoint list called "News" grown rapidly and wanted to archive its contents to an another list periodically. Solution: So the task is to copy list items between SharePoint Lists. Lets achieve it using PowerShell. Important: Both lists should have same columns! So, have the source list saved as template and create a new list from it. PowerShell Script to copy List Items: #Configuration variables $WebURL = "http://intranet.crescent.com" $SourceListName = "News" $TargetListName= "NewsArchive" #Get Objects $web = Get-SPWeb $WebURL $SourceList = $web.Lists[$SourceListName] $TargetList = $web.Lists[$TargetListName] #Get all source items $SourceColumns = $sourceList.Fields $SourceItems = $SourceList.GetItems(); #Iterate through each item and add to target list Foreach($SourceItem in $SourceItems) { $TargetItem = $TargetList.AddItem() Foreach($colum
Copy List Items Between SharePoint Lists using PowerShell Copy List Items Between SharePoint Lists using PowerShell Reviewed by Salaudeen Rajack on October 06, 2015 Rating: 5

Get All SharePoint Service Applications - IIS App Pools - Service Account Details

October 04, 2015    , , ,
From the IIS console, its tedious to find the application pools of SharePoint Service Application's, isn't it? So, lets use PowerShell to retrieve All service application's app pool and service account details. PowerShell to get all Service Application Names, Service App Pool and Process Account details: Get-SPServiceApplication | Select Name, @{Name="SP AppPool Name"; Expression={$_.ApplicationPool.Name}}, ` @{Name="IIS AppPool Name"; Expression={$_.ApplicationPool.Id}}, ` @{Name="Service Account"; Expression={$_.ApplicationPool.ProcessAccountName}} This script gets you all service application's app pool related data:
Get All SharePoint Service Applications - IIS App Pools - Service Account Details Get All SharePoint Service Applications - IIS App Pools - Service Account Details Reviewed by Salaudeen Rajack on October 04, 2015 Rating: 5

How to Copy a Site Collection in SharePoint?

October 04, 2015    , , , , ,
Requirement: Clone the Production SharePoint site collection to Test environment for UAT. Solution: While Copy-SPSite cmdlet on SharePoint 2013 or later serves the purpose, It can clone site collection only within the same web application. What if you want to copy site collection to another web application or another farm in SharePoint? Well, follow these steps to copy site collection to same/another farm. Create a new Web application Backup the live site collection Restore the backup into the target web application Backup the Source Site Collection: Backup-SPSite -Identity "http://portal.crescent.com" -Path "D:\backup\portal.bak" -Force -NoSiteLock -Confirm:$False Restore the backup into Target Site collection: Restore-SPSite "http://testportal.crescent.com" -Path "D:\backup\portal.bak" -Force -Confirm:$False You can use this method to copy a site collection to another server or another server or another web application in Shar
How to Copy a Site Collection in SharePoint? How to Copy a Site Collection in SharePoint? Reviewed by Salaudeen Rajack on October 04, 2015 Rating: 5

Compare SharePoint List Items using PowerShell

October 01, 2015    ,
Requirement: We've two task lists with hundreds of rows in it. Wanted to compare these two SharePoint Lists and extract the difference from both of them. Solution: Lets use PowerShell script to compare and extract the difference between SharePoint lists! Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Variables for Processing $SiteURL = "http://projects.crescent.com" $ListOneName ="Team One Tasks" $ListTwoName ="Tasks Two Tasks" $ColumnToCompare="Task Name" #Get site and List objects $Web = Get-SPWeb $SiteURL $ListOne = $web.lists[$ListOneName] $ListTwo = $web.lists[$ListTwoName] #Fetch specifc Column Values from each lists to compare $ListOneValues = @() $ListTwoValues = @() $ListOne.Items| foreach { $ListOneValues+= $_[$ColumnToCompare] } $ListTwo.Items | foreach { $ListTwoValues+= $_[$ColumnToCompare] } #Compare Compare-Object $ListOneValues $ListTwoValues # -PassThru Output: Here the InputObject col
Compare SharePoint List Items using PowerShell Compare SharePoint List Items using PowerShell Reviewed by Salaudeen Rajack on October 01, 2015 Rating: 5
Powered by Blogger.