public/Invoke-DeployAlert.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
function Invoke-DeployAlert
{
    <#
 .DESCRIPTION
  Deploy Database Schema to web server. This needs to be updated
    .PARAMETER Destination
        A valid Path is required.
    .PARAMETER Source
        A valid Path is required.
 .EXAMPLE
        Invoke-DeployAlert -Destination c:\wamp\www\PembrokePS -Source c:\OpenProjects\ProjectPembroke\PembrokePSUI
 .NOTES
        It will create the directory if it does not exist.
    #>

    [CmdletBinding()]
    [OutputType([boolean])]
    param(
        [System.IO.Path]$Destination,
        [System.IO.Path]$Source
    )
    try
    {
        Copy-Item -Path $Source -Destination $Destination -Recurse -Confirm:$false -Force
    }
    catch
    {
        $ErrorMessage = $_.Exception.Message
        $FailedItem = $_.Exception.ItemName        
        Write-Error "Error: $ErrorMessage $FailedItem"
        BREAK
    }

}