## About ## Content (Micro Commits) * fixes #38 * fixes #44 * Implement precise lookup hierarchy (fixes #43) * align pester test with #43 logic * split cert functions * use new cert functions for save an lookup * fix pester tests * [wip] * fix var name ref * fix exports * fix cert store location for windows shared mode * fix mandatory params * fix accidentially removed code block * add basic cert pester pests * remove old docs * update cbh blocks * update cbh blocks * update docs * move .net wrapper forpfx files * do not export .net wrapper functions * update docs * rename tests * fix private functions location * - fixes #44: FTP connection * add link to reference * add format files * add preview version shield * update markdown help files (platyps) * add emoji images in captions * fix typos * fix typos * fix typo * prepare version numbers
68 lines
2.0 KiB
PowerShell
68 lines
2.0 KiB
PowerShell
function Test-CredentialStore {
|
|
<#
|
|
.SYNOPSIS
|
|
Returns the credential store state.
|
|
|
|
.DESCRIPTION
|
|
Use this script to test your credential store. For now it only checks if
|
|
the file exists.
|
|
|
|
.PARAMETER Path
|
|
Define a custom path to a shared CredentialStore.
|
|
|
|
.PARAMETER Shared
|
|
Switch to shared mode with this param. This enforces the command to work with a shared CredentialStore which
|
|
can be decrypted across systems.
|
|
|
|
.EXAMPLE
|
|
Test-CredentialStore -eq $true
|
|
|
|
.NOTES
|
|
- File Name : Test-CredentialStore.ps1
|
|
- Author : Marco Blessing - marco.blessing@googlemail.com
|
|
- Requires :
|
|
|
|
.LINK
|
|
https://github.com/OCram85/PSCredentialStore
|
|
#>
|
|
[CmdletBinding(DefaultParameterSetName = "Private")]
|
|
param(
|
|
[Parameter(Mandatory = $false, ParameterSetName = "Shared")]
|
|
[string]$Path,
|
|
|
|
[Parameter(Mandatory = $true, ParameterSetName = "Shared")]
|
|
[switch]$Shared
|
|
)
|
|
|
|
begin {
|
|
# Set latest Credential Store version
|
|
#Set-Variable -Name "CSVersion" -Value "2.0.0" -Option Constant
|
|
}
|
|
|
|
process {
|
|
# Set the CredentialStore for private, shared or custom mode.
|
|
Write-Debug ("ParameterSetName: {0}" -f $PSCmdlet.ParameterSetName)
|
|
if ($PSCmdlet.ParameterSetName -eq "Private") {
|
|
$Path = Get-DefaultCredentialStorePath
|
|
}
|
|
elseif ($PSCmdlet.ParameterSetName -eq "Shared") {
|
|
if (!($PSBoundParameters.ContainsKey('Path'))) {
|
|
$Path = Get-DefaultCredentialStorePath -Shared
|
|
}
|
|
}
|
|
Write-Verbose -Message ("Path is: {0}" -f $Path)
|
|
|
|
if (Test-Path $Path) {
|
|
Write-Verbose "CredentialStore in given path found."
|
|
return $true
|
|
}
|
|
else {
|
|
Write-Verbose "The given CredentialStore does not exist!"
|
|
return $false
|
|
}
|
|
}
|
|
|
|
end { }
|
|
|
|
}
|