kwizcom banner advertisement

SharePoint Online: Update Metadata of a Document using PowerShell

August 30, 2017    , ,
Requirement: PowerShell to update metadata of a file in SharePoint Online. PowerShell to Update the Metadata of a File in SharePoint Online: How to set metadata of a document in SharePoint Online? Lets update the "Status" Column value of a particular file in a SharePoint Online Document library. #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" #Set parameter values $SiteURL="https://crescent.sharepoint.com/sites/Ops" $FileRelativeUrl="/sites/Ops/Shared Documents/Investment Process.pptx" Try { #Get Credentials to connect $Cred= Get-Credential $Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)
SharePoint Online: Update Metadata of a Document using PowerShell SharePoint Online: Update Metadata of a Document using PowerShell Reviewed by Salaudeen Rajack on August 30, 2017 Rating: 5

SharePoint Online: Copy List Views using PowerShell-CSOM

August 30, 2017    , , ,
Requirement: Copy a List View in SharePoint Online using PowerShell. How to Copy a List View in SharePoint Online? To copy view in SharePoint list through UI, follow these steps: Navigate to the List  List Settings >> Scroll down to Views section >> Click on "Create View" link Under "Start from an existing view" section pick any existing view.  Provide a name to your New View and click OK to copy the view. How to Copy SharePoint view using PowerShell CSOM? To copy a view in SharePoint Online, use this PowerShell script. #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" #To call a non-generic method Load Function Invoke-LoadMethod() { param( [Microsoft.SharePoint.C
SharePoint Online: Copy List Views using PowerShell-CSOM SharePoint Online: Copy List Views using PowerShell-CSOM Reviewed by Salaudeen Rajack on August 30, 2017 Rating: 5

SharePoint Online: How to Deprecate a Managed Metadata Term in Term Store using PowerShell?

August 29, 2017    , , , ,
Managed Metadata Term store in SharePoint Online provides a fantastic way to classify data and enhance search results using pre-defined Terms. However, There are situations where you may need to remove terms from use. So, If you decide to retire a term - Don't delete them, but deprecate them instead. Deprecating a Term prevents the term from being used any further.  It doesn't affect all items which are already using the specific term! How to deprecate a term in managed metadata Term Store? Here is how to deprecate a term in SharePoint Online term store. Login to SharePoint Online Admin Center and then "term store" from the left navigation. Traverse to the particular term you want to deprecate.  Select the term click on little down arrow, Click on the "Deprecate Term" option from the context menu. Deprecated terms are displayed with a little red icon and its dimmed. The deprecated term cannot be used in new items. Enable Deprecated Term ( Un-Dep
SharePoint Online: How to Deprecate a Managed Metadata Term in Term Store using PowerShell? SharePoint Online: How to Deprecate a Managed Metadata Term in Term Store using PowerShell? Reviewed by Salaudeen Rajack on August 29, 2017 Rating: 5

SharePoint Online: Get All Fields from List View using PowerShell

August 28, 2017    , , ,
Requirement: Get all fields from a SharePoint Online List View SharePoint Online: PowerShell to Get All Fields from a List View This PowerShell script gets all fields from a given list view 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/" $ListName="Projects" $ViewTitle ="All Items" #Setup Credentials to connect $Cred = Get-Credential $Cred = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password) Try { #Setup the context $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL) $Ctx.Credentials = $Cred #Get the List $List
SharePoint Online: Get All Fields from List View using PowerShell SharePoint Online: Get All Fields from List View using PowerShell Reviewed by Salaudeen Rajack on August 28, 2017 Rating: 5

SharePoint Online: Update Managed Metadata Field Value using PowerShell and CSOM

August 28, 2017    , , ,
Requirement: Update managed metadata column value using PowerShell in SharePoint Online. SharePoint Online: PowerShell-CSOM script to update managed metadata Field Value Assuming the data is already populated in Term Store, Here is the PowerShell script to set value for managed metadata column. #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" Add-Type -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Taxonomy.dll" #Set parameter values $SiteURL="https://crescent.sharepoint.com/sites/Ops/" $ListName="Projects" $ItemID="1" $TaxonomyFieldTitle="Region" #Termset parameters $TermGroupName="Regions" $T
SharePoint Online: Update Managed Metadata Field Value using PowerShell and CSOM SharePoint Online: Update Managed Metadata Field Value using PowerShell and CSOM Reviewed by Salaudeen Rajack on August 28, 2017 Rating: 5

How to Change SharePoint Farm Account Password using PowerShell?

August 25, 2017    , , , , ,
What is SharePoint farm account, BTW? Well, SharePoint farm account is a service account manages farm services, Used as the application pool identity for Central Administration, used for database access and in used to run SharePoint Timer service! In certain circumstances, You may have to change the Password of SharePoint Farm account, such as: Security Policies, Account has been compromised, SharePoint Admin left, etc. How to Change SharePoint Farm Account Password? Changing SharePoint farm account's password is similar to changing any other managed account's password in SharePoint. As a first step, Identify the SharePoint Farm account ( How to Get SharePoint Farm Account ) and then you can change the password as follows: Case 1: Farm Account's Password is already changed in Active Directory If the Farm account's password is already changed in Active Directory, You'll have to update the Farm account credentials in SharePoint. We use the STSADM command line to
How to Change SharePoint Farm Account Password using PowerShell? How to Change SharePoint Farm Account Password using PowerShell? Reviewed by Salaudeen Rajack on August 25, 2017 Rating: 5

Create User Profile Service Application using PowerShell in SharePoint 2016

August 24, 2017    , , , ,
We need User Profile Service Application to consume social features in SharePoint 2016 such as My Sites, User profiles, etc. This PowerShell script creates User Profile Service Application in SharePoint 2016. Prerequisite: Create my site host prior creating user profile service application. Create My site host using PowerShell in SharePoint PowerShell to create user profile service application in SharePoint 2016 Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue #Configuration Parameters $ServiceAppName = "User Profile Service Application" $ServiceAppProxyName = "User Profile Service Application Proxy" $AppPoolAccount = "Crescent\SP16_Pool" $AppPoolName = "Service Application App Pool" $DatabaseServer ="SP16-SQL" $UserProfileDB = "Farm_Profile_DB" $UserProfileSyncDB = "Farm_Profile_Sync_DB" $UserProfileSocialDB = "Farm_Profile_Social_DB" $MySiteHostLocation="http://mysi
Create User Profile Service Application using PowerShell in SharePoint 2016 Create User Profile Service Application using PowerShell in SharePoint 2016 Reviewed by Salaudeen Rajack on August 24, 2017 Rating: 5

How to Get SharePoint Farm Account Password using PowerShell?

August 20, 2017    , , , , ,
Requirement: Had to take-over a SharePoint Farm and we don't have the Farm Account Password! We needed the credentials of SharePoint Farm account. Get SharePoint Farm Account Password: SharePoint Farm account user name and password can be retrieved with this little trick: Central Admin site uses SharePoint Farm account, So, lets retrieve the credentials of SharePoint Central admin App Pool. This tiny script gets you the user name and password of SharePoint Farm account. Import-Module WebAdministration #Get Central Admin App Pool - which Runs on FARM account $CAPool = Get-ChildItem -Path IIS:\AppPools\ | Where { $_.Name -eq "SharePoint Central Administration v4" } #Get User Name and Password for Farm Account $CAPool.ProcessModel.UserName $CAPool.ProcessModel.Password That's All! Now, you have the Farm Account Password! Similarly, You can retrieve any managed account password or IIS application pool passwords too. One can argue on misuse of this. But this is for
How to Get SharePoint Farm Account Password using PowerShell? How to Get SharePoint Farm Account Password using PowerShell? Reviewed by Salaudeen Rajack on August 20, 2017 Rating: 5

SharePoint Online: PowerShell to Change Access Request Email

August 17, 2017    , ,
Requirement: Change Access Request Email in SharePoint Online. PowerShell to Change Access Request Email in SharePoint Online for a Site Collection: Lets set access request email for a SharePoint Online site collection using 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" #Function to call a non-generic method Load Function Invoke-LoadMethod() { param([Microsoft.SharePoint.Client.ClientObject]$Object = $(throw "Please provide a Client Object"),[string]$PropertyName) $ctx = $Object.Context $load = [Microsoft.SharePoint.Client.ClientContext].GetMethod("Load") $type = $Object.GetType() $clientLoad = $load.MakeGenericMethod($type) $Parameter = [System.Linq.Expressions.
SharePoint Online: PowerShell to Change Access Request Email SharePoint Online: PowerShell to Change Access Request Email Reviewed by Salaudeen Rajack on August 17, 2017 Rating: 5

SharePoint Online: Show All Tasks Assigned to My Group

August 17, 2017    , ,
Requirement: In SharePoint Online Task List, Get All Tasks Assigned to the Logged in User and User's Groups. If you want to filter task list items assigned to current user, you can simply set the [Me] filter in view settings. But If a Task item assigned to a group and the logged-in user is member of that group, how do we show them? Well, there is no way to set such filter from web user interface. So, lets create a new list view using PowerShell to filter task list items assigned to current user and current user's groups in SharePoint Online. Get All Tasks Assigned to Current User and Current User's Groups Although you can edit the query with SharePoint designer, Lets create a new list view using PowerShell which filters all tasks assigned to current user and current user's groups. #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
SharePoint Online: Show All Tasks Assigned to My Group SharePoint Online: Show All Tasks Assigned to My Group Reviewed by Salaudeen Rajack on August 17, 2017 Rating: 5

SharePoint Online: Export User Profile Properties to CSV using PowerShell

August 17, 2017    , , , ,
Requirement: Export All User Profiles and Properties from SharePoint Online to a CSV File. SharePoint Online: Export User Profiles to CSV using PowerShell Here is how to export user profiles in SharePoint Online using 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" Add-Type -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.UserProfiles.dll" Function Export-SPOUserProfileProperties() { param ( [Parameter(Mandatory=$true)] [string] $SiteURL, [Parameter(Mandatory=$true)] [string] $CSVPath ) Try { #Setup Credentials to connect $Cred= Get-Credential $Credentials = New-Object Micr
SharePoint Online: Export User Profile Properties to CSV using PowerShell SharePoint Online: Export User Profile Properties to CSV using PowerShell Reviewed by Salaudeen Rajack on August 17, 2017 Rating: 5

SharePoint Online: How to Lock a Site Collection using PowerShell?

August 17, 2017    , ,
How to Lock a SharePoint Online Site Collection? In SharePoint Online you can lock a site collection, so that no one can access it. In real time, you may want to temporarily freeze a site while it is in development or it is undergoing some sort of maintenance activity. Lock SharePoint Online Site with PowerShell: Set the variables and run this PowerShell script to lock a site collection in SharePoint Online. #Variables for Admin Center & Site Collection URL $AdminCenterURL = "https://crescent-admin.sharepoint.com" $SiteURL ="https://crescent.sharepoint.com/sites/marketing" #Connect to SharePoint Online Connect-SPOService -URL $AdminCenterURL -Credential (Get-Credential) Set-SPOSite -Identity $SiteURL -LockState "NoAccess" So when a user tries to access the locked site, they will receive a 403 error. You can verify the lock status of a Site collection with: $SiteURL="https://crescent.sharepoint.com/sites/marketing" Get-SPOSite -I
SharePoint Online: How to Lock a Site Collection using PowerShell? SharePoint Online: How to Lock a Site Collection using PowerShell? Reviewed by Salaudeen Rajack on August 17, 2017 Rating: 5

SharePoint Online: How to Disable "Sync" Button in Document Library?

August 16, 2017    , ,
Requirement: Disable Sync button in SharePoint Online or OneDrive for Business Document Library How to disable sync button in a Document Library? To disable sync button for a single library, Go to: Library Settings >> Advanced Settings  Set "No" for "Offline Client Availability" This disables Sync button from the library. Disable sync in SharePoint Online Site: If you want to disable sync for your entire site: Go to Site Settings >> Click on "Search and Offline Availability" under "Search" group Set "No" for "Offline Client Availability" setting This hides sync button from all libraries in SharePoint Online. Please note this settings is at "Site" level, not a site collection level and needs to be set on all site of the site collection, so lets use PowerShell! PowerShell to Remove Sync Button in All Sites of the Site Collection Lets hide sync button for a SharePoint Online Site
SharePoint Online: How to Disable "Sync" Button in Document Library? SharePoint Online: How to Disable "Sync" Button in Document Library? Reviewed by Salaudeen Rajack on August 16, 2017 Rating: 5

Get Site Templates in SharePoint Online using PowerShell

August 16, 2017    , ,
Requirement: Get Site Templates in SharePoint Online using PowerShell How to Get Site Templates in SharePoint Online? The "Template Selection" section in create site page gives you the list of site templates in SharePoint Online. You need the site template in order to create sites in SharePoint. Picking the site template from web user interface is fine, but how to get site template in SharePoint Online from PowerShell? PowerShell to get site template in SharePoint Online You need the site template ID when you create a site or site collection in SharePoint Online. Here is the PowerShell to get site templates in SharePoint Online. The "Get-SPOWebTemplate" cmdlet gets you the SharePoint online site template list. #Variables for Admin Center & Site Collection URL $AdminCenterURL = "https://crescent-admin.sharepoint.com/" #Connect to SharePoint Online Connect-SPOService -url $AdminCenterURL -Credential (Get-Credential) #Get site template list
Get Site Templates in SharePoint Online using PowerShell Get Site Templates in SharePoint Online using PowerShell Reviewed by Salaudeen Rajack on August 16, 2017 Rating: 5

How to Change a SharePoint Web Application from HTTP to HTTPS?

August 16, 2017    , , , ,
Requirement:   Enable HTTPS encryption in SharePoint Web Application using SSL certificate. How to Configure HTTPS for SharePoint 2016 web applications? Enabling HTTPS encryption ensures that the communications between users and the SharePoint web site remain secure. This article assumes you have generated CSR and imported the SSL certificate to the IIS. If you need any assistance on these steps refer my another article: configuring SSL Certificates in SharePoint - Step by Step To configure SharePoint 2013 /SharePoint 2016 for HTTPS, follow these steps: Add HTTPS to web application's IIS binding Configure Alternate Access Mapping for the SharePoint Web application. Step 1:  Add HTTPS Binding for the SharePoint Web Application In SharePoint 2013, to change web application to HTTPS you have to  modify the default AAM to include the new HTTPS URL. Add IIS binding to your SharePoint web application as below: Open IIS Manager (Start >> Run >> Type "InetM
How to Change a SharePoint Web Application from HTTP to HTTPS? How to Change a SharePoint Web Application from HTTP to HTTPS? Reviewed by Salaudeen Rajack on August 16, 2017 Rating: 5

SharePoint Online: Save List as Template Missing?

August 14, 2017    ,
Problem:   "Save List as Template" is missing in SharePoint Online modern sites! Root Cause: "Custom script" feature is disabled! Solution: Enable Custom Scripting at SharePoint Admin Center and Site Collection Levels. How to Enable Custom Script in SharePoint Online? To allow custom script in SharePoint Online, follow these steps: Sign in to Office 365 and go to the SharePoint Online Admin Center. Click on Settings from the left navigation >> Scroll down to "Custom Script" section Under Custom Script section, Set "Allow users to run custom script on personal site" and "Allow users to run custom script on self-service created sites" options.  Click on "OK" to save your changes. This enables custom script in SharePoint Online. However, this change may take up to 24 Hours to reflect. To enable scripting on a particular site collection immediately, use this PowerShell script through SharePoint Online
SharePoint Online: Save List as Template Missing? SharePoint Online: Save List as Template Missing? Reviewed by Salaudeen Rajack on August 14, 2017 Rating: 5

SharePoint Online: Create List from Custom Template using PowerShell

August 14, 2017    , , , ,
Requirement: Create List from Custom List Template using PowerShell in SharePoint Online. SharePoint Online: How to create list from template? List templates in SharePoint Online saves a lot of time by reusing any existing list or library, which comprises of all columns and optionally the data from the list. You can create any number of copies from the list template. Assuming you have an existing list template in the site, Here is how to create a list from a template SharePoint Online . Login to your SharePoint Online site >> Click on Settings gear icon and click "Add an app" You can use the pagination to find your list template, or use "Find an App" search box and pick your list template. Provide a name to your new list and click on "OK". This creates new list from template in SharePoint Online. You will see a new list created with same list schema, and also data if you have selected "Include Content" when creating the lis
SharePoint Online: Create List from Custom Template using PowerShell SharePoint Online: Create List from Custom Template using PowerShell Reviewed by Salaudeen Rajack on August 14, 2017 Rating: 5

SharePoint Online: Get List Templates using PowerShell

August 13, 2017    , , ,
Requirement: Get List Templates in SharePoint Online using PowerShell PowerShell to Get List Templates in SharePoint Online  If you need to get available list of templates in SharePoint Online, use this PowerShell script. It gets all SharePoint Online list templates from the given site . #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" #Custom Function to get all list templates from given site URL Function Get-SPOListTemplates([String]$SiteURL) { #Get Credentials to connect $Cred= Get-Credential $Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password) #Setup the context $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
SharePoint Online: Get List Templates using PowerShell SharePoint Online: Get List Templates using PowerShell Reviewed by Salaudeen Rajack on August 13, 2017 Rating: 5

SharePoint Online: Update HyperLink Field Value using PowerShell

August 13, 2017    , ,
Requirement: Update hyperlink field in SharePoint Online using PowerShell SharePoint Online PowerShell to Update Hyperlink Field Lets add a new link to Link list using PowerShell. #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 $SiteURL="https://crescent.sharepoint.com" $ListName = "Quick Links" $FieldName = "URL" #Get Credentials to connect #$Cred= Get-Credential $Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password) #Setup the context $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL) $Ctx.Credentials = $Credentials #Get the List $List = $Ctx.Web.lists.GetByTitle($ListName) #Add New Item
SharePoint Online: Update HyperLink Field Value using PowerShell SharePoint Online: Update HyperLink Field Value using PowerShell Reviewed by Salaudeen Rajack on August 13, 2017 Rating: 5

SharePoint Online: Manage Files Which Have No Checked in Version using PowerShell

August 11, 2017    ,
When users don't provide value for mandatory metadata field values when uploading files (in classic experience) or when users forget to check in documents while the "Require Check Out" option under versioning settings of any library is set to "Yes", then those files are called "Files Which Have No Checked in Version", The file(s) which are uploaded will be stored on SharePoint but will be check out and visible only to the uploader! Often happens when users upload using File explorer view! Manage Files Which Have No Checked In Version in SharePoint Online: As a site administrator, You can take ownership of files which have no checked in version. To take control, Go to "Manage files which have no checked in version" link under Library Settings,  Select the documents and click on the "Take Ownership of Selection" button and confirmthe prompt.  Once you took the ownership, the document gets removed from this page and starts app
SharePoint Online: Manage Files Which Have No Checked in Version using PowerShell SharePoint Online: Manage Files Which Have No Checked in Version using PowerShell Reviewed by Salaudeen Rajack on August 11, 2017 Rating: 5

Get SharePoint Page Layouts Usage Analysis Report using PowerShell

August 09, 2017    , ,
Requirement: Get an inventory of all available Page layouts and their usage in SharePoint site Collection. How to Get All Page Layouts in SharePoint? If you get into Site Settings page, You can find page layouts either under "Page layouts and site templates" or "Master pages and page layouts" links. Get All Available Page Layouts of a Publishing Site Collection SharePoint Page layouts are scoped at site collection level.   Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue Function Get-PageLayouts { param ( [Parameter(Mandatory=$true)][Microsoft.SharePoint.SPSite]$Site ) #Get the Publishing Site object [Microsoft.Sharepoint.Publishing.PublishingSite]$PublishingSite = New-Object Microsoft.SharePoint.Publishing.PublishingSite($Site) #Get All page layouts $PageLayouts = $PublishingSite.GetPageLayouts($false) ForEach($PageLayout in $PageLayouts) { Write-host $
Get SharePoint Page Layouts Usage Analysis Report using PowerShell Get SharePoint Page Layouts Usage Analysis Report using PowerShell Reviewed by Salaudeen Rajack on August 09, 2017 Rating: 5
Powered by Blogger.