unblock-scripts.psm1

<#
.Synopsis
   Quick script to unblock all files in my scripts folder
 
.DESCRIPTION
    This function will Unblock all files in the scripts folder, you can specify folder specifically or will default to scritps folder
 
.PARAMETER Path
    The path of the files you want to unblock.
 
.EXAMPLE
    UNBLOCK-SCRIPTS
    This will default to scripts folder
 
.EXAMPLE
    UNBLOCK-SCRIPTS -path c:\temp
    This will unblock the files in the c:\temp folder
 
.EXAMPLE
    UNBLOCK-SCRIPTS c:\temp
    This will unblock the files in the c:\temp folder
 
.LINK
    UNBLOCK-FILE http://go.microsoft.com/fwlink/p/?linkid=294021
#>

function Unblock-Scipts
{
    [CmdletBinding(
        SupportsShouldProcess=$true,
        ConfirmImpact="low")]
    [OutputType([System.IO.DirectoryInfo],ParameterSetName="Path" )]
    Param
    (
        # PATH help description
        [Parameter(Mandatory=$false,
                   ValueFromPipelineByPropertyName=$true,
                   Position=0)]
                $Path = "$env:USERPROFILE\OneDrive\Documents\WindowsPowerShell\Scripts"
        #
        )

    Begin
    {
    write-verbose -Message "Starting unblock process"
    If (Test-Path -path $Path)
        {
        write-verbose -Message "Analyzing $Path"
        }
    Else
        {
        Write-error -message "Failed to find or verify $Path"
        break
        }

    }
    Process
    {
    write-verbose -Message "Getting files in $Path and sending to UNBLOCK-FILE"
    Get-ChildItem -Force -Recurse:$false -path $Path | Unblock-File -Verbose:($PSBoundParameters['Verbose'] -eq $true) -whatif:($PSBoundParameters['WhatIf'] -eq $true)
    #TO DO add recurse switch
    }
    End
    {
    write-verbose -Message "$Path files unblocked"
    }
}