From 571566b618e36884470ddb59730dbb6a6e686351 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Thu, 27 Jul 2017 15:21:14 +0200 Subject: [PATCH] adds Test-ChallengeFile --- src/ChallengeFile/Test-ChallengeFile.ps1 | 48 ++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/ChallengeFile/Test-ChallengeFile.ps1 diff --git a/src/ChallengeFile/Test-ChallengeFile.ps1 b/src/ChallengeFile/Test-ChallengeFile.ps1 new file mode 100644 index 0000000..77eaa06 --- /dev/null +++ b/src/ChallengeFile/Test-ChallengeFile.ps1 @@ -0,0 +1,48 @@ +function Test-ChallengeFile { + <# + .SYNOPSIS + Simple path check for challenge file needed by the CredentialStores. + + .DESCRIPTION + This is supposed to be a internal function to check the existence for a challenge file. + + .PARAMETER Path + Specify the path to the challenge file. + + .INPUTS + [None] + + .OUTPUTS + [Bool]. + + .EXAMPLE + If (Test-ChallengeFile) { + Write-Host "The file exists." + } + Else { + Write-Warning "Couldn't find the given file!" + } + + .NOTES + File Name : Test-ChallengeFile.ps1 + Author : Marco Blessing - marco.blessing@googlemail.com + Requires : + + .LINK + https://github.com/OCram85/PSCredentialStore + #> + + [CmdletBinding()] + param( + [Parameter(Mandatory = $false)] + [ValidateNotNullOrEmpty()] + [String]$Path = "{0}\PSCredentialStore\Challenge.bin" -f $env:ProgramData + ) + + if (Test-Path $Path) { + $true + } + else { + $false + } +}