Tag: PowerShell Coding

Create a modern team site using PnP PowerShell in SharePoint

Should we create a team site or communication site?

 14,673 total views,  2 views today

 14,673 total views,  2 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

 20,316 total views,  4 views today

 20,316 total views,  4 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

 18,687 total views,  2 views today

 18,687 total views,  2 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

 6,719 total views,  2 views today

 6,719 total views,  2 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

 5,290 total views,  2 views today

 5,290 total views,  2 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

 30,157 total views,  4 views today

 30,157 total views,  4 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

 23,051 total views

 23,051 total views 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 document library

Continue reading

Encode and decode an URL using PowerShell coding

 25,150 total views,  12 views today

 25,150 total views,  12 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

 21,102 total views,  10 views today

 21,102 total views,  10 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

 4,971 total views,  6 views today

 4,971 total views,  6 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