Skip to content

Instantly share code, notes, and snippets.

@ciphertxt
ciphertxt / SetSPListWorkflowAssocationCleanup.ps1
Created March 26, 2013 11:44
Sets the AutoCleanupDays for all workflow associations (not with a content type) on a list.
# Sample Usage
# Set-SPListWorkflowAssocationCleanup -WebUrl "http://intranet" -ListName "Shared Documents" -CleanupDays 365 -ReportOnly:$false
function Set-SPListWorkflowAssocationCleanup {
    param (
        [string] $WebUrl = $(Read-Host -prompt "Enter a Url"),
        [string] $ListName = $(Read-Host -prompt "Enter a List Name"),
        [int32] $CleanupDays = $(Read-Host -prompt "Enter the number of Cleanup Days"),
        [switch] $ReportOnly = $true
        )