Create Task List in SharePoint using PowerShell

Requirement:  In SharePoint, create task list using PowerShell!

PowerShell to create task list in SharePoint:

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

$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
    #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

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

This PowerShell script creates SharePoint task list.

sharepoint 2013 powershell create task list

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

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

Leave a Reply