kwizcom banner advertisement

Change Page Layout in SharePoint 2013 using PowerShell

10:31 AM    , , , ,
In a public internet SharePoint web site based on publishing site template, We got a requirement to update existing page layouts and create new ones. So, the development team created new page layouts, Updated existing Page layouts with required changes. Any page going to be created with these updated page layouts will have the changes reflected. Well, How about existing pages created with the old page layouts? There is a requirement to switch page layouts for few pages. While its possible to change page layout through SharePoint web interface (Click on Edit Page >> Under "Page" Tab, Click on "Page Layout" and pick the different page layout you would like to set!), It would take hours to update page layout of all existing pages. So, I wrote this script to change page layout in SharePoint 2013 using PowerShell. Change SharePoint page layout using PowerShell: Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Variables for Web and P
Change Page Layout in SharePoint 2013 using PowerShell Change Page Layout in SharePoint 2013 using PowerShell Reviewed by Salaudeen Rajack on 10:31 AM Rating: 5

Archive SharePoint Library Files into Sub-Folders using PowerShell

2:02 PM    , , , ,
Requirement: We've a very large library with more than 20,000 files stored in the root of the document library without any sub-folders. Got to move files into Sub-folders to improve performance. Solution: We analyzed the library content and decided to move files into sub-folders based on file's created date. Archive Files into Sub-Folders in SharePoint using PowerShell PowerShell script to move files into sub-folders in SharePoint document library: #Import PowerShell Snap-in Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue #Create a custom function to archive files Function Archive-Files($WebURL, $ListName) { #Get the web and List $Web = Get-SPWeb $WebURL $List= $web.Lists[$ListName] $RootItems = $List.RootFolder.files Write-host "Total number of files found in the Root: "$RootItems.count #Move each file in the root folder to archive folder foreach($item in $RootItems) { #Get the File $file = $Web.GetFile($item.URL
Archive SharePoint Library Files into Sub-Folders using PowerShell Archive SharePoint Library Files into Sub-Folders using PowerShell Reviewed by Salaudeen Rajack on 2:02 PM Rating: 5

Get SharePoint Documents Inventory Report with PowerShell

5:15 PM    , , , , , ,
This PowerShell script generates detailed report on the given SharePoint library's inventory in addition with its storage data. The output report contains: File Name File Size(KB) Versions Size(KB) Total File Size(KB) Created on Last Modified Created by Parent Folder URL SharePoint Document Library Inventory using PowerShell Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue # Function to retrieve detailed Library storage Report Function GetLibraryStorageRpt($Folder) { #Array to hold Storage data for all files $StorageDataCollection = @() $FileSize = 0 $TotalFileSize = 0 foreach ($File in $Folder.Files) { #Get File Size $FileSize = $File.TotalLength $VersionSize = 0 #Get the Versions Size foreach ($FileVersion in $File.Versions) { $VersionSize +=$FileVersion.Size } $TotalFileSize = $FileSize + $VersionSize $StorageData
Get SharePoint Documents Inventory Report with PowerShell Get SharePoint Documents Inventory Report with PowerShell Reviewed by Salaudeen Rajack on 5:15 PM Rating: 5

Some Farm Products and patches were not detected on this or other servers - Fix

1:10 PM    , , , , , ,
After patching a SharePoint 2013 Farm, Attempted running SharePoint Products configuration wizard and receive this error message: "Error: Some farm products and patches were not detected on this or other servers.  If products or patches are missing locally, you must quit this program and install the required products and patches on this server before restarting this wizard. If products or patches are missing on other servers, you must install the required products and patches on the specific servers, and you may then click the Refresh button to perform the status check again." Root Cause: To enforce consistency, SharePoint 2013 checks installed product version automatically on running Products configuration wizard. If any server is missing a specific patch, You get this error message and SharePoint would not let the SharePoint Configuration Wizard to proceed. Solution: Install the missing patches on your SharePoint Servers and rerun this wizard! But wait, in my
Some Farm Products and patches were not detected on this or other servers - Fix Some Farm Products and patches were not detected on this or other servers - Fix Reviewed by Salaudeen Rajack on 1:10 PM Rating: 5

SharePoint Active Directory Group Membership Sync Problem and Solution

12:18 PM    , , , , , ,
Problem: SharePoint AD group permissions are not working immediately. Active directory group users get access denied in SharePoint! In a SharePoint site where users are managed from AD security groups, newly added members to Active Directory security groups couldn't access SharePoint sites immediately. But the next day, they are able to login without any issues. Same way, users removed from a AD security group which is granted access to SharePoint sites, still able to access! So, the catch here is: SharePoint AD group permissions not working as AD group permissions are not getting reflected in SharePoint immediately - So, they gets access denied! For example if you remove a user from the AD security group - user is still able to access the site. If you add a new user to the AD security group membership , user still receives access denied error message in SharePoint. Root cause: In SharePoint Web Applications configured to use Claims Based Authentication, When user hits
SharePoint Active Directory Group Membership Sync Problem and Solution SharePoint Active Directory Group Membership Sync Problem and Solution Reviewed by Salaudeen Rajack on 12:18 PM Rating: 5

Set SharePoint Application Pool Recycle Time

6:31 PM    , , , , ,
By design application pools in IIS are restarted once per every 29 hours to provide best performance and stability. The very first user access SharePoint after app pool recycle will experience considerable delay, as .net assemblies needs to be recompiled to the memory. So, we use Warm-up scripts for SharePoint 2013 to mitigate this issue. Configure Application Pool Recycle time Settings Lets customize SharePoint 2010/SharePoint 2013 application pool recycling settings, So that our Warmup script run just after the specific time. Go to IIS Manager >> Application Pools >> Pick your App Pool  Right Click and choose "Recycling..." . You'll find the recycling conditions. time attribute under "Recycling " group. You can adjust this setting to incorporate with your Warm-up script schedule. Just make your warmup script to run after the App Pool recycle time. Enter the specific time, Click Next and then Finish. You can also set the recycle time
Set SharePoint Application Pool Recycle Time Set SharePoint Application Pool Recycle Time Reviewed by Salaudeen Rajack on 6:31 PM Rating: 5

Copy List Permissions in SharePoint using PowerShell

5:40 PM    , ,
Ever wanted to clone permissions between SharePoint lists or Libraries? Well, Here is the nifty PowerShell script to copy permissions between SharePoint lists: Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue #PowerShell Function to copy permissions between Lists in SharePoint Function Copy-ListPermissions() { param( $WebURL, $SourceListName, $TargetListName ) #Get the Web $Web = Get-SPweb $WebURL #Get Source and Target Lists $SourceList = $Web.lists[$SourceListName] $TargetList = $Web.lists[$TargetListName] #if permissions are Inherited in Source, apply it in Target list if($SourceList.Permissions.Inherited) { $TargetList.ResetRoleInheritance() } else #Copy permissions from Source to Target List { #Reset the Inheritence in Target List $TargetList.BreakRoleInheritance($false) #Copy Source list permissions to Destination List $SourceList.RoleAssignments | foreach-object { $targetList.RoleAs
Copy List Permissions in SharePoint using PowerShell Copy List Permissions in SharePoint using PowerShell Reviewed by Salaudeen Rajack on 5:40 PM Rating: 5

How to Add HOST file Entry using PowerShell?

2:07 PM    , ,
Here is the nifty PowerShell script to add HOST file entry using PowerShell: $HostFile = 'C:\Windows\System32\drivers\etc\hosts' # Create a backup copy of the Hosts file $dateFormat = (Get-Date).ToString('dd-MM-yyyy hh-mm-ss') $FileCopy = $HostFile + '.' + $dateFormat + '.copy' Copy-Item $HostFile -Destination $FileCopy #Hosts to Add $Hosts = @("intranet.Crescent.com", "Intranet", "mysite.crescent.com") # Get the contents of the Hosts file $File = Get-Content $HostFile # write the Entries to hosts file, if it doesn't exist. foreach ($HostFileEntry in $Hosts) { Write-Host "Checking existing HOST file entries for $HostFileEntry..." #Set a Flag $EntryExists = $false if ($File -contains "127.0.0.1 `t $HostFileEntry") { Write-Host "Host File Entry for $HostFileEntry is already exists." $EntryExists = $true } #Add Entry to Host File
How to Add HOST file Entry using PowerShell? How to Add HOST file Entry using PowerShell? Reviewed by Salaudeen Rajack on 2:07 PM Rating: 5

Expand Collapse SharePoint Web Parts using jQuery

1:28 PM    , , , ,
Requirement: Expand Collapse SharePoint list view web parts in Home page. Solution: We can implement Expand collapse functionality in SharePoint 2013 using jQuery. Here is how to expand/collapse web parts in SharePoint using jQuery. Just grab the IDS of List view web part (WebPartWPQ3) and Web part header (in my case: WebPartTitleWPQ3 ) using IE developer toolbar or Firebug in Firefox. jQuery to provide Expand-Collapse functionality for SharePoint 2013 web parts: Add this jQuery to the page with Script editor web part. <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript" > jQuery(document).ready(function() { jQuery("#WebPartWPQ3").hide(); //Add Expand Icon to Web Part Header $('Span#WebPartTitleWPQ3').find('h2').append("<span style='padding-left:0.5em; text-decoration:none'> <img i
Expand Collapse SharePoint Web Parts using jQuery Expand Collapse SharePoint Web Parts using jQuery Reviewed by Salaudeen Rajack on 1:28 PM Rating: 5

Add-Remove Permissions to SharePoint List using PowerShell

4:01 PM    , , , , ,
Requirement: Set list permissions using PowerShell PowerShell can be utilized to Add/Remove permission to SharePoint List. Here is my PowerShell script to grant and remove permissions to SharePoint sites, lists and libraries  Grant Permission to a user or group to SharePoint List Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Function to Grant Permission to List function Grant-PermissionToList($WebUrl, $ListName, $UserAccount, $PermissionLevel) { #Get Web and List objects $Web = Get-SPWeb -Identity $WebUrl $List = $web.Lists.TryGetList($ListName) if ($List -ne $null) { #We must break inheritance to grant permission directly on the list if ($List.HasUniqueRoleAssignments -eq $False) { $list.BreakRoleInheritance($True) } #Get the user object $User = $web.EnsureUser($UserAccount) #FOR GROUPS use: $group = $web.SiteGroups[$GroupName] #$assignment = new-ob
Add-Remove Permissions to SharePoint List using PowerShell Add-Remove Permissions to SharePoint List using PowerShell Reviewed by Salaudeen Rajack on 4:01 PM Rating: 5

SharePoint PowerShell Error: Cannot open database "Database-Name" requested by the login. The login failed. Login failed for user 'Domain\UserName'.

6:34 PM    , , ,
Problem:  SharePoint Admin tried backing up a SharePoint 2013 site collection with Backup-SPSite PowerShell cmdlet and got an error "Cannot open database "WSS_Content_demo" requested by the login. The login failed. Login failed for user 'HOSTING\DemoUser'." Root cause: Although the SharePoint administrator is granted permission with "Add-SPShellAdmin" cmdlet, it grants permission to the user only on existing SharePoint content databases at the time of running this command. For new content databases created later on, we have to grant permission again! Solution: Run "Add-SPShellAdmin" cmdlet for the user. This gives access to all SharePoint databases: Get-SPDatabase | Add-SPShellAdmin "Domain\User" Read more: How to grant access to run PowerShell cmdlets in SharePoint 2013
SharePoint PowerShell Error: Cannot open database "Database-Name" requested by the login. The login failed. Login failed for user 'Domain\UserName'. SharePoint PowerShell Error: Cannot open database "Database-Name" requested by the login. The login failed. Login failed for user 'Domain\UserName'. Reviewed by Salaudeen Rajack on 6:34 PM Rating: 5

Fix "We can't connect to the specified SharePoint site" in SharePoint 2013 - OneDrive for Business Error

6:06 PM    
In our SharePoint 2013 setup, few users reported they are facing issues while trying to setup sync from SharePoint document library. "Microsoft OneDrive for Business Error - We cant connect to the specified SharePoint site..." Root Cause: We found this issue occurs mostly with Non-Internet Explorer browsers! E.g. from Firefox or from Google Chrome! While trying to setup sync, user are prompted for credentials. If user makes a typo in user name/password/domain, OneDrive Sync client caches it and the credentials get saved in Windows credential store Solution:  Go to Control Panel >> User Accounts >> Pick your user name >> Manage Saved Credentials >> Delete if any!  Add Site to Trusted Sites Zone in Internet Explorer. Restart the Microsoft OneDrive for business Sync client (Exit the OneDrive client from notification area!) You can also try reinstalling the updated client from: http://support.microsoft.com/kb/2903984 Make sure, user's perm
Fix "We can't connect to the specified SharePoint site" in SharePoint 2013 - OneDrive for Business Error Fix "We can't connect to the specified SharePoint site" in SharePoint 2013 - OneDrive for Business Error Reviewed by Salaudeen Rajack on 6:06 PM Rating: 5

How to Sync SharePoint 2013 Document Library with Local Folder?

5:37 PM    , , ,
In SharePoint Server 2013, users can perform two way sync between files stored in SharePoint document libraries and their local machine. The OneDrive for Business sync client performs the synchronization of files between document libraries and the user's local disk, So that users can take their files offline from SharePoint, work on them while offline, and then synchronize them with their document library when they reconnect to SharePoint Server 2013. SharePoint 2013 sync requirements You must have the Microsoft OneDrive for Business sync client (formerly SkyDrive Pro) installed in your machine for the sync functionality to work. If its not already installed, download and install it from: http://support.microsoft.com/kb/2903984 , otherwise, SharePoint 2013 sync does not work! Sync functionality doesn't need any additional permission for one way sync. even the least permission level: "View only" would do! How to sync SharePoint 2013 Library with Local Folder
How to Sync SharePoint 2013 Document Library with Local Folder? How to Sync SharePoint 2013 Document Library with Local Folder? Reviewed by Salaudeen Rajack on 5:37 PM Rating: 5

Find and Replace URL Links from Hyperlink Columns in SharePoint

4:24 PM    , , , , ,
Requirement: We had a SharePoint portal site called "Crescent Portal" with URL: http://portal.crescent.com. After migrating from SharePoint 2010 to SharePoint 2013, we made a decision to replace both site name and URL as "Crescent Intranet" with URL "http://intranet.crescent.com". We understand there are plenty of lists and libraries hard-coded with the old site URL in its Hyperlink columns. Now, we got to find and replace those old links from all SharePoint lists and libraries. PowerShell script to find and replace links in Hyperlink columns of SharePoint: Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue Function Replace-LinkFields($WebURL, $OldLinkURL, $OldLinkTitle, $NewLinkURL, $NewLinkTitle) { #Get the Web $Web = Get-SPWeb $WebURL #Get all lists - Exclude System lists $ListCollection = $web.lists | Where-Object { ($_.hidden -eq $false) -and ($_.IsSiteAssetsLibrary -eq $false) -and ($_.Author.LoginNam
Find and Replace URL Links from Hyperlink Columns in SharePoint Find and Replace URL Links from Hyperlink Columns in SharePoint Reviewed by Salaudeen Rajack on 4:24 PM Rating: 5

Copy-SPSite - Clone SharePoint Site Collection using PowerShell

1:06 PM    , , , ,
Copy-SPSite is a new feature introduced in SharePoint 2013, allows us to copy an existing site collection in to a new site collection. Copy-SPSite cmdlet clones/duplicates existing site collection into new one. Optionally, You can specify "Destination Database" parameter to copy the site collection into new database. Copy-SPSite Example: Syntax:  Copy-SPSite {Source-Site-Collection-URL} [-DestinationDatabase {Destination-Database-Name}] -TargetUrl {Target-Site-Collection-URL} Example: Copy-SPSite http://intranet.crescent.com/sites/sales -TargetUrl http://intranet.crescent.com/sites/sales2 -DestinationDatabase SP13_Intranet_ContentDB005 This gets you a duplicate of a site collection on a fresh new URL!   Using Copy-SPSite cmdlet to rename existing site collection: To rename site collections, we used to follow backup-delete-restore process as in my another article: Rename site collection in SharePoint 2010 using PowerShell . Of course, there is a risk involved as you
Copy-SPSite - Clone SharePoint Site Collection using PowerShell Copy-SPSite - Clone SharePoint Site Collection using PowerShell Reviewed by Salaudeen Rajack on 1:06 PM Rating: 5

This view cannot be displayed because the number of lookup and workflow status columns it contains exceeds the threshold (8) enforced by the administrator.

2:09 PM    , , ,
Problem: "This view cannot be displayed because the number of lookup and workflow status columns it contains exceeds the threshold (8) enforced by the administrator." Root Cause: Usually, You'll get this error message when your List view has many Lookup fields. Threshold feature is introduced in SharePoint 2010 to avoid performance hits in SharePoint Server. So, the simplest solution would be limit the number of lookup/workflow fields in SharePoint list view. Please not, Not just "Lookup" fields are counted for threshold!  If you have below columns in the view, they are also counted: Managed Metadata columns People/Group Columns (including: Created by, Modified by) Workflow Status column How to Increase List view Threshold value in SharePoint 2013: In case you want to increase this limit, follow these steps: Go to your SharePoint 2010/SharePoint 2013 Central Admin site Click on Application Management >> Manage web applications Select yo
This view cannot be displayed because the number of lookup and workflow status columns it contains exceeds the threshold (8) enforced by the administrator. This view cannot be displayed because the number of lookup and workflow status columns it contains exceeds the threshold (8) enforced by the administrator. Reviewed by Salaudeen Rajack on 2:09 PM Rating: 5

Check if SharePoint Site Collection, Site, List, Document, Column Exists in PowerShell

2:24 PM    , , , , , ,
Here is my nifty PowerShell scripts to check if a given URL of Site collection, Site, List, Document (File) and column objects exists in SharePoint. You can utilize these helper functions wherever required. PowerShell to check if Site Collection Exists: Here is my custom function and function usage with PowerShell to check if site collection exists. SharePoint PowerShell to check if site collection exists: Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Custom Function to Check if Site Collection Exists in Given URL Function Check-SiteExists($SiteURL) { return (Get-SPSite $SiteURL -ErrorAction SilentlyContinue) -ne $null } #Variable for Site collection $SiteURL= "http://demo.crescent.com/sites/operations" #Call the function to check site exists if(Check-SiteExists($SiteURL)) { write-host "Yes, Given Site Collection Exists!" -f Green #Proceed with your script } else { write-host "No, Site Collection do
Check if SharePoint Site Collection, Site, List, Document, Column Exists in PowerShell Check if SharePoint Site Collection, Site, List, Document, Column Exists in PowerShell Reviewed by Salaudeen Rajack on 2:24 PM Rating: 5

Fix "This page can't be displayed" "Internet Explorer Cannot Display This Page" Errors when Creating Web Application in SharePoint 2013

1:14 PM    , , , , ,
Web application creation process through SharePoint 2013 central administration site stopped in middle with error messages "This page can't be displayed", Internet Explorer Cannot Display This Page"!. However, I noticed that the IIS Web Sites, Application Pools, content database are created! But There is no content inside the virtual directory in IIS. I couldn't manage the web application throgh Central admin UI - So, the web application is in unsupported state. Internet Explorer 11 error message: Internet Explorer 10 and below: Root cause: Usually occurs when your SharePoint server's configuration is low and its performing poor! You may be running the SharePoint server with below recommended hardware (CPU, Memory, Disk space). Solution: To resolve the issue do the following: Increase the "Shutdown Time Limit" value of Central Administration's Application Pool in IIS! Here is how: Login to your SharePoint server which hosts Centra
Fix "This page can't be displayed" "Internet Explorer Cannot Display This Page" Errors when Creating Web Application in SharePoint 2013 Fix "This page can't be displayed" "Internet Explorer Cannot Display This Page" Errors when Creating Web Application in SharePoint 2013 Reviewed by Salaudeen Rajack on 1:14 PM Rating: 5

Fix The website cannot display the page - HTTP 500 Internal Server Error in SharePoint

11:26 AM    , , , , , ,
Problem:  When I opened SharePoint 2013 Central Administration site, it returned an error message: HTTP 500 Internal Server Error: The website cannot display the page error message! Troubleshooting: Check all required ports are open in Firewall in web & database servers. Update passwords on IIS Application Pool identities. Make sure they are not stopped or Offline. Update the identity password for "SecurityTokenServiceApplicationPool " application pool and start it. In most of the cases, Its due to web.config issues! Restore the web.config file from backups or Create a dummy web app, copy-paste the web.config file from it. If your SharePoint Farm account password is changed/expired, Update it with: stsadm -o updatefarmcredentials -userlogin "domain\username" -password "password" Make sure IIS Web sites are running. SharePoint Timer service is running. If you are experiencing this issue with SharePoint 2010 Central Administration site, try re
Fix The website cannot display the page - HTTP 500 Internal Server Error in SharePoint Fix The website cannot display the page - HTTP 500 Internal Server Error in SharePoint Reviewed by Salaudeen Rajack on 11:26 AM Rating: 5

SharePoint Error - Cannot complete this action. Please try again

10:40 AM    ,
Problem: Users get "Error - Cannot complete this action. Please try again" error when trying to delete documents from Context menu (But file gets deleted!). While deleting documents from SharePoint 2013 ribbon button "delete document" works without any issues, choosing "Delete" from document's context menu gives this error. Also, While trying to create a new View or Modify view: when you hit save button, you get: https://your-sharepoint-site.com /_vti_bin/owssvr.dll?CS=65001 - in the URL with blank page. Troubleshooting: Tried bypassing the load balancer by logging into individual WFEs and verified that the above errors are not happening in both the scenarios. Temporary Fix: Disable "Minimal Download Strategy" feature from site settings >> Manage site features page.  Permanent fix: Compared response headers from SharePoint WFEs and from Load balancers using fiddler - Found load balancer response missing the response hea
SharePoint Error - Cannot complete this action. Please try again SharePoint Error - Cannot complete this action. Please try again Reviewed by Salaudeen Rajack on 10:40 AM Rating: 5
Powered by Blogger.