Private/ps1/Install-AppData.ps1



<#
.SYNOPSIS
Create an folder
 
.DESCRIPTION
Long description
 
.PARAMETER DirectoryToCreate
Parameter description
 
.EXAMPLE
An example
 
.NOTES
General notes
#>
#
function Install-AppData{
    [CmdletBinding()]
    Param(
    [Parameter(Mandatory = $True)]
    [String] $DirectoryToCreate)

    if (-not (Test-Path -LiteralPath $DirectoryToCreate)) {
        
        try {
            New-Item -Path $DirectoryToCreate -ItemType Directory -ErrorAction Stop | Out-Null #-Force
        }
        catch {
            Write-Error -Message "Unable to create directory '$DirectoryToCreate'. Error was: $_" -ErrorAction Stop
        }
        Write-host "Successfully saved credentials"
        $DirectoryToCreate

    }
    else {
        Write-host "Directory already existed"
        $DirectoryToCreate
    }
}