Create Task List in SharePoint using PowerShell

Requirement:  In SharePoint, create a task list using PowerShell!

PowerShell to create task list in SharePoint:

Let me show you how to create a task list in SharePoint using PowerShell:

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Variables
$WebURL="https://intranet.crescent.com"
$ListName="Project Tasks"
$ListDescription ="Task list to manage project tasks"

#Task list template
$ListTemplate = [Microsoft.SharePoint.SPListTemplateType]::Tasks

#Get the Web
$Web = Get-SPWeb $WebURL

#Check if the task list exists already
$TaskList = $Web.Lists.TryGetList($ListName)
if($TaskList -ne $null)
{
    Write-host "Task list '$($ListName)' exists already!" -ForegroundColor Red
}
else
{
    #Create the task list
    $Web.Lists.Add($ListName,$ListDescription,$ListTemplate) | Out-Null

    #Set "Show in Quick Launch" property for the list
    $TaskList = $Web.Lists[$ListName]
    $TaskList.OnQuickLaunch = $True
    $TaskList.Update()

    Write-host "Task list '$($ListName)' Created successfuly!" -ForegroundColor Green
}

This PowerShell script creates a SharePoint task list.

sharepoint 2013 powershell create task list

To add a task in the Task List using PowerShell, use: Create a Task in SharePoint Task List using PowerShell

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. Passionate about sharing the deep technical knowledge and experience to help others, through the real-world articles!

Leave a Reply

Your email address will not be published. Required fields are marked *