Category: PowerShell

In 2 steps convert a classic SharePoint page to modern using PnP

In 2 steps convert a classic SharePoint page to modern using PnP

 25,274 total views,  86 views today

 25,274 total views,  86 views today Over the many years we as a SharePoint professional, we have been using the SharePoint classic page both in SharePoint on-premise and SharePoint online(classic). But recently in the last couple of years, Microsoft has been focusing to convert the classic SharePoint to modern SharePoint. So in this article, we will learn

Continue reading

[Verified] Office 365: Retrieve hub sites and associated sites using PnP Powershell

[Verified] Office 365: Retrieve hub sites and associated sites using PnP Powershell

 8,224 total views,  4 views today

 8,224 total views,  4 views today In this article, we will learn about how to retrieve hub sites and associated sites using PnP Powershell and Office 365 admin center URL or SharePoint admin center URL. PnP PowerShell script to get all sites connected to a hub site: Using PnP PowerShell get all associated or connected sites to

Continue reading

Office 365: Getting started with SharePoint PnP PowerShell – installation

Office 365: Getting started with SharePoint PnP PowerShell - installation

 31,790 total views,  98 views today

 31,790 total views,  98 views today PnP PowerShell overview The SharePoint Patterns and Practices – short name PnP is a collection library that contains an array of PowerShell commands – named as PnP PowerShell which allows us(SharePoint administrator or developer) to perform complex provisioning and artifact management actions in SharePoint. The PnP PowerShell is built on the

Continue reading

SharePoint Online: Delete All Files from document library for the given date – PowerShell CSOM

SharePoint Online: Delete All Files from document library for the given date - PowerShell CSOM

 8,779 total views,  44 views today

 8,779 total views,  44 views today In this PowerShell script, we will learn about how we can delete all files from all document library in SharePoint online site from a given date by passing From date and To date. The PowerShell script can be used in the below scenario: Delete specific files from SharePoint on-premises library and

Continue reading

PowerShell: How to pass multiple parameters into a function in PowerShell

PowerShell: How to pass multiple parameters into a function in PowerShell

 23,789 total views,  104 views today

 23,789 total views,  104 views today In this post, I will show how to pass multiple parameters into a function in PowerShell coding.  Addition of numbers function using PowerShell example: cls #The below sample function will accept numeric parameters and do the addtion. Function Add-Numbers() { param ( [Parameter(Mandatory=$true)] [int32] $FirstNumber, [Parameter(Mandatory=$true)] [int32] $SecondNumber, [Parameter(Mandatory=$false)][int32] $ThirdNumber )

Continue reading

Exception or Error handling in PowerShell -Try/Catch/Finally Block Example

Exception or Error handling in PowerShell -Try/Catch/Finally Block Example

 7,699 total views,  4 views today

 7,699 total views,  4 views today In this post, I will show that how we can handle the exception in PowerShell coding using the try/catch/finally block and how we can write the error or exception message into the log file. Exception handling using try/catch/finally block PowerShell example: cls $fileName = “File_Uploading_Report” $enddate = (Get-Date).tostring(“yyyyMMddhhmmss”) $logFileName = $fileName

Continue reading

Using PowerShell create a log file

Using PowerShell create a log file

 6,788 total views,  16 views today

 6,788 total views,  16 views today In this post, I will show how to build or create a logging function in PowerShell in the PowerShell “.ps1” file directory. However, we can change to any directory wherever we wish – only we need to change the directory path. How to create a log file for the PowerShell scripting

Continue reading

Using PowerShell – Create a folder if not exists

Using PowerShell - Create a folder if not exists

 36,651 total views,  88 views today

 36,651 total views,  88 views today In this post, I will show how to create a folder or directory if not exists in the given directory or path using PowerShell code or script. The below PowerShell code will create a folder with the name “LogFiles” in the .ps1 file root directory if not exists. Create a folder

Continue reading

SharePoint Online Automation – O365 – Upload files to document library using PowerShell CSOM

 26,685 total views,  36 views today

 26,685 total views,  36 views today Here in this post – I will show how we can upload multiple files or documents to SharePoint online document library using PowerShell CSOM programmatically from the given directory. Below is the list of files – located in my local directory which I am going to upload to the SharePoint Online

Continue reading

Encode and decode an URL using PowerShell coding

Encode and decode an URL using PowerShell coding

 32,616 total views,  68 views today

 32,616 total views,  68 views today Here in this post, I will show how to encode and decode the URL using PowerShell coding, and also we will learn how to decode a SharePoint list id (GUID) using the online tool. Introduction: A website’s URL, also usually known as the “website address”, is what we would enter into

Continue reading