Tag: PowerShell Coding

Create a modern team site using PnP PowerShell in SharePoint

Should we create a team site or communication site?

 32,488 total views,  56 views today

 32,488 total views,  56 views today In this tutorial, we will learn about what is a modern team site in SharePoint, what is a communication site in SharePoint online, what is the difference between team site and communication site in SharePoint Online. Then we will learn about how to create a modern team site in SharePoint Online

Continue reading

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

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

 52,333 total views,  76 views today

 52,333 total views,  76 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

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

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

 50,676 total views,  26 views today

 50,676 total views,  26 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

 14,498 total views,  26 views today

 14,498 total views,  26 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

 14,587 total views,  36 views today

 14,587 total views,  36 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

 77,814 total views,  140 views today

 77,814 total views,  140 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

 53,228 total views,  84 views today

 53,228 total views,  84 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

 82,252 total views,  130 views today

 82,252 total views,  130 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

SharePoint Online Automation – O365 – Download files from a document library using PowerShell CSOM

 37,659 total views,  26 views today

 37,659 total views,  26 views today Here in this post – I will show how we can download files or documents from SharePoint online document library using PowerShell CSOM programmatically from the given date by passing the “From Date” and “To Date” to the query. Let’s say we want to download certain files from the SharePoint document

Continue reading

SharePoint Online Automation – O365 – Create multiple items in a list using PowerShell CSOM

 13,034 total views,  50 views today

 13,034 total views,  50 views today Here in this post, I will show how to create multiple list items in SharePoint online list using  PowerShell CSOM code programmatically. PowerShell CSOM code to add multiple items: CLS #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” $fileName

Continue reading