kwizcom banner advertisement

SharePoint Site Collections and Subsites Inventory Report

8:59 PM    , ,
Requirement: Get a list of all site collections and their subsites in a HTML formatted report! PowerShell Script to generate a HTML report for Site Collections & Subsites: #Add SharePoint Snapin if ( (Get-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null ) { Add-PSSnapin "Microsoft.SharePoint.PowerShell" } # Configuration Variables $WebApplicationURL = "http://intranet.crescent.com" $ReportOutput = "C:\SiteCollectionsAndSites.html" #Get all Site Collections from the webapplication $SitesColl= Get-SPWebApplication $WebApplicationURL | Get-SPSite -Limit All $HTMLTemplate=@" <html> <head> <!-- Sal - Javascript Function to apply formatting --> <script type="text/javascript"> function altRows(id){ if(document.getElementsByTagName){ var table = document.getElementById(id); var rows = table.getElementsByTagName("tr"); for(i = 0;
SharePoint Site Collections and Subsites Inventory Report SharePoint Site Collections and Subsites Inventory Report Reviewed by Salaudeen Rajack on 8:59 PM Rating: 5

SharePoint Online: Get All Site Collections using PowerShell

9:17 PM    , , , , , ,
Requirement: Get all site collections using PowerShell in SharePoint Online. How to get a list of site collections in SharePoint Online?   If you want to get a list of SharePoint online site collections, you can go to SharePoint admin center (Typically at: https://YOURCOMPANY-admin.sharepoint.com/_layouts/15/online/SiteCollections.aspx). This gets you the list of all site collections in SharePoint Online. Lets see the SharePoint online PowerShell to get all site collections. PowerShell Script to get all Site Collections in SharePoint Online: Lets use PowerShell to get a list of Site collections from SharePoint online. #Load SharePoint Online 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 $AdminUrl = &quo
SharePoint Online: Get All Site Collections using PowerShell SharePoint Online: Get All Site Collections using PowerShell Reviewed by Salaudeen Rajack on 9:17 PM Rating: 5

SharePoint Online: PowerShell to Get All Subsites in a Site Collection

8:55 PM    , , ,
Requirement:  PowerShell to list all subsites in a SharePoint Online Site collection! PowerShell to get all sub-sites in a Site Collection: Here is the SharePoint online PowerShell to get all subsites #Load SharePoint Online 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/sites/Sales/" $UserName="Salaudeen@crescent.com" $Password ="Password goes here" #Setup Credentials to connect $Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName,(ConvertTo-SecureString $Password -AsPlainText -Force)) #Get the Root Web Function Get-SPOWeb() { param( $WebURL = $(throw "Please Enter the Site Collect
SharePoint Online: PowerShell to Get All Subsites in a Site Collection SharePoint Online: PowerShell to Get All Subsites in a Site Collection Reviewed by Salaudeen Rajack on 8:55 PM Rating: 5

Get Site Collection Administrators of All SharePoint Sites using PowerShell

6:13 PM    , , , , , ,
Requirement: Get all Site collection Administrators of a SharePoint 2016 site collection. Solution: SharePoint site collection administrators possess full control to the entire site collection - including top-level site, subsites and all lists and libraries in the site collection. SharePoint 2016 site collection Administrators as assigned at site collection creation by farm administrators through SharePoint Central Administration site as Primary and secondary site collection owners. Additional site collection administrators can be added/removed through site collection settings page. Site collection administrators have same access rights as same as Primary or secondary site owners assigned through SharePoint Central Administration site, other than Notifications! Primary and secondary site collection administrators are those who'll be getting Email notifications such as Site collection storage limit warning Emails. How to Primary and Secondary site collection admin
Get Site Collection Administrators of All SharePoint Sites using PowerShell Get Site Collection Administrators of All SharePoint Sites using PowerShell Reviewed by Salaudeen Rajack on 6:13 PM Rating: 5

SharePoint 2013 Search: Unable to retrieve topology component health states. This may be because the admin component is not up and running

5:24 PM    , ,
Problem: SharePoint 2013 Search service application displays the error message "Unable to retrieve topology component health states. This may be because the admin component is not up and running" Solution: After making sure the account configured to run Search service & Search Service Host in Services console, (Service.msc), Provisioned the Usage Application Proxy with PowerShell. Open SharePoint 2013 Management Shell, and run these commands. $UsageProxy = Get-SPServiceApplicationProxy | where {$_.TypeName -like "Usage*"} $UsageProxy.Provision()
SharePoint 2013 Search: Unable to retrieve topology component health states. This may be because the admin component is not up and running SharePoint 2013 Search: Unable to retrieve topology component health states. This may be because the admin component is not up and running Reviewed by Salaudeen Rajack on 5:24 PM Rating: 5

SharePoint Online: Delete Version History using Powershell CSOM

1:16 PM    , , ,
How to delete version history in sharepoint online?  To Delete all previous versions of a document in SharePoint, follow these steps: Navigate to your SharePoint Library, Select the file and then click on "Version History" from the ribbon menu. From the version history page, click on "Delete all versions" link, confirm if prompted! SharePoint Online: Delete Version History using PowerShell Case 1: Delete All Versions for a particular file: This PowerShell script deletes all versions 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" #Config Parameters $SiteURL= "https://crescent.sharepoint.com/sites/sales/" $FileURL="/Sites/Sales/ProjectDocuments/ProjectMet
SharePoint Online: Delete Version History using Powershell CSOM SharePoint Online: Delete Version History using Powershell CSOM Reviewed by Salaudeen Rajack on 1:16 PM Rating: 5

Create Site Collection in SharePoint using PowerShell

8:24 PM    , , , ,
We have to use New-SPSite cmdlet to create a site collection in SharePoint. It takes URL and Owner parameters as mandatory with several other parameters. Here is an example: PowerShell to create new Site Collection in SharePoint 2016: To create a site collection using PowerShell in SharePoint 2013, use this script. Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Configuration Variables $SiteCollURL = "http://intranet.crescent.com/sites/Sales" $SiteName = "Sales Team Site" $SiteOwner = "Crescent\Salaudeen" $SiteTemplate = "STS#0" #Team Site Template #Create new Site Collection New-SPSite -URL $SiteCollURL -OwnerAlias $SiteOwner -Template $SiteTemplate -Name $SiteName Create blank site collection in SharePoint 2013 using PowerShell  Use the  template as "STS#1" to create a blank site collection in SharePoint. We can get all available site templates using cmdlet: Get-SPWebTemplates. SharePoint 2013
Create Site Collection in SharePoint using PowerShell Create Site Collection in SharePoint using PowerShell Reviewed by Salaudeen Rajack on 8:24 PM Rating: 5

SharePoint Online: Delete Unique Permissions for All Items in a List using PowerShell

8:28 PM    , , , ,
Requirement: Reset all customized permissions in all documents of a SharePoint online document library. By default, Permissions are inherited from their parent in all levels of SharePoint. E.g. Sites inherits permissions from its parent site collection (or parent site), lists and libraries inherits permissions from the site, items in the list inherits permissions from the list. So, If you make any change in permissions at the parent level, any child underneath, automatically inherits the permission changes you made in the parent, unless the child is using its own unique permissions. At times, you may have to setup unique permissions at granular level and of course, you may have to reset the broken permissions. How to Delete Unique Permissions in SharePoint? To reset custom permissions on SharePoint list items or documents, Navigate to the SharePoint library where your documents are stored Select the document >> Click on "Shared With" under Manage group in the
SharePoint Online: Delete Unique Permissions for All Items in a List using PowerShell SharePoint Online: Delete Unique Permissions for All Items in a List using PowerShell Reviewed by Salaudeen Rajack on 8:28 PM Rating: 5

PowerShell-CAML SPQuery to Filter List Items based of Person or Group Field Value

8:20 PM    , , ,
Requirement: In a project tracking SharePoint list, want to quickly get the list the projects where a particular user is listed under Team members - person or group (People picker) field. Solution: Use SPQuery with PowerShell as in the below example. PowerShell to Filter List Items based of Person or Group Field: Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Configuration parameters $SiteURL = "http://portal.crescent.com/projectpipeline/" $ListName = "Projects" $FieldName= "TeamMembers" $UserAccount="Crescent\Omar" #Get the User Account $User = Get-SPUser -Identity $UserAccount -Web $SiteURL #Query to filter List Items which contains user account $SPQuery = new-object Microsoft.SharePoint.SPQuery $Query = "<Where><Eq><FieldRef Name='TeamMembers' LookupId='TRUE'/><Value Type='User'>$($User.ID)</Value></Eq></Where>" $SPQuery.Query=$Q
PowerShell-CAML SPQuery to Filter List Items based of Person or Group Field Value PowerShell-CAML SPQuery to Filter List Items based of Person or Group Field Value Reviewed by Salaudeen Rajack on 8:20 PM Rating: 5

Import Data from SQL Server Table to SharePoint List using PowerShell

8:53 PM    , , ,
Requirement:  We've an External CRM application from which data is to be extracted and inserted into a SharePoint List! PowerShell to Read Data from SQL Server and Insert into SharePoint: Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Get Sharepoint List $Web = Get-SPWeb "http://portal.crescent.com/ProjectPipeline/" $List = $Web.Lists["Projects"] $ConnectionString = "Server=CrescentSQL;Database=CRM_Integrated_DB;Integrated Security=True" $SPName = "rpt_Project_pipeline" #execute the Stored Procedure to Fetch Data $sqlConnection = new-object System.Data.SqlClient.SqlConnection $sqlConnection.ConnectionString = $ConnectionString $sqlConnection.Open() $sqlCommand = new-object System.Data.SqlClient.SqlCommand $sqlCommand.CommandTimeout = 120 $sqlCommand.Connection = $sqlConnection $sqlCommand.CommandType=[System.Data.CommandType]'StoredProcedure' $sqlCommand.CommandText = $SPName $SqlAdapter = New
Import Data from SQL Server Table to SharePoint List using PowerShell Import Data from SQL Server Table to SharePoint List using PowerShell Reviewed by Salaudeen Rajack on 8:53 PM Rating: 5

Create Subscription Settings Service Application in SharePoint using PowerShell

9:27 PM    , , ,
What is subscription settings service application in SharePoint? Well, SharePoint Apps platform relies on Microsoft SharePoint Foundation Subscription Settings service application. So, If you want to use Apps in SharePoint, its a prerequisite to create Subscription Settings service application. How to create subscription settings service application? Subscription Settings service application can be created only via PowerShell, There is no GUI to create this Service Application! Lets configure the subscription settings service application by using windows PowerShell. Don't forget to Change configuration parameters such as the service account, database name,etc on the below script as per your environment. Once done,  run this PowerShell script from either PowerShell ISE or through SharePoint Server 2013 Management Shell. PowerShell to Create Subscription Settings Service Application in SharePoint Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #
Create Subscription Settings Service Application in SharePoint using PowerShell Create Subscription Settings Service Application in SharePoint using PowerShell Reviewed by Salaudeen Rajack on 9:27 PM Rating: 5

Deactivate Feature on All Sites in SharePoint using PowerShell

6:09 PM    , , , ,
Requirement:  After deploying Office web apps with edit licenses in SharePoint, we wanted to disable open in client feature on all site collections in SharePoint. Deactivating a feature is straight forward from SharePoint web UI by getting into: Site Settings >> Site Collection Features Locate the target feature and click on "Deactivate" button next to it. However, its cumbersome to repeat this activity for larger number of site collections, isn't it? So, use these PowerShell scripts to deactivate features from all sites in SharePoint! PowerShell to Disable Feature on All Site Collections in SharePoint Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Feature to Deactivate $FeatureID="8a4b8de2-6fd8-41e9-923c-c7c3c00f8295" #Get all Site collections $SitesColl= Get-SPWebApplication | Get-SPSite -Limit ALL #Get the Feature $Feature = Get-SPFeature | Where {$_.ID -eq $FeatureID} #Check if Feature exists if($Feature -ne $
Deactivate Feature on All Sites in SharePoint using PowerShell Deactivate Feature on All Sites in SharePoint using PowerShell Reviewed by Salaudeen Rajack on 6:09 PM Rating: 5

Activate Feature on All Sites in SharePoint using PowerShell

2:37 PM    , , , , ,
In some scenarios, you may have to activate a feature for all sites or site collections in SharePoint. In my case today, I had to activate "Open In Client" feature of SharePoint to disable browser based editing for all site collection in a SharePoint web application. How to Activate a Feature in SharePoint? To activate a site collection feature from SharePoint web UI, You can navigate to Site settings >> Site Collection Features >> Click on "Activate" next to the relevant feature. Pretty straight forward and easy enough through the UI, isn't it? Well, If you have to do the same for a dozens of site collection in the web application, PowerShell is the perfect solution. Activate feature for all site collections in SharePoint Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Configuration Parameters $WebAppURL="https://portal.crescent.com/" $FeatureName="OpenInClient" #Feature Folder Name #Get al
Activate Feature on All Sites in SharePoint using PowerShell Activate Feature on All Sites in SharePoint using PowerShell Reviewed by Salaudeen Rajack on 2:37 PM Rating: 5

How to Create a SharePoint 2013 Farm using PowerShell to Avoid GUIDs?

3:38 PM    , , , ,
Why to use PowerShell to create SharePoint farm rather the nice SharePoint products configuration wizard? Because, SharePoint Products configuration wizard creates Central Administration database names with GUIDs. Create SharePoint 2013 farm using PowerShell: How to start? follow these steps to create SharePoint farm using PowerShell. Step 1: Install SharePoint binaries on each server to your SharePoint 2013 farm. On completion: you will asked to run the "SharePoint Products Configuration Wizard" - Do not run the wizard! Step 2: Logon to the server where you would like to host SharePoint Central Administration site. Right click on "SharePoint 2013 Management Shell" and select "Run as administrator". The shell will give "Local farm is not accessible", This is expected as we have not created the farm yet. Proceed executing the cmdlets below to create SharePoint 2013 farm using PowerShell. SharePoint 2013 create new farm using PowerShell
How to Create a SharePoint 2013 Farm using PowerShell to Avoid GUIDs? How to Create a SharePoint 2013 Farm using PowerShell to Avoid GUIDs? Reviewed by Salaudeen Rajack on 3:38 PM Rating: 5

The Complete SharePoint 2013/2016 Site Collection Permission Report using PowerShell

7:55 PM    , , , , , ,
Another PowerShell report generating requirement: SharePoint Site Collection Permission Report to audit permissions on each and every object under a site collection. This PowerShell script generates a report in HTML format, which consists of Permission setup on All subsites under a site collection Site collection administrators list Permissions applied on each SharePoint object - Such as web (subsite), List, Folder and List Item. Permissions configured for Users, SharePoint Group and AD Groups SharePoint Groups and members of each group who has access. How to run this script? How to run the script? Well, Just copy-paste the given script below to either PowerShell ISE or notepad, save it something like "PermissionRpt.ps1", change the configuration variables such as "Site collection URL, Output Report, etc. accordingly. Save and Hit F5! SharePoint 2013/2010 permissions report PowerShell Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyCont
The Complete SharePoint 2013/2016 Site Collection Permission Report using PowerShell The Complete SharePoint 2013/2016 Site Collection Permission Report using PowerShell Reviewed by Salaudeen Rajack on 7:55 PM Rating: 5

How to Check Replicate Directory Changes Permission for UPS Account?

7:42 PM    , ,
Replicate Directory Changes Permission is required for user profile import account in SharePoint. While my another article How to grant Replicate Directory Changes permission walks through the steps to grant replicate directory permission,  Now the question is: How to check if a particular account has replicate directory changes permission? PowerShell Script to check if the User Profile Import account has Replicate Directory Changes Permission: Import-module activedirectory $UserProfileAccountName = "Crescent\SP016_UPS" Function Check-ADUserPermission( [System.DirectoryServices.DirectoryEntry]$entry, [string]$user, [string]$permission) { $dse = [ADSI]"LDAP://Rootdse" $ext = [ADSI]("LDAP://CN=Extended-Rights," + $dse.ConfigurationNamingContext) $right = $ext.psbase.Children | ? { $_.DisplayName -eq $permission } if($right -ne $null) { $perms = $entry.psbase.ObjectSecurity.Access | ? { $_
How to Check Replicate Directory Changes Permission for UPS Account? How to Check Replicate Directory Changes Permission for UPS Account? Reviewed by Salaudeen Rajack on 7:42 PM Rating: 5

Event ID 8321: A certificate validation operation took X milliseconds and has exceeded the execution time threshold

6:30 PM    , , , ,
Problem:  Event ID 8321 logged multiple times in the SharePoint 2013 Application server's Event Log, with the message "A certificate validation operation took 1500.8983 milliseconds and has exceeded the execution time threshold.  If this continues to occur, it may represent a configuration issue.  Please see http://go.microsoft.com/fwlink/?LinkId=246987 for more details." and SharePoint pages were loading very slow! Root cause: Typically, this error occurs on SharePoint servers which are running with no internet connectivity where SharePoint Root Authority was not added to Trusted Root Certification Authorities store (which is the default behaviour!) . Solution: Install SharePoint Root Authority certificate to the Trusted Root Certification Authorities store. Here is how to fix this error step by step. Step 1: Export the SharePoint Root Authority certificate using PowerShell Open SharePoint Management Shell and execute these PowerShell scripts. $RootCertFile=
Event ID 8321: A certificate validation operation took X milliseconds and has exceeded the execution time threshold Event ID 8321: A certificate validation operation took X milliseconds and has exceeded the execution time threshold Reviewed by Salaudeen Rajack on 6:30 PM Rating: 5
Powered by Blogger.