From a71bfd0aaf685c4c93ff06799a161405df43ace1 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Fri, 5 Apr 2019 09:05:50 +0200 Subject: [PATCH 01/31] Implement precise lookup hierarchy (fixes #43) --- src/Item/Get-CredentialStoreItem.ps1 | 21 ++++++++++++++++++++- src/Item/New-CredentialStoreItem.ps1 | 26 ++++++++++++++++++-------- src/Item/Set-CredentialStoreItem.ps1 | 21 ++++++++++++++++++++- src/Store/New-CredentialStore.ps1 | 7 ++++++- 4 files changed, 64 insertions(+), 11 deletions(-) diff --git a/src/Item/Get-CredentialStoreItem.ps1 b/src/Item/Get-CredentialStoreItem.ps1 index f82f581..4494a34 100644 --- a/src/Item/Get-CredentialStoreItem.ps1 +++ b/src/Item/Get-CredentialStoreItem.ps1 @@ -89,7 +89,26 @@ function Get-CredentialStoreItem { if (($CSMembers.MemberType -eq "NoteProperty") -and ($CSMembers.Name -contains $CredentialName)) { try { if ($null -eq $CS.PfxCertificate) { - $Cert = Get-CSCertificate -Thumbprint $CS.Thumbprint + if ($CS.Type -eq 'Private') { + $Cert = Get-CSCertificate -Thumbprint $CS.Thumbprint + } + elseif ($CS.Type -eq 'Shard') { + if (Test-CSCertificate -Thumbprint $CS.Thumbprint -StoreName My -StoreLocation LocalMachine) { + $Cert = Get-CSCertificate -Thumbprint $CS.Thumbprint -StoreName My -StoreLocation LocalMachine + } + elseif (Test-CSCertificate -Thumbprint $CS.Thumbprint -StoreName Root -StoreLocation LocalMachine) { + $Cert = Get-CSCertificate -Thumbprint $CS.Thumbprint -StoreName Root -StoreLocation LocalMachine + } + else { + $ErrorParams = @{ + ErrorAction = 'Stop' + Exception = [System.Exception]::new( + ('Could not find any certificate with thumbprint {0}' -f $CS.Thumbprint) + ) + } + Write-Error @ErrorParams + } + } } else { $Cert = Get-PfxCertificate -FilePath $CS.PfxCertificate -ErrorAction Stop diff --git a/src/Item/New-CredentialStoreItem.ps1 b/src/Item/New-CredentialStoreItem.ps1 index 81a3524..14f6f4a 100644 --- a/src/Item/New-CredentialStoreItem.ps1 +++ b/src/Item/New-CredentialStoreItem.ps1 @@ -118,15 +118,25 @@ function New-CredentialStoreItem { if ($Credential.UserName) { try { if ($null -eq $CSContent.PfxCertificate) { - $Cert = Get-CSCertificate -Thumbprint $CSContent.Thumbprint - if ($null -eq $Cert) { - $ErrorParams = @{ - ErrorAction = 'Stop' - Exception = [System.Security.Cryptography.X509Certificates.FileNotFoundException]::new( - ('Could not find the linked certificate with thumbprint {0}' -f $CSContent.Thumbprint) - ) + if ($CSContent.Type -eq 'Private') { + $Cert = Get-CSCertificate -Thumbprint $CSContent.Thumbprint + } + elseif ($CSContent.Type -eq 'Shard') { + if (Test-CSCertificate -Thumbprint $CSContent.Thumbprint -StoreName My -StoreLocation LocalMachine) { + $Cert = Get-CSCertificate -Thumbprint $CSContent.Thumbprint -StoreName My -StoreLocation LocalMachine + } + elseif (Test-CSCertificate -Thumbprint $CSContent.Thumbprint -StoreName Root -StoreLocation LocalMachine) { + $Cert = Get-CSCertificate -Thumbprint $CSContent.Thumbprint -StoreName Root -StoreLocation LocalMachine + } + else { + $ErrorParams = @{ + ErrorAction = 'Stop' + Exception = [System.Exception]::new( + ('Could not find any certificate with thumbprint {0}' -f $CSContent.Thumbprint) + ) + } + Write-Error @ErrorParams } - Write-Error @ErrorParams } } else { diff --git a/src/Item/Set-CredentialStoreItem.ps1 b/src/Item/Set-CredentialStoreItem.ps1 index 313857e..0fa13d6 100644 --- a/src/Item/Set-CredentialStoreItem.ps1 +++ b/src/Item/Set-CredentialStoreItem.ps1 @@ -104,7 +104,26 @@ function Set-CredentialStoreItem { if ($Credential.UserName) { try { if ($null -eq $CSContent.PfxCertificate) { - $Cert = Get-CSCertificate -Thumbprint $CSContent.Thumbprint + if ($CSContent.Type -eq 'Private') { + $Cert = Get-CSCertificate -Thumbprint $CSContent.Thumbprint + } + elseif ($CSContent.Type -eq 'Shard') { + if (Test-CSCertificate -Thumbprint $CSContent.Thumbprint -StoreName My -StoreLocation LocalMachine) { + $Cert = Get-CSCertificate -Thumbprint $CSContent.Thumbprint -StoreName My -StoreLocation LocalMachine + } + elseif (Test-CSCertificate -Thumbprint $CSContent.Thumbprint -StoreName Root -StoreLocation LocalMachine) { + $Cert = Get-CSCertificate -Thumbprint $CSContent.Thumbprint -StoreName Root -StoreLocation LocalMachine + } + else { + $ErrorParams = @{ + ErrorAction = 'Stop' + Exception = [System.Exception]::new( + ('Could not find any certificate with thumbprint {0}' -f $CSContent.Thumbprint) + ) + } + Write-Error @ErrorParams + } + } } else { $Cert = Get-PfxCertificate -FilePath $CSContent.PfxCertificate -ErrorAction Stop diff --git a/src/Store/New-CredentialStore.ps1 b/src/Store/New-CredentialStore.ps1 index b172e28..7d42885 100644 --- a/src/Store/New-CredentialStore.ps1 +++ b/src/Store/New-CredentialStore.ps1 @@ -210,7 +210,12 @@ function New-CredentialStore { } else { Write-Verbose 'Importing new PFX certificate file...' - Import-CSCertificate -Path $PfxParams.CertName -StoreName My -StoreLocation CurrentUser + if ($PSCmdlet.ParameterSetName -eq 'Private') { + Import-CSCertificate -Path $PfxParams.CertName -StoreName My -StoreLocation CurrentUser -ErrorAction Stop + } + elseif ($PSCmdlet.ParameterSetName -eq 'Shared') { + Import-CSCertificate -Path $PfxParams.CertName -StoreName My -StoreLocation LocalMachine -ErrorAction Stop + } } } -- 2.40.1 From aecc452362a72c552beebc041e2c199a4b29b69d Mon Sep 17 00:00:00 2001 From: OCram85 Date: Fri, 5 Apr 2019 09:09:08 +0200 Subject: [PATCH 02/31] align pester test with #43 logic --- tests/Store/02_New-CredentialStore.Tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Store/02_New-CredentialStore.Tests.ps1 b/tests/Store/02_New-CredentialStore.Tests.ps1 index 028504d..a02caa6 100644 --- a/tests/Store/02_New-CredentialStore.Tests.ps1 +++ b/tests/Store/02_New-CredentialStore.Tests.ps1 @@ -90,7 +90,7 @@ Describe "New-CredentialStore" { $CS = Get-CredentialStore -Shared $CS.PfxCertificate | Should -Be $null $CS.Thumbprint | Should -Not -Be $null - $res = Test-CSCertificate -Thumbprint $CS.Thumbprint -StoreName My -StoreLocation CurrentUser + $res = Test-CSCertificate -Thumbprint $CS.Thumbprint -StoreName My -StoreLocation LocalMachine #Write-Verbose -Message ('res: {0}' -f $res) -Verbose $res | Should -Be $true } -- 2.40.1 From c26fc7d43d7f744f9a8bbf1cfd7570d2381ac7fb Mon Sep 17 00:00:00 2001 From: OCram85 Date: Fri, 5 Apr 2019 11:14:18 +0200 Subject: [PATCH 03/31] split cert functions --- src/Certificate/Get-CSCertificate.ps1 | 81 ++++++------- src/Certificate/Get-CSPfxCertificate.ps1 | 81 +++++++++++++ src/Certificate/Import-CSCertificate.ps1 | 102 +++++----------- src/Certificate/Import-CSPfxCertificate.ps1 | 112 ++++++++++++++++++ ...TAttribute.ps1 => New-CSCertAttribute.ps1} | 6 +- ...xCertificate.ps1 => New-CSCertificate.ps1} | 8 +- src/Certificate/Test-CSCertificate.ps1 | 80 ++++++------- src/Certificate/Test-CSPfxCertificate.ps1 | 86 ++++++++++++++ ...xCertificate.ps1 => Use-CSCertificate.ps1} | 24 ++-- src/PSCredentialStore.psd1 | 7 +- src/Store/New-CredentialStore.ps1 | 30 +++-- 11 files changed, 423 insertions(+), 194 deletions(-) create mode 100644 src/Certificate/Get-CSPfxCertificate.ps1 create mode 100644 src/Certificate/Import-CSPfxCertificate.ps1 rename src/Certificate/{New-CRTAttribute.ps1 => New-CSCertAttribute.ps1} (87%) rename src/Certificate/{New-PfxCertificate.ps1 => New-CSCertificate.ps1} (92%) create mode 100644 src/Certificate/Test-CSPfxCertificate.ps1 rename src/Certificate/{Use-PfxCertificate.ps1 => Use-CSCertificate.ps1} (81%) diff --git a/src/Certificate/Get-CSCertificate.ps1 b/src/Certificate/Get-CSCertificate.ps1 index 0e2cd6e..fdff236 100644 --- a/src/Certificate/Get-CSCertificate.ps1 +++ b/src/Certificate/Get-CSCertificate.ps1 @@ -1,28 +1,25 @@ function Get-CSCertificate { <# .SYNOPSIS - Returns the certificate object given by thumbprint. + Returns the current used valid PfX Certificate. .DESCRIPTION - You can use this function to get a stored certificate. Search for the object by its unique thumbprint. + Use this function to get the available pfx certficate respecting the config hierarchy. + + .PARAMETER Type + Select the current credential store type. .PARAMETER Thumbprint - Provide one or more thumprints. - - .PARAMETER StoreName - Select the store name in which you want to search the certificates. - - .PARAMETER StoreLocation - Select between the both available locations CurrentUser odr LocalMachine. + Provice the crednetials thumbprint for the search. .INPUTS - [string] + [None] .OUTPUTS - [System.Security.Cryptography.X509Certificates.X509Certificate2[]] + [System.Security.Cryptography.X509Certificates.X509Certificate2] .EXAMPLE - Get-CSCertificate -Thumbprint '12345678' -StoreName 'My' -StoreLocation 'CurrentUser' + Get-CSCertificate -Type 'Shared' -Thumbprint '12334456' .NOTES File Name : Get-CSCertificate.ps1 @@ -35,47 +32,43 @@ function Get-CSCertificate { [CmdletBinding()] [OutputType([System.Security.Cryptography.X509Certificates.X509Certificate2])] param( - [Parameter(Mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] - [string[]]$Thumbprint, + [ValidateSet('Private', 'Shared')] + [string]$Type, - [Parameter(Mandatory = $false)] - [ValidateSet( - 'AddressBook', - 'AuthRoot', - 'CertificateAuthority', - 'Disallowed', - 'My', - 'Root', - 'TrustedPeople', - 'TrustedPublisher' - )] - [string]$StoreName = 'My', - - [Parameter(Mandatory = $false)] - [ValidateSet( - 'CurrentUser', - 'LocalMachine' - )] - [string]$StoreLocation = 'CurrentUser' + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string]$Thumbprint ) begin { - $Store = [System.Security.Cryptography.X509Certificates.X509Store]::New($StoreName, $StoreLocation) - try { - $Store.Open('ReadOnly') - } - catch { - $_.Exception.Message | Write-Error -ErrorAction Stop - } } - process { - foreach ($Thumb in $Thumbprint) { - Write-Output $Store.Certificates | Where-Object { $_.Thumbprint -eq $Thumb } + if ($Type -eq 'Private') { + Get-CSPfXCertificate -Thumbprint $Thumbprint -StoreName 'My' -StoreLocation 'CurrentUser' + } + elseif ($Type -eq 'Shared') { + if ( $isLinux) { + $cert = Get-CSPfxCertificate -Thumbprint $Thumbprint -StoreName 'My' -StoreLocation 'CurrentUser' + if ($null -eq $cert) { + Get-CSPfxCertificate -Thumbprint $Thumbprint -StoreName 'Root' -StoreLocation 'LocalMachine' + } + else { + Write-Output $cert + } + } + elseif ( (! $isLinux) -or ($isWindows) ) { + $cert = Get-CSPfxCertificate -Thumbprint $Thumbprint -StoreName 'My' -StoreLocation 'LocalMachine' + if ($null -eq $cert) { + Get-CSPfxCertificate -Thumbprint $Thumbprint -StoreName 'Root' -StoreLocation 'LocalMachine' + } + else { + Write-Output $cert + } + } } } end { - $Store.Close() } } diff --git a/src/Certificate/Get-CSPfxCertificate.ps1 b/src/Certificate/Get-CSPfxCertificate.ps1 new file mode 100644 index 0000000..be1d0ef --- /dev/null +++ b/src/Certificate/Get-CSPfxCertificate.ps1 @@ -0,0 +1,81 @@ +function Get-CSPfxCertificate { + <# + .SYNOPSIS + Returns the certificate object given by thumbprint. + + .DESCRIPTION + You can use this function to get a stored certificate. Search for the object by its unique thumbprint. + + .PARAMETER Thumbprint + Provide one or more thumprints. + + .PARAMETER StoreName + Select the store name in which you want to search the certificates. + + .PARAMETER StoreLocation + Select between the both available locations CurrentUser odr LocalMachine. + + .INPUTS + [string] + + .OUTPUTS + [System.Security.Cryptography.X509Certificates.X509Certificate2[]] + + .EXAMPLE + Get-CSPfxCertificate -Thumbprint '12345678' -StoreName 'My' -StoreLocation 'CurrentUser' + + .NOTES + File Name : Get-CSPfxCertificate.ps1 + Author : Marco Blessing - marco.blessing@googlemail.com + Requires : + + .LINK + https://github.com/OCram85/PSCredentialStore + #> + [CmdletBinding()] + [OutputType([System.Security.Cryptography.X509Certificates.X509Certificate2])] + param( + [Parameter(Mandatory = $true, ValueFromPipeline = $true)] + [ValidateNotNullOrEmpty()] + [string[]]$Thumbprint, + + [Parameter(Mandatory = $false)] + [ValidateSet( + 'AddressBook', + 'AuthRoot', + 'CertificateAuthority', + 'Disallowed', + 'My', + 'Root', + 'TrustedPeople', + 'TrustedPublisher' + )] + [string]$StoreName = 'My', + + [Parameter(Mandatory = $false)] + [ValidateSet( + 'CurrentUser', + 'LocalMachine' + )] + [string]$StoreLocation = 'CurrentUser' + ) + + begin { + $Store = [System.Security.Cryptography.X509Certificates.X509Store]::New($StoreName, $StoreLocation) + try { + $Store.Open('ReadOnly') + } + catch { + $_.Exception.Message | Write-Error -ErrorAction Stop + } + } + + process { + foreach ($Thumb in $Thumbprint) { + Write-Output $Store.Certificates | Where-Object { $_.Thumbprint -eq $Thumb } + } + } + end { + $Store.Close() + } +} diff --git a/src/Certificate/Import-CSCertificate.ps1 b/src/Certificate/Import-CSCertificate.ps1 index 6738036..9d0fcb0 100644 --- a/src/Certificate/Import-CSCertificate.ps1 +++ b/src/Certificate/Import-CSCertificate.ps1 @@ -1,32 +1,27 @@ function Import-CSCertificate { <# .SYNOPSIS - adds a given pfx certificate file to current uerers personal certificate store. + A brief description of the function or script. .DESCRIPTION - This function is used to import existing pfx certificate files. The Import-PFXCertificate cmdle from the - PKI module imports the certficate into a deprecated store. Thus you can't read the private key afterwards or - using it for decrypting data. + Describe the function of the script using a single sentence or more. - .PARAMETER Path - Path to an existing *.pfx certificate file. - - .PARAMETER StoreName - Additionally you change change the store where you want the certificate into. + .PARAMETER One + Description of the Parameter (what it does) .INPUTS - [None] + Describe the script input parameters (if any), otherwise it may also list the word "[None]". .OUTPUTS - [None] + Describe the script output parameters (if any), otherwise it may also list the word "[None]". .EXAMPLE - Import-CSCertificate -Path (Join-Path -Path $Env:APPDATA -ChildPath '/PSCredentialStore.pfx') + .\Remove-Some-Script.ps1 -One content .NOTES File Name : Import-CSCertificate.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : + Author : fullname - mail + Requires : ModuleNames .LINK https://github.com/OCram85/PSCredentialStore @@ -36,77 +31,38 @@ function Import-CSCertificate { param( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] - [string]$Path, + [ValidateSet('Private', 'Shared')] + [string]$Type, - [Parameter(Mandatory = $false)] - [ValidateSet( - 'AddressBook', - 'AuthRoot', - 'CertificateAuthority', - 'Disallowed', - 'My', - 'Root', - 'TrustedPeople', - 'TrustedPublisher' - )] - [string]$StoreName = 'My', + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.IO.FileInfo]$Path - [Parameter(Mandatory = $false)] - [ValidateSet( - 'CurrentUser', - 'LocalMachine' - )] - [string]$StoreLocation = 'CurrentUser', - - [Parameter(Mandatory = $false)] - [ValidateSet( - 'ReadOnly', - 'ReadWrite', - 'MaxAllowed', - 'OpenExistingOnly', - 'InclueArchived' - )] - [string]$OpenFlags = 'ReadWrite' ) begin { - $Store = [System.Security.Cryptography.X509Certificates.X509Store]::new($StoreName, $StoreLocation) - try { - $Store.Open($OpenFlags) - } - catch { - $_.Exception.Message | Write-Error -ErrorAction Stop - } - } - process { - try { - $cert = [System.Security.Cryptography.X509Certificates.X509Certificate2]::new( - $Path, - $null, - ( - [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::Exportable -bor - [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::PersistKeySet - ) - ) - - if (Test-CSCertificate -Thumbprint $cert.Thumbprint) { - Write-Warning -Message ('The certificate with thumbprint {0} is already present!' -f $cert.Thumbprint) - } - else { - $Store.Add($cert) - } - } - catch { - $_.Exception.Message | Write-Error -ErrorAction Stop + if (! (Test-Path -Path $Path)) { $ErrorParams = @{ ErrorAction = 'Stop' Exception = [System.Exception]::new( - 'Could not read or add the pfx certificate!' + ('File {0} not found!') -f $Path ) } Write-Error @ErrorParams } } + + process { + # Import to CurrentUser\My stor for windows and linux + if ($Type -eq 'Private') { + Import-CSPfxCertificate -Path $Path -StoreName 'My' -StoreLocation 'CurrentUser' -OpenFlags 'ReadWrite' + } + elseif ( (! $isLinux ) -and ($Type -eq 'Shared') ) { + Import-CSPfxCertificate -Path $Path -StoreName 'My' -StoreLocation 'CurrentUser' -OpenFlags 'ReadWrite' + } + elseif ( ($isLinux) -and ($Type -eq 'Shared') ) { + Import-CSPfxCertificate -Path $Path -StoreName 'My' -StoreLocation 'LocalMachine' -OpenFlags 'ReadWrite' + } + } end { - $Store.Close() } } diff --git a/src/Certificate/Import-CSPfxCertificate.ps1 b/src/Certificate/Import-CSPfxCertificate.ps1 new file mode 100644 index 0000000..464c419 --- /dev/null +++ b/src/Certificate/Import-CSPfxCertificate.ps1 @@ -0,0 +1,112 @@ +function Import-CSPfxCertificate { + <# + .SYNOPSIS + adds a given pfx certificate file to current uerers personal certificate store. + + .DESCRIPTION + This function is used to import existing pfx certificate files. The Import-PFXCertificate cmdle from the + PKI module imports the certficate into a deprecated store. Thus you can't read the private key afterwards or + using it for decrypting data. + + .PARAMETER Path + Path to an existing *.pfx certificate file. + + .PARAMETER StoreName + Additionally you change change the store where you want the certificate into. + + .INPUTS + [None] + + .OUTPUTS + [None] + + .EXAMPLE + Import-CSPfxCertificate -Path (Join-Path -Path $Env:APPDATA -ChildPath '/PSCredentialStore.pfx') + + .NOTES + File Name : Import-CSPfxCertificate.ps1 + Author : Marco Blessing - marco.blessing@googlemail.com + Requires : + + .LINK + https://github.com/OCram85/PSCredentialStore + #> + [CmdletBinding()] + [OutputType()] + param( + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string]$Path, + + [Parameter(Mandatory = $false)] + [ValidateSet( + 'AddressBook', + 'AuthRoot', + 'CertificateAuthority', + 'Disallowed', + 'My', + 'Root', + 'TrustedPeople', + 'TrustedPublisher' + )] + [string]$StoreName = 'My', + + [Parameter(Mandatory = $false)] + [ValidateSet( + 'CurrentUser', + 'LocalMachine' + )] + [string]$StoreLocation = 'CurrentUser', + + [Parameter(Mandatory = $false)] + [ValidateSet( + 'ReadOnly', + 'ReadWrite', + 'MaxAllowed', + 'OpenExistingOnly', + 'InclueArchived' + )] + [string]$OpenFlags = 'ReadWrite' + ) + begin { + $Store = [System.Security.Cryptography.X509Certificates.X509Store]::new($StoreName, $StoreLocation) + try { + $Store.Open($OpenFlags) + } + catch { + $_.Exception.Message | Write-Error -ErrorAction Stop + } + } + process { + try { + $cert = [System.Security.Cryptography.X509Certificates.X509Certificate2]::new( + $Path, + $null, + ( + [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::Exportable -bor + [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::PersistKeySet + ) + ) + + if (Test-CSCertificate -Thumbprint $cert.Thumbprint) { + Write-Warning -Message ('The certificate with thumbprint {0} is already present!' -f $cert.Thumbprint) + } + else { + $Store.Add($cert) + } + } + catch { + $_.Exception.Message | Write-Error -ErrorAction Stop + $ErrorParams = @{ + ErrorAction = 'Stop' + Exception = [System.Exception]::new( + 'Could not read or add the pfx certificate!' + ) + } + Write-Error @ErrorParams + } + } + end { + $Store.Close() + } +} diff --git a/src/Certificate/New-CRTAttribute.ps1 b/src/Certificate/New-CSCertAttribute.ps1 similarity index 87% rename from src/Certificate/New-CRTAttribute.ps1 rename to src/Certificate/New-CSCertAttribute.ps1 index 30d76dc..484a0c5 100644 --- a/src/Certificate/New-CRTAttribute.ps1 +++ b/src/Certificate/New-CSCertAttribute.ps1 @@ -1,4 +1,4 @@ -function New-CRTAttribute { +function New-CSCertAttribute { <# .SYNOPSIS Create required data for a certificate signing request. @@ -35,10 +35,10 @@ function New-CRTAttribute { ['PSCredentialStore.Certificate.CSRDetails'] .EXAMPLE - New-CRTAttribute -CSRSubject @{Country = 'DE'; State = 'BW'; City = 'Karlsruhe'; Organization = 'AwesomeIT'; OrganizationalUnitName = '';CommonName = 'MyPrivateCert'} + New-CSCertAttribute -CSRSubject @{Country = 'DE'; State = 'BW'; City = 'Karlsruhe'; Organization = 'AwesomeIT'; OrganizationalUnitName = '';CommonName = 'MyPrivateCert'} .NOTES - File Name : New-CSRDetails.ps1 + File Name : New-CSCertAttribute.ps1 Author : Marco Blessing - marco.blessing@googlemail.com Requires : diff --git a/src/Certificate/New-PfxCertificate.ps1 b/src/Certificate/New-CSCertificate.ps1 similarity index 92% rename from src/Certificate/New-PfxCertificate.ps1 rename to src/Certificate/New-CSCertificate.ps1 index 4fb7a40..a4ed69d 100644 --- a/src/Certificate/New-PfxCertificate.ps1 +++ b/src/Certificate/New-CSCertificate.ps1 @@ -1,7 +1,7 @@ -function New-PfxCertificate { +function New-CSCertificate { <# .SYNOPSIS - Creates new PFX certificate for the CredentialStore encryption. + Creates a new PFX certificate for the CredentialStore encryption. .DESCRIPTION Use this function to create a custom self signed certificate used by the PSCredentialStore module. @@ -22,10 +22,10 @@ function New-PfxCertificate { [None] .EXAMPLE - New-PfxCertificate -CRTAttribute $CRTAttribute -KeyName './myprivate.key' -CertName './mycert.pfx' + New-CSCertificate -CRTAttribute $CRTAttribute -KeyName './myprivate.key' -CertName './mycert.pfx' .NOTES - File Name : New-PfxCertificate.ps1 + File Name : New-CSCertificate.ps1 Author : Marco Blessing - marco.blessing@googlemail.com Requires : diff --git a/src/Certificate/Test-CSCertificate.ps1 b/src/Certificate/Test-CSCertificate.ps1 index 7a6c97f..3bee1f0 100644 --- a/src/Certificate/Test-CSCertificate.ps1 +++ b/src/Certificate/Test-CSCertificate.ps1 @@ -1,19 +1,13 @@ function Test-CSCertificate { <# .SYNOPSIS - Tests if the given certificate exists in a store. + Tests if the linked certificate is stor ein the specified cert stores. .DESCRIPTION - Use this function to ensure if a certificate is already imported into a given store. + Test-CSCertficate should be an easy high level test for the linked certificate. - .PARAMETER Thumbprint - Provide one or more thumprints. - - .PARAMETER StoreName - Select the store name in which you want to search the certificates. - - .PARAMETER StoreLocation - Select between the both available locations CurrentUser odr LocalMachine. + .PARAMETER Type + Select between 'Private' or 'Shared'. .INPUTS [None] @@ -22,11 +16,11 @@ function Test-CSCertificate { [bool] .EXAMPLE - Test-CSCertificate -Thumbprint '12345678' -StoreName 'My' -StoreLocation 'CurrentUser' + .\Remove-Some-Script.ps1 -One content .NOTES File Name : Test-CSCertificate.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com + Author : Marco Blessin - marco.blessing@googlemail.com Requires : .LINK @@ -35,45 +29,42 @@ function Test-CSCertificate { [CmdletBinding()] [OutputType([bool])] param( - [Parameter(Mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] - [string]$Thumbprint, - - [Parameter(Mandatory = $false)] - [ValidateSet( - 'AddressBook', - 'AuthRoot', - 'CertificateAuthority', - 'Disallowed', - 'My', - 'Root', - 'TrustedPeople', - 'TrustedPublisher' - )] - [string]$StoreName = 'My', - - [Parameter(Mandatory = $false)] - [ValidateSet( - 'CurrentUser', - 'LocalMachine' - )] - [string]$StoreLocation = 'CurrentUser' + [ValidateSet('Private', 'Shared')] + [string]$Type ) - begin { - $Store = [System.Security.Cryptography.X509Certificates.X509Store]::New($StoreName, $StoreLocation) - try { - $Store.Open('ReadOnly') + if ($Type -eq 'Private') { + $CS = Get-CredentialStore } - catch { - $_.Exception.Message | Write-Error -ErrorAction Stop + elseif ($Type -eq 'Shared') { + $CS = Get-CredentialStore -Shared } + if ($null -ne $CS.PfxCertificate) { + Write-Warning 'There is a Pfx certificate file linked in the store. Certifcates saved in the Cert store will be ignored!' + } + } - process { - $Cert = $Store.Certificates | Where-Object { $_.Thumbprint -eq $Thumbprint } - - if ($null -eq $Cert) { + if ($Type -eq 'Private') { + $cert = Get-CSPfXCertificate -Thumbprint $Thumbprint -StoreName 'My' -StoreLocation 'CurrentUser' + } + elseif ($Type -eq 'Shared') { + if ( $isLinux) { + $cert = Get-CSPfxCertificate -Thumbprint $Thumbprint -StoreName 'My' -StoreLocation 'CurrentUser' + if ($null -eq $cert) { + $cert = Get-CSPfxCertificate -Thumbprint $Thumbprint -StoreName 'Root' -StoreLocation 'LocalMachine' + } + } + elseif ( (! $isLinux) -or ($isWindows) ) { + $cert = Get-CSPfxCertificate -Thumbprint $Thumbprint -StoreName 'My' -StoreLocation 'LocalMachine' + if ($null -eq $cert) { + $cert = Get-CSPfxCertificate -Thumbprint $Thumbprint -StoreName 'Root' -StoreLocation 'LocalMachine' + } + } + } + if ($null -eq $cert) { return $false } else { @@ -81,6 +72,5 @@ function Test-CSCertificate { } } end { - $Store.Close() } } diff --git a/src/Certificate/Test-CSPfxCertificate.ps1 b/src/Certificate/Test-CSPfxCertificate.ps1 new file mode 100644 index 0000000..a621931 --- /dev/null +++ b/src/Certificate/Test-CSPfxCertificate.ps1 @@ -0,0 +1,86 @@ +function Test-CSPfxCertificate { + <# + .SYNOPSIS + Tests if the given certificate exists in a store. + + .DESCRIPTION + Use this function to ensure if a certificate is already imported into a given store. + + .PARAMETER Thumbprint + Provide one or more thumprints. + + .PARAMETER StoreName + Select the store name in which you want to search the certificates. + + .PARAMETER StoreLocation + Select between the both available locations CurrentUser odr LocalMachine. + + .INPUTS + [None] + + .OUTPUTS + [bool] + + .EXAMPLE + Test-CSPfxCertificat -Thumbprint '12345678' -StoreName 'My' -StoreLocation 'CurrentUser' + + .NOTES + File Name : Test-CSPfxCertificat.ps1 + Author : Marco Blessing - marco.blessing@googlemail.com + Requires : + + .LINK + https://github.com/OCram85/PSCredentialStore + #> + [CmdletBinding()] + [OutputType([bool])] + param( + [Parameter(Mandatory = $true, ValueFromPipeline = $true)] + [ValidateNotNullOrEmpty()] + [string]$Thumbprint, + + [Parameter(Mandatory = $false)] + [ValidateSet( + 'AddressBook', + 'AuthRoot', + 'CertificateAuthority', + 'Disallowed', + 'My', + 'Root', + 'TrustedPeople', + 'TrustedPublisher' + )] + [string]$StoreName = 'My', + + [Parameter(Mandatory = $false)] + [ValidateSet( + 'CurrentUser', + 'LocalMachine' + )] + [string]$StoreLocation = 'CurrentUser' + ) + + begin { + $Store = [System.Security.Cryptography.X509Certificates.X509Store]::New($StoreName, $StoreLocation) + try { + $Store.Open('ReadOnly') + } + catch { + $_.Exception.Message | Write-Error -ErrorAction Stop + } + } + + process { + $Cert = $Store.Certificates | Where-Object { $_.Thumbprint -eq $Thumbprint } + + if ($null -eq $Cert) { + return $false + } + else { + return $true + } + } + end { + $Store.Close() + } +} diff --git a/src/Certificate/Use-PfxCertificate.ps1 b/src/Certificate/Use-CSCertificate.ps1 similarity index 81% rename from src/Certificate/Use-PfxCertificate.ps1 rename to src/Certificate/Use-CSCertificate.ps1 index e1802d7..4298bf7 100644 --- a/src/Certificate/Use-PfxCertificate.ps1 +++ b/src/Certificate/Use-CSCertificate.ps1 @@ -1,4 +1,4 @@ -function Use-PfxCertificate { +function Use-CSCertificate { <# .SYNOPSIS Links an existing PFX Certifiacte to a CredentialStore. @@ -19,7 +19,7 @@ function Use-PfxCertificate { .NOTES - File Name : Use-PfxCertificate.ps1 + File Name : Use-CSCertificate.ps1 Author : Marco Blessing - marco.blessing@googlemail.com Requires : @@ -40,9 +40,13 @@ function Use-PfxCertificate { [string]$CredentialStore, [Parameter(Mandatory = $true, ParameterSetName = "Shared")] - [switch]$Shared + [switch]$Shared, + + [Parameter(Mandatory = $true, ParameterSetName = "Private")] + [Parameter(Mandatory = $true, ParameterSetName = "Shared")] + [Switch]$UseCertStore ) - begin {} + begin { } process { try { @@ -93,10 +97,16 @@ Make sure you used the same AES keys for encrypting! "@ } - $CS.PfxCertificate = $validPath.Path - $CS.Thumbprint = $PfxCertificate.Thumbprint + if ($UseCertStore) { + Import-CSCertificate -Type ($PSCmdlet.ParameterSetName -eq "Private") -Path $Path + $CS.Thumbprint = $PfxCertificate.Thumbprint + $CS.PfxCertificate = $null + } + else { + $CS.PfxCertificate = $validPath.Path + } $CS | ConvertTo-Json -Depth 5 | Out-File -FilePath $StorePath -Force -Encoding utf8 } - end {} + end { } } diff --git a/src/PSCredentialStore.psd1 b/src/PSCredentialStore.psd1 index 190a725..147038a 100644 --- a/src/PSCredentialStore.psd1 +++ b/src/PSCredentialStore.psd1 @@ -64,10 +64,13 @@ FunctionsToExport = @( # Certificate 'Get-CSCertificate', + 'Get-CSPfxCertificate', 'Import-CSCertificate', - 'New-CRTAttribute', - 'New-PfxCertificate', + 'Import-CSPfxCertificate', + 'New-CSCertAttribute', + 'New-CSCertificate', 'Test-CSCertificate', + 'Test-CSPfxCertificate', 'Use-PfxCertificate', # Connection 'Connect-To', diff --git a/src/Store/New-CredentialStore.ps1 b/src/Store/New-CredentialStore.ps1 index 7d42885..8f8963a 100644 --- a/src/Store/New-CredentialStore.ps1 +++ b/src/Store/New-CredentialStore.ps1 @@ -202,22 +202,6 @@ function New-CredentialStore { Thumbprint = $null Type = $null } - if (! $SkipPFXCertCreation.IsPresent) { - $ObjProperties.Thumbprint = $FreshCert.Thumbprint - - if (!$UseCertStore.IsPresent) { - $ObjProperties.PfxCertificate = $PfxParams.CertName - } - else { - Write-Verbose 'Importing new PFX certificate file...' - if ($PSCmdlet.ParameterSetName -eq 'Private') { - Import-CSCertificate -Path $PfxParams.CertName -StoreName My -StoreLocation CurrentUser -ErrorAction Stop - } - elseif ($PSCmdlet.ParameterSetName -eq 'Shared') { - Import-CSCertificate -Path $PfxParams.CertName -StoreName My -StoreLocation LocalMachine -ErrorAction Stop - } - } - } if ($PSCmdlet.ParameterSetName -eq "Shared") { $ObjProperties.Type = "Shared" @@ -226,6 +210,20 @@ function New-CredentialStore { $ObjProperties.Type = "Private" } + if (! $SkipPFXCertCreation.IsPresent) { + $ObjProperties.Thumbprint = $FreshCert.Thumbprint + + if ($UseCertStore.IsPresent) { + Write-Verbose 'Importing new PFX certificate file...' + Import-CSCertificate -Type $ObjProperties.Type -Path $PfxParams.CertName + } + else { + $ObjProperties.PfxCertificate = $PfxParams.CertName + + } + } + + $CredentialStoreObj = [PSCustomObject]$ObjProperties try { $JSON = ConvertTo-Json -InputObject $CredentialStoreObj -ErrorAction Stop -- 2.40.1 From 381d0abf7dd73796fd517e9a91829b2dea61db53 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Fri, 5 Apr 2019 11:21:25 +0200 Subject: [PATCH 04/31] use new cert functions for save an lookup --- src/Item/Get-CredentialStoreItem.ps1 | 38 +--------------------------- src/Item/New-CredentialStoreItem.ps1 | 38 +--------------------------- src/Item/Set-CredentialStoreItem.ps1 | 38 +--------------------------- src/Store/New-CredentialStore.ps1 | 4 +-- 4 files changed, 5 insertions(+), 113 deletions(-) diff --git a/src/Item/Get-CredentialStoreItem.ps1 b/src/Item/Get-CredentialStoreItem.ps1 index 4494a34..5f529fa 100644 --- a/src/Item/Get-CredentialStoreItem.ps1 +++ b/src/Item/Get-CredentialStoreItem.ps1 @@ -87,43 +87,7 @@ function Get-CredentialStoreItem { $CSMembers = Get-Member -InputObject $CS # Let's first check if the given remote host exists as object property if (($CSMembers.MemberType -eq "NoteProperty") -and ($CSMembers.Name -contains $CredentialName)) { - try { - if ($null -eq $CS.PfxCertificate) { - if ($CS.Type -eq 'Private') { - $Cert = Get-CSCertificate -Thumbprint $CS.Thumbprint - } - elseif ($CS.Type -eq 'Shard') { - if (Test-CSCertificate -Thumbprint $CS.Thumbprint -StoreName My -StoreLocation LocalMachine) { - $Cert = Get-CSCertificate -Thumbprint $CS.Thumbprint -StoreName My -StoreLocation LocalMachine - } - elseif (Test-CSCertificate -Thumbprint $CS.Thumbprint -StoreName Root -StoreLocation LocalMachine) { - $Cert = Get-CSCertificate -Thumbprint $CS.Thumbprint -StoreName Root -StoreLocation LocalMachine - } - else { - $ErrorParams = @{ - ErrorAction = 'Stop' - Exception = [System.Exception]::new( - ('Could not find any certificate with thumbprint {0}' -f $CS.Thumbprint) - ) - } - Write-Error @ErrorParams - } - } - } - else { - $Cert = Get-PfxCertificate -FilePath $CS.PfxCertificate -ErrorAction Stop - } - } - catch { - $_.Exception.Message | Write-Error - $ErrorParams = @{ - ErrorAction = 'Stop' - Exception = [System.Security.Cryptography.CryptographicException]::new( - 'Could not read the given PFX certificate.' - ) - } - Write-Error @ErrorParams - } + $Cert = Get-CSCertificate -Type $CS.Type -Thumbprint $CS.Thumbprint $DecryptedKey = $Cert.PrivateKey.Decrypt( [Convert]::FromBase64String($CS.$CredentialName.EncryptedKey), [System.Security.Cryptography.RSAEncryptionPadding]::Pkcs1 diff --git a/src/Item/New-CredentialStoreItem.ps1 b/src/Item/New-CredentialStoreItem.ps1 index 14f6f4a..a52c1b9 100644 --- a/src/Item/New-CredentialStoreItem.ps1 +++ b/src/Item/New-CredentialStoreItem.ps1 @@ -116,43 +116,7 @@ function New-CredentialStoreItem { } if ($Credential.UserName) { - try { - if ($null -eq $CSContent.PfxCertificate) { - if ($CSContent.Type -eq 'Private') { - $Cert = Get-CSCertificate -Thumbprint $CSContent.Thumbprint - } - elseif ($CSContent.Type -eq 'Shard') { - if (Test-CSCertificate -Thumbprint $CSContent.Thumbprint -StoreName My -StoreLocation LocalMachine) { - $Cert = Get-CSCertificate -Thumbprint $CSContent.Thumbprint -StoreName My -StoreLocation LocalMachine - } - elseif (Test-CSCertificate -Thumbprint $CSContent.Thumbprint -StoreName Root -StoreLocation LocalMachine) { - $Cert = Get-CSCertificate -Thumbprint $CSContent.Thumbprint -StoreName Root -StoreLocation LocalMachine - } - else { - $ErrorParams = @{ - ErrorAction = 'Stop' - Exception = [System.Exception]::new( - ('Could not find any certificate with thumbprint {0}' -f $CSContent.Thumbprint) - ) - } - Write-Error @ErrorParams - } - } - } - else { - $Cert = Get-PfxCertificate -FilePath $CSContent.PfxCertificate -ErrorAction Stop - } - } - catch { - $_.Exception.Message | Write-Error - $ErrorParams = @{ - ErrorAction = 'Stop' - Exception = [System.Security.Cryptography.CryptographicException]::new( - 'Could not read the given PFX certificate.' - ) - } - Write-Error @ErrorParams - } + $Cert = Get-CSCertificate -Type $CSContent.Type -Thumbprint $CSContent.Thumbprint if (Get-Member -InputObject $CSContent -Name $CredentialName -Membertype Properties) { $MessageParams = @{ diff --git a/src/Item/Set-CredentialStoreItem.ps1 b/src/Item/Set-CredentialStoreItem.ps1 index 0fa13d6..7df7845 100644 --- a/src/Item/Set-CredentialStoreItem.ps1 +++ b/src/Item/Set-CredentialStoreItem.ps1 @@ -102,43 +102,7 @@ function Set-CredentialStoreItem { } if ($Credential.UserName) { - try { - if ($null -eq $CSContent.PfxCertificate) { - if ($CSContent.Type -eq 'Private') { - $Cert = Get-CSCertificate -Thumbprint $CSContent.Thumbprint - } - elseif ($CSContent.Type -eq 'Shard') { - if (Test-CSCertificate -Thumbprint $CSContent.Thumbprint -StoreName My -StoreLocation LocalMachine) { - $Cert = Get-CSCertificate -Thumbprint $CSContent.Thumbprint -StoreName My -StoreLocation LocalMachine - } - elseif (Test-CSCertificate -Thumbprint $CSContent.Thumbprint -StoreName Root -StoreLocation LocalMachine) { - $Cert = Get-CSCertificate -Thumbprint $CSContent.Thumbprint -StoreName Root -StoreLocation LocalMachine - } - else { - $ErrorParams = @{ - ErrorAction = 'Stop' - Exception = [System.Exception]::new( - ('Could not find any certificate with thumbprint {0}' -f $CSContent.Thumbprint) - ) - } - Write-Error @ErrorParams - } - } - } - else { - $Cert = Get-PfxCertificate -FilePath $CSContent.PfxCertificate -ErrorAction Stop - } - } - catch { - $_.Exception.Message | Write-Error - $ErrorParams = @{ - ErrorAction = 'Stop' - Exception = [System.Security.Cryptography.CryptographicException]::new( - 'Could not read the given PFX certificate.' - ) - } - Write-Error @ErrorParams - } + $Cert = Get-CSCertificate -Type $CSContent.Type -Thumbprint $CSContent.Thumbprint if (Get-Member -InputObject $CSContent -Name $CredentialName -Membertype Properties) { $RSAKey = Get-RandomAESKey diff --git a/src/Store/New-CredentialStore.ps1 b/src/Store/New-CredentialStore.ps1 index 8f8963a..d3b462e 100644 --- a/src/Store/New-CredentialStore.ps1 +++ b/src/Store/New-CredentialStore.ps1 @@ -141,7 +141,7 @@ function New-CredentialStore { OrganizationalUnitName = $PSCmdlet.ParameterSetName CommonName = 'PSCredentialStore' } - $CRTAttribute = New-CRTAttribute @CRTParams + $CRTAttribute = New-CSCertAttribute @CRTParams # If we are working with a ne shared store we have to create the location first. # Otherwise openssl fails with unknown path @@ -171,7 +171,7 @@ function New-CredentialStore { } try { - New-PfxCertificate @PfxParams + New-CSCertificate @PfxParams } catch { $_.Exception.Message | Write-Error -- 2.40.1 From 01e8a2f263cf4b662200fb97027af20cec7f2b9a Mon Sep 17 00:00:00 2001 From: OCram85 Date: Fri, 5 Apr 2019 11:29:43 +0200 Subject: [PATCH 05/31] fix pester tests --- tests/Store/02_New-CredentialStore.Tests.ps1 | 4 ++-- tests/Store/03_Get-CredentialStore.Tests.ps1 | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/Store/02_New-CredentialStore.Tests.ps1 b/tests/Store/02_New-CredentialStore.Tests.ps1 index a02caa6..ec58d99 100644 --- a/tests/Store/02_New-CredentialStore.Tests.ps1 +++ b/tests/Store/02_New-CredentialStore.Tests.ps1 @@ -80,7 +80,7 @@ Describe "New-CredentialStore" { $CS = Get-CredentialStore $CS.PfxCertificate | Should -Be $null $CS.Thumbprint | Should -Not -Be $null - $res = Test-CSCertificate -Thumbprint $CS.Thumbprint -StoreName My -StoreLocation CurrentUser + $res = Test-CSCertificate -Type Private #Write-Verbose -Message ('res: {0}' -f $res) -Verbose $res | Should -Be $true @@ -90,7 +90,7 @@ Describe "New-CredentialStore" { $CS = Get-CredentialStore -Shared $CS.PfxCertificate | Should -Be $null $CS.Thumbprint | Should -Not -Be $null - $res = Test-CSCertificate -Thumbprint $CS.Thumbprint -StoreName My -StoreLocation LocalMachine + $res = Test-CSCertificate -Type Shared #Write-Verbose -Message ('res: {0}' -f $res) -Verbose $res | Should -Be $true } diff --git a/tests/Store/03_Get-CredentialStore.Tests.ps1 b/tests/Store/03_Get-CredentialStore.Tests.ps1 index a8eabeb..0bf63aa 100644 --- a/tests/Store/03_Get-CredentialStore.Tests.ps1 +++ b/tests/Store/03_Get-CredentialStore.Tests.ps1 @@ -13,11 +13,11 @@ Describe "Get-CredentialStore" { { Get-CredentialStore } | Should -Not -Throw } It "Test2: Read Credential Store with testing data" { - { Use-PfxCertificate -Shared -CredentialStore $TestCredentialStore -Path $TestPfxCert } | Should -Not -Throw + { Use-CSCertificate -Shared -CredentialStore $TestCredentialStore -Path $TestPfxCert } | Should -Not -Throw { Get-CredentialStore -Shared -Path $TestCredentialStore } | Should -Not -Throw } It "Test3: Not existing path should return false" { - { Get-CredentialStore -Shared -Path './CredentialStore.json' }| Should -Throw "Could not find the CredentialStore." + { Get-CredentialStore -Shared -Path './CredentialStore.json' } | Should -Throw "Could not find the CredentialStore." } } Context "Testing invalid json data" { -- 2.40.1 From 16435095e10045c6796171ffd5d63740e5f024cb Mon Sep 17 00:00:00 2001 From: OCram85 Date: Fri, 5 Apr 2019 12:06:18 +0200 Subject: [PATCH 06/31] [wip] --- src/Certificate/Import-CSPfxCertificate.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Certificate/Import-CSPfxCertificate.ps1 b/src/Certificate/Import-CSPfxCertificate.ps1 index 464c419..0db05e6 100644 --- a/src/Certificate/Import-CSPfxCertificate.ps1 +++ b/src/Certificate/Import-CSPfxCertificate.ps1 @@ -88,7 +88,7 @@ function Import-CSPfxCertificate { ) ) - if (Test-CSCertificate -Thumbprint $cert.Thumbprint) { + if (Test-CSPfxCertificate -Thumbprint $cert.Thumbprint) { Write-Warning -Message ('The certificate with thumbprint {0} is already present!' -f $cert.Thumbprint) } else { -- 2.40.1 From 43f1b43423cb7f87356ddb1d3b66efc2ffd96501 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Fri, 5 Apr 2019 12:38:26 +0200 Subject: [PATCH 07/31] fix var name ref --- src/Certificate/Test-CSCertificate.ps1 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Certificate/Test-CSCertificate.ps1 b/src/Certificate/Test-CSCertificate.ps1 index 3bee1f0..16f1862 100644 --- a/src/Certificate/Test-CSCertificate.ps1 +++ b/src/Certificate/Test-CSCertificate.ps1 @@ -48,19 +48,19 @@ function Test-CSCertificate { } process { if ($Type -eq 'Private') { - $cert = Get-CSPfXCertificate -Thumbprint $Thumbprint -StoreName 'My' -StoreLocation 'CurrentUser' + $cert = Get-CSPfXCertificate -Thumbprint $CS.Thumbprint -StoreName 'My' -StoreLocation 'CurrentUser' } elseif ($Type -eq 'Shared') { if ( $isLinux) { - $cert = Get-CSPfxCertificate -Thumbprint $Thumbprint -StoreName 'My' -StoreLocation 'CurrentUser' + $cert = Get-CSPfxCertificate -Thumbprint $CS.Thumbprint -StoreName 'My' -StoreLocation 'CurrentUser' if ($null -eq $cert) { - $cert = Get-CSPfxCertificate -Thumbprint $Thumbprint -StoreName 'Root' -StoreLocation 'LocalMachine' + $cert = Get-CSPfxCertificate -Thumbprint $CS.Thumbprint -StoreName 'Root' -StoreLocation 'LocalMachine' } } elseif ( (! $isLinux) -or ($isWindows) ) { - $cert = Get-CSPfxCertificate -Thumbprint $Thumbprint -StoreName 'My' -StoreLocation 'LocalMachine' + $cert = Get-CSPfxCertificate -Thumbprint $CS.Thumbprint -StoreName 'My' -StoreLocation 'LocalMachine' if ($null -eq $cert) { - $cert = Get-CSPfxCertificate -Thumbprint $Thumbprint -StoreName 'Root' -StoreLocation 'LocalMachine' + $cert = Get-CSPfxCertificate -Thumbprint $CS.Thumbprint -StoreName 'Root' -StoreLocation 'LocalMachine' } } } -- 2.40.1 From 30b49ff767c9ac1ef147228e211e88391d802dc0 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Fri, 5 Apr 2019 12:44:18 +0200 Subject: [PATCH 08/31] fix exports --- src/PSCredentialStore.psd1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PSCredentialStore.psd1 b/src/PSCredentialStore.psd1 index 147038a..30308f1 100644 --- a/src/PSCredentialStore.psd1 +++ b/src/PSCredentialStore.psd1 @@ -71,7 +71,7 @@ 'New-CSCertificate', 'Test-CSCertificate', 'Test-CSPfxCertificate', - 'Use-PfxCertificate', + 'Use-CSCertificate', # Connection 'Connect-To', 'Disconnect-From', -- 2.40.1 From b760b65f633ee53764b8186efe88709684878392 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Fri, 5 Apr 2019 12:51:45 +0200 Subject: [PATCH 09/31] fix cert store location for windows shared mode --- src/Certificate/Import-CSCertificate.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Certificate/Import-CSCertificate.ps1 b/src/Certificate/Import-CSCertificate.ps1 index 9d0fcb0..af302d7 100644 --- a/src/Certificate/Import-CSCertificate.ps1 +++ b/src/Certificate/Import-CSCertificate.ps1 @@ -57,10 +57,10 @@ function Import-CSCertificate { Import-CSPfxCertificate -Path $Path -StoreName 'My' -StoreLocation 'CurrentUser' -OpenFlags 'ReadWrite' } elseif ( (! $isLinux ) -and ($Type -eq 'Shared') ) { - Import-CSPfxCertificate -Path $Path -StoreName 'My' -StoreLocation 'CurrentUser' -OpenFlags 'ReadWrite' + Import-CSPfxCertificate -Path $Path -StoreName 'My' -StoreLocation 'LocalMachine' -OpenFlags 'ReadWrite' } elseif ( ($isLinux) -and ($Type -eq 'Shared') ) { - Import-CSPfxCertificate -Path $Path -StoreName 'My' -StoreLocation 'LocalMachine' -OpenFlags 'ReadWrite' + Import-CSPfxCertificate -Path $Path -StoreName 'My' -StoreLocation 'CurrentUser' -OpenFlags 'ReadWrite' } } end { -- 2.40.1 From 34ac71f7ce8989d6c2f7e7255a8191d7c3b03482 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Fri, 5 Apr 2019 12:54:39 +0200 Subject: [PATCH 10/31] fix mandatory params --- src/Certificate/Use-CSCertificate.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Certificate/Use-CSCertificate.ps1 b/src/Certificate/Use-CSCertificate.ps1 index 4298bf7..a11577d 100644 --- a/src/Certificate/Use-CSCertificate.ps1 +++ b/src/Certificate/Use-CSCertificate.ps1 @@ -42,8 +42,8 @@ function Use-CSCertificate { [Parameter(Mandatory = $true, ParameterSetName = "Shared")] [switch]$Shared, - [Parameter(Mandatory = $true, ParameterSetName = "Private")] - [Parameter(Mandatory = $true, ParameterSetName = "Shared")] + [Parameter(Mandatory = $false, ParameterSetName = "Private")] + [Parameter(Mandatory = $false, ParameterSetName = "Shared")] [Switch]$UseCertStore ) begin { } -- 2.40.1 From bd32f4719f74ad0dd8e13f232f9f8b54653a1cd8 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Fri, 5 Apr 2019 13:07:50 +0200 Subject: [PATCH 11/31] fix accidentially removed code block --- src/Item/Get-CredentialStoreItem.ps1 | 7 ++++++- src/Item/New-CredentialStoreItem.ps1 | 7 ++++++- src/Item/Set-CredentialStoreItem.ps1 | 7 ++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/Item/Get-CredentialStoreItem.ps1 b/src/Item/Get-CredentialStoreItem.ps1 index 5f529fa..12f06eb 100644 --- a/src/Item/Get-CredentialStoreItem.ps1 +++ b/src/Item/Get-CredentialStoreItem.ps1 @@ -87,7 +87,12 @@ function Get-CredentialStoreItem { $CSMembers = Get-Member -InputObject $CS # Let's first check if the given remote host exists as object property if (($CSMembers.MemberType -eq "NoteProperty") -and ($CSMembers.Name -contains $CredentialName)) { - $Cert = Get-CSCertificate -Type $CS.Type -Thumbprint $CS.Thumbprint + if ($null -eq $CS.PfxCertificate) { + $Cert = Get-CSCertificate -Type $CS.Type -Thumbprint $CS.Thumbprint + } + else { + $Cert = Get-PfxCertificate -FilePath $CS.PfxCertificate -ErrorAction Stop + } $DecryptedKey = $Cert.PrivateKey.Decrypt( [Convert]::FromBase64String($CS.$CredentialName.EncryptedKey), [System.Security.Cryptography.RSAEncryptionPadding]::Pkcs1 diff --git a/src/Item/New-CredentialStoreItem.ps1 b/src/Item/New-CredentialStoreItem.ps1 index a52c1b9..6659302 100644 --- a/src/Item/New-CredentialStoreItem.ps1 +++ b/src/Item/New-CredentialStoreItem.ps1 @@ -116,7 +116,12 @@ function New-CredentialStoreItem { } if ($Credential.UserName) { - $Cert = Get-CSCertificate -Type $CSContent.Type -Thumbprint $CSContent.Thumbprint + if ($null -eq $CSContent.PfxCertificate) { + $Cert = Get-CSCertificate -Type $CSContent.Type -Thumbprint $CSContent.Thumbprint + } + else { + $Cert = Get-PfxCertificate -FilePath $CSContent.PfxCertificate -ErrorAction Stop + } if (Get-Member -InputObject $CSContent -Name $CredentialName -Membertype Properties) { $MessageParams = @{ diff --git a/src/Item/Set-CredentialStoreItem.ps1 b/src/Item/Set-CredentialStoreItem.ps1 index 7df7845..738b9fb 100644 --- a/src/Item/Set-CredentialStoreItem.ps1 +++ b/src/Item/Set-CredentialStoreItem.ps1 @@ -102,7 +102,12 @@ function Set-CredentialStoreItem { } if ($Credential.UserName) { - $Cert = Get-CSCertificate -Type $CSContent.Type -Thumbprint $CSContent.Thumbprint + if ($null -eq $CSContent.PfxCertificate) { + $Cert = Get-CSCertificate -Type $CSContent.Type -Thumbprint $CSContent.Thumbprint + } + else { + $Cert = Get-PfxCertificate -FilePath $CSContent.PfxCertificate -ErrorAction Stop + } if (Get-Member -InputObject $CSContent -Name $CredentialName -Membertype Properties) { $RSAKey = Get-RandomAESKey -- 2.40.1 From 9d6fdea9d26f10a6930c457f9d5401c66adaceef Mon Sep 17 00:00:00 2001 From: OCram85 Date: Fri, 5 Apr 2019 13:31:30 +0200 Subject: [PATCH 12/31] add basic cert pester pests --- .../Certificate/01_New-CSCertAttribute.Tests.ps1 | 7 +++++++ tests/Certificate/02_New-CSCertificate.Tests.ps1 | 15 +++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 tests/Certificate/01_New-CSCertAttribute.Tests.ps1 create mode 100644 tests/Certificate/02_New-CSCertificate.Tests.ps1 diff --git a/tests/Certificate/01_New-CSCertAttribute.Tests.ps1 b/tests/Certificate/01_New-CSCertAttribute.Tests.ps1 new file mode 100644 index 0000000..e6f5cb4 --- /dev/null +++ b/tests/Certificate/01_New-CSCertAttribute.Tests.ps1 @@ -0,0 +1,7 @@ +Describe "New-CSCertAttribute" { + Context "Basis Tests" { + It "Test1: Should not throw " { + { New-CSCertAttribute -Country 'DE' -State 'BW' -City 'KA' -Organization 'IT' -OrganizationalUnitName'' -CommonName 'Mycert' } | Should -Not -Throw + } + } +} diff --git a/tests/Certificate/02_New-CSCertificate.Tests.ps1 b/tests/Certificate/02_New-CSCertificate.Tests.ps1 new file mode 100644 index 0000000..aac7f74 --- /dev/null +++ b/tests/Certificate/02_New-CSCertificate.Tests.ps1 @@ -0,0 +1,15 @@ +Describe "New-CSCertificate" { + Context "Basic Tests" { + It "Test1: Should not throw" { + + $attribs = New-CSCertAttribute -Country 'DE' -State 'BW' -City 'KA' -Organization 'IT' -OrganizationalUnitName'' -CommonName 'Mycert' + + $CertAttribs = @{ + CRTAttribute = $attribs + KeyName = Join-Path -Path (Get-TempDir) -ChildPath '/foo.key' + CertName = Join-Path -Path (Get-TempDir) -ChildPath '/cert.pfx' + } + { New-CSCertificate @CertAttribs } | Should -Not -Throw + } + } +} -- 2.40.1 From b12d9ae063041d4ee8277ce96080a1034ed1ef96 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Mon, 8 Apr 2019 12:37:18 +0200 Subject: [PATCH 13/31] remove old docs --- docs/Connect-To.md | 188 ----------------------------- docs/Disconnect-From.md | 132 -------------------- docs/Get-CredentialStore.md | 94 --------------- docs/Get-CredentialStoreItem.md | 124 ------------------- docs/New-CredentialStore.md | 124 ------------------- docs/New-CredentialStoreItem.md | 142 ---------------------- docs/PSCredentialStore.md | 46 ------- docs/Remove-CredentialStoreItem.md | 125 ------------------- docs/Set-CredentialStoreItem.md | 141 ---------------------- docs/Test-CSConnection.md | 82 ------------- docs/Test-CredentialStore.md | 90 -------------- docs/Test-CredentialStoreItem.md | 133 -------------------- docs/about_PSCredentialStore.md | 102 ---------------- 13 files changed, 1523 deletions(-) delete mode 100644 docs/Connect-To.md delete mode 100644 docs/Disconnect-From.md delete mode 100644 docs/Get-CredentialStore.md delete mode 100644 docs/Get-CredentialStoreItem.md delete mode 100644 docs/New-CredentialStore.md delete mode 100644 docs/New-CredentialStoreItem.md delete mode 100644 docs/PSCredentialStore.md delete mode 100644 docs/Remove-CredentialStoreItem.md delete mode 100644 docs/Set-CredentialStoreItem.md delete mode 100644 docs/Test-CSConnection.md delete mode 100644 docs/Test-CredentialStore.md delete mode 100644 docs/Test-CredentialStoreItem.md delete mode 100644 docs/about_PSCredentialStore.md diff --git a/docs/Connect-To.md b/docs/Connect-To.md deleted file mode 100644 index 96c0a5a..0000000 --- a/docs/Connect-To.md +++ /dev/null @@ -1,188 +0,0 @@ ---- -external help file: PSCredentialStore-help.xml -Module Name: PSCredentialStore -online version: https://github.com/OCram85/PSCredentialStore -schema: 2.0.0 ---- - -# Connect-To - -## SYNOPSIS -Connects to the given host using the stored CredentialStoreItem. - -## SYNTAX - -### Private (Default) -``` -Connect-To -RemoteHost [-Identifier ] -Type [-Credentials ] - [] -``` - -### Shared -``` -Connect-To -RemoteHost [-Identifier ] -Type [-Credentials ] - [-Path ] [-Shared] [] -``` - -## DESCRIPTION -Establish a connection to the selected host using a stored CredentialStoreItem. - -## EXAMPLES - -### EXAMPLE 1 -``` -Connect-To -RemoteHost "ucs.myside.local" -Type CiscoUcs -``` - -### EXAMPLE 2 -``` -Connect-To -RemoteHost "ftp.myside.local" -Type FTP -``` - -### EXAMPLE 3 -``` -Connect-To -RemoteHost "fas.myside.local" -Type NetAppFAS -``` - -### EXAMPLE 4 -``` -Connect-To -RemoteHost "esx01.myside.local" -Type VMware -``` - -### EXAMPLE 5 -``` -Connect-To -RemoteHost "vCenter.myside.local" -Type CisServer -``` - -### EXAMPLE 6 -``` -Connect-To -RemoteHost "exchange01.myside.local" -Type ExchangeHTTP -``` - -### EXAMPLE 7 -``` -Connect-To -RemoteHost "exchange01.myside.local" -Type ExchangeHTTPS -``` - -## PARAMETERS - -### -Credentials -Use this parameter to bypass the stored credentials. -Without this parameter Connect-To tries to read the -needed credentials from the CredentialStore. -If you provide this parameter you skip this lookup behavior. -So you can use it to enable credentials without preparing any user interaction. - -```yaml -Type: PSCredential -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -Identifier -Defaults to "". -Specify a string, which separates two CredentialStoreItems for the -same hostname. - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -Path -Define a custom path to a shared CredentialStore. - -```yaml -Type: String -Parameter Sets: Shared -Aliases: - -Required: False -Position: Named -Default value: "{0}\PSCredentialStore\CredentialStore.json" -f $env:ProgramData -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -RemoteHost -Specify the host, for which you would like to change the credentials. - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: True -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -Shared -Switch to shared mode with this param. -This enforces the command to work with a shared CredentialStore which -can be decrypted across systems. - -```yaml -Type: SwitchParameter -Parameter Sets: Shared -Aliases: - -Required: False -Position: Named -Default value: False -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -Type -Specify the host type of the target. -Currently implemented targets are: Possible connection values are: -CiscoUcs, FTP, NetAppFAS, VMware, CisServer, ExchangeHTTP, ExchangeHTTPS, SCP. - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: True -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### [None] - -## OUTPUTS - -### [None] - -## NOTES -File Name : Connect-To.ps1 -Author : Marco Blessing - marco.blessing@googlemail.com -Requires : - -## RELATED LINKS - -[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore) - diff --git a/docs/Disconnect-From.md b/docs/Disconnect-From.md deleted file mode 100644 index 9d2d322..0000000 --- a/docs/Disconnect-From.md +++ /dev/null @@ -1,132 +0,0 @@ ---- -external help file: PSCredentialStore-help.xml -Module Name: PSCredentialStore -online version: https://github.com/OCram85/PSCredentialStore -schema: 2.0.0 ---- - -# Disconnect-From - -## SYNOPSIS -Terminates a session established with Connect-To using a CredentialStoreItem. - -## SYNTAX - -``` -Disconnect-From [-RemoteHost] [-Type] [-Force] [] -``` - -## DESCRIPTION -Terminates a session established with Connect-To using a CredentialStoreItem. - -## EXAMPLES - -### EXAMPLE 1 -``` -Disconnect-From -RemoteHost "ucs.myside.local" -Type CiscoUcs -``` - -### EXAMPLE 2 -``` -Disconnect-From -RemoteHost "ftp.myside.local" -Type FTP -``` - -### EXAMPLE 3 -``` -Disconnect-From -RemoteHost "fas.myside.local" -Type NetAppFAS -``` - -### EXAMPLE 4 -``` -Disconnect-From -RemoteHost "esx01.myside.local" -Type VMware -``` - -### EXAMPLE 5 -``` -Disconnect-From -RemoteHost "esx01.myside.local" -Type VMware -Force:$True -``` - -### EXAMPLE 6 -``` -Disconnect-From -RemoteHost "vcenter.myside.local" -Type CisServer -``` - -### EXAMPLE 7 -``` -Disconnect-From -RemoteHost "exchange01.myside.local" -Type ExchangeHTTP -``` - -### EXAMPLE 8 -``` -Disconnect-From -RemoteHost "exchange01.myside.local" -Type ExchangeHTTPS -``` - -## PARAMETERS - -### -Force -Force the disconnect, even if the disconnect would fail. - -```yaml -Type: SwitchParameter -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: False -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -RemoteHost -Specify the remote endpoint, whose session you would like to terminate. - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: True -Position: 1 -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -Type -Specify the host type of the target. -Currently implemented targets are: CiscoUcs, FTP, NetAppFAS, VMware, -CisServer, ExchangeHTTP, ExchangeHTTPS, SCP. - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: True -Position: 2 -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### [None] - -## OUTPUTS - -### [None] - -## NOTES -File Name : Disconnect-From.ps1 -Author : Marco Blessing - marco.blessing@googlemail.com -Requires : - -## RELATED LINKS - -[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore) - diff --git a/docs/Get-CredentialStore.md b/docs/Get-CredentialStore.md deleted file mode 100644 index 718c9af..0000000 --- a/docs/Get-CredentialStore.md +++ /dev/null @@ -1,94 +0,0 @@ ---- -external help file: PSCredentialStore-help.xml -Module Name: PSCredentialStore -online version: https://github.com/OCram85/PSCredentialStore -schema: 2.0.0 ---- - -# Get-CredentialStore - -## SYNOPSIS -Reads the complete content of the credential store and returns it as a new object. - -## SYNTAX - -### Private (Default) -``` -Get-CredentialStore [] -``` - -### Shared -``` -Get-CredentialStore [-Path ] [-Shared] [] -``` - -## DESCRIPTION -The content is in a raw format. -It means there is no transformation to the different credential types. -You can not use the object properties to connect with remote host. -Therefore please use -Get-CredentialStoreItem. - -## EXAMPLES - -### EXAMPLE 1 -``` -$CSContent = Get-CredentialStore -Path "C:\TMP\mystore.json" -``` - -## PARAMETERS - -### -Path -Define a custom path to a shared CredentialStore. - -```yaml -Type: String -Parameter Sets: Shared -Aliases: - -Required: False -Position: Named -Default value: "{0}\PSCredentialStore\CredentialStore.json" -f $env:ProgramData -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -Shared -Switch to shared mode with this param. -This enforces the command to work with a shared CredentialStore which -can be decrypted across systems. - -```yaml -Type: SwitchParameter -Parameter Sets: Shared -Aliases: - -Required: True -Position: Named -Default value: False -Accept pipeline input: False -Accept wildcard characters: False -``` - -### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### [None] - -## OUTPUTS - -### [PSObject] Returns the credential store content as PSObject. - -## NOTES -\`\`\` -File Name : Get-CredentialStore.ps1 -Author : Marco Blessing - marco.blessing@googlemail.com -Requires : -\`\`\` - -## RELATED LINKS - -[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore) - diff --git a/docs/Get-CredentialStoreItem.md b/docs/Get-CredentialStoreItem.md deleted file mode 100644 index eba717e..0000000 --- a/docs/Get-CredentialStoreItem.md +++ /dev/null @@ -1,124 +0,0 @@ ---- -external help file: PSCredentialStore-help.xml -Module Name: PSCredentialStore -online version: https://github.com/OCram85/PSCredentialStore -schema: 2.0.0 ---- - -# Get-CredentialStoreItem - -## SYNOPSIS -Returns the Credential from a given remote host item. - -## SYNTAX - -### Private (Default) -``` -Get-CredentialStoreItem -RemoteHost [-Identifier ] [] -``` - -### Shared -``` -Get-CredentialStoreItem -RemoteHost [-Identifier ] [-Shared] [-Path ] - [] -``` - -## DESCRIPTION -Return the credential as PSCredential object. - -## EXAMPLES - -### EXAMPLE 1 -``` -$myCreds = Get-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.local" -``` - -## PARAMETERS - -### -Identifier -Provide a custom identifier to the given remote host key. -This enables you to store multiple credentials -for a single remote host entry. -For example ad/sys1, ftp/sys1, mssql/sys1 - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -Path -Define a custom path to a shared CredentialStore. - -```yaml -Type: String -Parameter Sets: Shared -Aliases: - -Required: False -Position: Named -Default value: "{0}\PSCredentialStore\CredentialStore.json" -f $env:ProgramData -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -RemoteHost -Specify the host, for which you would like to change the credentials. - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: True -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -Shared -Switch to shared mode with this param. -This enforces the command to work with a shared CredentialStore which -can be decrypted across systems. - -```yaml -Type: SwitchParameter -Parameter Sets: Shared -Aliases: - -Required: True -Position: Named -Default value: False -Accept pipeline input: False -Accept wildcard characters: False -``` - -### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### [None] - -## OUTPUTS - -### [System.Management.Automation.PSCredential] - -## NOTES -\`\`\` -File Name : Get-CredentialStoreItem.ps1 -Author : Marco Blessing - marco.blessing@googlemail.com -Requires : -\`\`\` - -## RELATED LINKS - -[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore) - diff --git a/docs/New-CredentialStore.md b/docs/New-CredentialStore.md deleted file mode 100644 index eba717e..0000000 --- a/docs/New-CredentialStore.md +++ /dev/null @@ -1,124 +0,0 @@ ---- -external help file: PSCredentialStore-help.xml -Module Name: PSCredentialStore -online version: https://github.com/OCram85/PSCredentialStore -schema: 2.0.0 ---- - -# Get-CredentialStoreItem - -## SYNOPSIS -Returns the Credential from a given remote host item. - -## SYNTAX - -### Private (Default) -``` -Get-CredentialStoreItem -RemoteHost [-Identifier ] [] -``` - -### Shared -``` -Get-CredentialStoreItem -RemoteHost [-Identifier ] [-Shared] [-Path ] - [] -``` - -## DESCRIPTION -Return the credential as PSCredential object. - -## EXAMPLES - -### EXAMPLE 1 -``` -$myCreds = Get-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.local" -``` - -## PARAMETERS - -### -Identifier -Provide a custom identifier to the given remote host key. -This enables you to store multiple credentials -for a single remote host entry. -For example ad/sys1, ftp/sys1, mssql/sys1 - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -Path -Define a custom path to a shared CredentialStore. - -```yaml -Type: String -Parameter Sets: Shared -Aliases: - -Required: False -Position: Named -Default value: "{0}\PSCredentialStore\CredentialStore.json" -f $env:ProgramData -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -RemoteHost -Specify the host, for which you would like to change the credentials. - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: True -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -Shared -Switch to shared mode with this param. -This enforces the command to work with a shared CredentialStore which -can be decrypted across systems. - -```yaml -Type: SwitchParameter -Parameter Sets: Shared -Aliases: - -Required: True -Position: Named -Default value: False -Accept pipeline input: False -Accept wildcard characters: False -``` - -### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### [None] - -## OUTPUTS - -### [System.Management.Automation.PSCredential] - -## NOTES -\`\`\` -File Name : Get-CredentialStoreItem.ps1 -Author : Marco Blessing - marco.blessing@googlemail.com -Requires : -\`\`\` - -## RELATED LINKS - -[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore) - diff --git a/docs/New-CredentialStoreItem.md b/docs/New-CredentialStoreItem.md deleted file mode 100644 index 6b00dd3..0000000 --- a/docs/New-CredentialStoreItem.md +++ /dev/null @@ -1,142 +0,0 @@ ---- -external help file: PSCredentialStore-help.xml -Module Name: PSCredentialStore -online version: https://github.com/OCram85/PSCredentialStore -schema: 2.0.0 ---- - -# New-CredentialStoreItem - -## SYNOPSIS -Adds a credential store item containing host, user and password to the given store. - -## SYNTAX - -### Private (Default) -``` -New-CredentialStoreItem -RemoteHost [-Identifier ] [-Credential ] - [] -``` - -### Shared -``` -New-CredentialStoreItem -RemoteHost [-Identifier ] [-Credential ] [-Shared] - [-Path ] [] -``` - -## DESCRIPTION -The credentials are stored without any relations to it's further use. -If you need to change an existing -item please use Set-CredentialStoreItem. -You need to decide afterwards, whether to use the credential for -a VIConnection, NetApp FAS or UCS Fabric Interconnect. - -## EXAMPLES - -### EXAMPLE 1 -``` -New-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.local" -``` - -## PARAMETERS - -### -Credential -You can provide credentials optionally as pre existing pscredential object. - -```yaml -Type: PSCredential -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByValue) -Accept wildcard characters: False -``` - -### -Identifier -Provide a custom identifier to the given remote host key. -This enables you to store multiple credentials -for a single remote host entry. -For example ad/sys1, ftp/sys1, mssql/sys1 - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -Path -Define the store in which you would like to add a new item. - -```yaml -Type: String -Parameter Sets: Shared -Aliases: - -Required: False -Position: Named -Default value: "{0}\PSCredentialStore\CredentialStore.json" -f $env:ProgramData -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -RemoteHost -The identifier or rather name for the given credentials. - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: True -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -Shared -{{Fill Shared Description}} - -```yaml -Type: SwitchParameter -Parameter Sets: Shared -Aliases: - -Required: True -Position: Named -Default value: False -Accept pipeline input: False -Accept wildcard characters: False -``` - -### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### [None] - -## OUTPUTS - -### [None] - -## NOTES -\`\`\` -File Name : New-CredentialStoreItem.ps1 -Author : Marco Blessing - marco.blessing@googlemail.com -Requires : -\`\`\` - -## RELATED LINKS - -[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore) - diff --git a/docs/PSCredentialStore.md b/docs/PSCredentialStore.md deleted file mode 100644 index 6b840c0..0000000 --- a/docs/PSCredentialStore.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -Module Name: PSCredentialStore -Module Guid: 6800e192-9df8-4e30-b253-eb2c799bbe84 -Download Help Link: {{Please enter FwLink manually}} -Help Version: {{Please enter version of help manually (X.X.X.X) format}} -Locale: en-US ---- - -# PSCredentialStore Module -## Description -{{Manually Enter Description Here}} - -## PSCredentialStore Cmdlets -### [Connect-To](Connect-To.md) -Connects to the given host using the stored CredentialStoreItem. - -### [Disconnect-From](Disconnect-From.md) -Terminates a session established with Connect-To using a CredentialStoreItem. - -### [Get-CredentialStore](Get-CredentialStore.md) -Reads the complete content of the credential store and returns it as a new object. - -### [Get-CredentialStoreItem](Get-CredentialStoreItem.md) -Returns the Credential from a given remote host item. - -### [Get-CredentialStoreItem](Get-CredentialStoreItem.md) -Returns the Credential from a given remote host item. - -### [New-CredentialStoreItem](New-CredentialStoreItem.md) -Adds a credential store item containing host, user and password to the given store. - -### [Remove-CredentialStoreItem](Remove-CredentialStoreItem.md) -Remove the given credentials from the credential store. - -### [Set-CredentialStoreItem](Set-CredentialStoreItem.md) -Changes the credentials for the given remote host in the store. - -### [Test-CredentialStore](Test-CredentialStore.md) -Returns the credential store state. - -### [Test-CredentialStoreItem](Test-CredentialStoreItem.md) -Checks if the given RemoteHost identifier combination exists in the credential store. - -### [Test-CSConnection](Test-CSConnection.md) -Returns the connection state of a given type to the remote host. - diff --git a/docs/Remove-CredentialStoreItem.md b/docs/Remove-CredentialStoreItem.md deleted file mode 100644 index 2fa9bfa..0000000 --- a/docs/Remove-CredentialStoreItem.md +++ /dev/null @@ -1,125 +0,0 @@ ---- -external help file: PSCredentialStore-help.xml -Module Name: PSCredentialStore -online version: https://github.com/OCram85/PSCredentialStore -schema: 2.0.0 ---- - -# Remove-CredentialStoreItem - -## SYNOPSIS -Remove the given credentials from the credential store. - -## SYNTAX - -### Private (Default) -``` -Remove-CredentialStoreItem -RemoteHost [-Identifier ] [] -``` - -### Shared -``` -Remove-CredentialStoreItem -RemoteHost [-Identifier ] [-Shared] [-Path ] - [] -``` - -## DESCRIPTION -Use this CMDLet to completely remove an credential store item. - -## EXAMPLES - -### EXAMPLE 1 -``` -Remove-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.local" -``` - -Remove-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.local" -Identifier svc - -## PARAMETERS - -### -Identifier -Defaults to "". -Specify a string, which separates two CredentialStoreItems for the -same hostname. - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -Path -Define the store in which your given host entry already exists. - -```yaml -Type: String -Parameter Sets: Shared -Aliases: - -Required: False -Position: Named -Default value: "{0}\PSCredentialStore\CredentialStore.json" -f $env:ProgramData -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -RemoteHost -Specify the host you for which you would like to change the credentials. - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: True -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -Shared -Switch to shared mode with this param. -This enforces the command to work with a shared CredentialStore which -can be decrypted across systems. - -```yaml -Type: SwitchParameter -Parameter Sets: Shared -Aliases: - -Required: True -Position: Named -Default value: False -Accept pipeline input: False -Accept wildcard characters: False -``` - -### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### [None] - -## OUTPUTS - -### [None] - -## NOTES -\`\`\` -File Name : Remove-CredentialStoreItem.ps1 -Author : Marco Blessing - marco.blessing@googlemail.com -Requires : -\`\`\` - -## RELATED LINKS - -[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore) - diff --git a/docs/Set-CredentialStoreItem.md b/docs/Set-CredentialStoreItem.md deleted file mode 100644 index da6d71e..0000000 --- a/docs/Set-CredentialStoreItem.md +++ /dev/null @@ -1,141 +0,0 @@ ---- -external help file: PSCredentialStore-help.xml -Module Name: PSCredentialStore -online version: https://github.com/OCram85/PSCredentialStore -schema: 2.0.0 ---- - -# Set-CredentialStoreItem - -## SYNOPSIS -Changes the credentials for the given remote host in the store. - -## SYNTAX - -### Private (Default) -``` -Set-CredentialStoreItem -RemoteHost [-Identifier ] [-Credential ] - [] -``` - -### Shared -``` -Set-CredentialStoreItem -RemoteHost [-Identifier ] [-Credential ] [-Shared] - [-Path ] [] -``` - -## DESCRIPTION -{{Fill in the Description}} - -## EXAMPLES - -### EXAMPLE 1 -``` -Set-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.local" -``` - -Set-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.local" -Identifier svc - -## PARAMETERS - -### -Credential -{{Fill Credential Description}} - -```yaml -Type: PSCredential -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: True (ByValue) -Accept wildcard characters: False -``` - -### -Identifier -Defaults to "". -Specify a string, which separates two CredentialStoreItems for the -same hostname. - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -Path -Define the store in which your given host entry already exists. - -```yaml -Type: String -Parameter Sets: Shared -Aliases: - -Required: False -Position: Named -Default value: "{0}\PSCredentialStore\CredentialStore.json" -f $env:ProgramData -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -RemoteHost -Specify the host you for which you would like to change the credentials. - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: True -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -Shared -Switch to shared mode with this param. -This enforces the command to work with a shared CredentialStore which -can be decrypted across systems. - -```yaml -Type: SwitchParameter -Parameter Sets: Shared -Aliases: - -Required: True -Position: Named -Default value: False -Accept pipeline input: False -Accept wildcard characters: False -``` - -### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### [None] - -## OUTPUTS - -### [None] - -## NOTES -\`\`\` -File Name : Set-CredentialStoreItem.ps1 -Author : Marco Blessing - marco.blessing@googlemail.com -Requires : -\`\`\` - -## RELATED LINKS - -[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore) - diff --git a/docs/Test-CSConnection.md b/docs/Test-CSConnection.md deleted file mode 100644 index da6e927..0000000 --- a/docs/Test-CSConnection.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -external help file: PSCredentialStore-help.xml -Module Name: PSCredentialStore -online version: https://github.com/OCram85/PSCredentialStore -schema: 2.0.0 ---- - -# Test-CSConnection - -## SYNOPSIS -Returns the connection state of a given type to the remote host. - -## SYNTAX - -``` -Test-CSConnection [-RemoteHost] [-Type] [] -``` - -## DESCRIPTION -Use this script to check a connection which was established with the \`Connect-To\` cmdlet. - -## EXAMPLES - -### EXAMPLE 1 -``` -.\Test-CMConnection -RemoteHost "r0-i01-vcr01.p0r.kivbf-cloud.net" -Type VMware -``` - -## PARAMETERS - -### -RemoteHost -Define the remote host you would like to check. - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: True -Position: 1 -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -Type -Define the connection type you would like to check. -See the \`Connect-To\` documentation -for valid type values. - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: True -Position: 2 -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### [None] - -## OUTPUTS - -### [Boolean] - -## NOTES -File Name : Test-CSConnection.ps1 -Author : Marco Blessing - marco.blessing@googlemail.com -Requires : - -## RELATED LINKS - -[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore) - diff --git a/docs/Test-CredentialStore.md b/docs/Test-CredentialStore.md deleted file mode 100644 index f3d1170..0000000 --- a/docs/Test-CredentialStore.md +++ /dev/null @@ -1,90 +0,0 @@ ---- -external help file: PSCredentialStore-help.xml -Module Name: PSCredentialStore -online version: https://github.com/OCram85/PSCredentialStore -schema: 2.0.0 ---- - -# Test-CredentialStore - -## SYNOPSIS -Returns the credential store state. - -## SYNTAX - -### Private (Default) -``` -Test-CredentialStore [] -``` - -### Shared -``` -Test-CredentialStore [-Path ] [-Shared] [] -``` - -## DESCRIPTION -Use this script to test your credential store. -For now it only checks if -the file exists. - -## EXAMPLES - -### Example 1 -```powershell -PS C:\> {{ Add example code here }} -``` - -{{ Add example description here }} - -## PARAMETERS - -### -Path -Define a custom path to a shared CredentialStore. - -```yaml -Type: String -Parameter Sets: Shared -Aliases: - -Required: False -Position: Named -Default value: "{0}\PSCredentialStore\CredentialStore.json" -f $env:ProgramData -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -Shared -Switch to shared mode with this param. -This enforces the command to work with a shared CredentialStore which -can be decrypted across systems. - -```yaml -Type: SwitchParameter -Parameter Sets: Shared -Aliases: - -Required: True -Position: Named -Default value: False -Accept pipeline input: False -Accept wildcard characters: False -``` - -### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -## OUTPUTS - -## NOTES -\`\`\` -File Name : Test-CredentialStore.ps1 -Author : Marco Blessing - marco.blessing@googlemail.com -Requires : -\`\`\` - -## RELATED LINKS - -[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore) - diff --git a/docs/Test-CredentialStoreItem.md b/docs/Test-CredentialStoreItem.md deleted file mode 100644 index abc9dff..0000000 --- a/docs/Test-CredentialStoreItem.md +++ /dev/null @@ -1,133 +0,0 @@ ---- -external help file: PSCredentialStore-help.xml -Module Name: PSCredentialStore -online version: https://github.com/OCram85/PSCredentialStore -schema: 2.0.0 ---- - -# Test-CredentialStoreItem - -## SYNOPSIS -Checks if the given RemoteHost identifier combination exists in the credential store. - -## SYNTAX - -### Private (Default) -``` -Test-CredentialStoreItem -RemoteHost [-Identifier ] [] -``` - -### Shared -``` -Test-CredentialStoreItem [-Path ] -RemoteHost [-Identifier ] [-Shared] - [] -``` - -## DESCRIPTION -Use this cmdlet for basic checks with a single item. -Check the item first with this function before -you try to interact with it. - -## EXAMPLES - -### EXAMPLE 1 -``` -If (Test-CredentialStoreItem -RemoteHost "Default") { -``` - -Get-CredentialStoreItem -RemoteHost "Default" -} -Else { - Write-Warning ("The given Remote Host {0} does not exist in the credential Store!" -f $RemoteHost) -} - -## PARAMETERS - -### -Identifier -Adds an optional identifier to the given RemoteHost. -Makes it possible to store multiple credentials -for a single host. - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -Path -Define a custom credential store you try to read from. -Without the \`-Path\` parameter -\`Test-CredentialStoreItem\` tries to read from the default private store. - -```yaml -Type: String -Parameter Sets: Shared -Aliases: - -Required: False -Position: Named -Default value: "{0}\PSCredentialStore\CredentialStore.json" -f $env:ProgramData -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -RemoteHost -Specify the host, for which you would like to change the credentials. - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: True -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -Shared -Switch to shared mode with this param. -This enforces the command to work with a shared CredentialStore which -can be decrypted across systems. - -```yaml -Type: SwitchParameter -Parameter Sets: Shared -Aliases: - -Required: False -Position: Named -Default value: False -Accept pipeline input: False -Accept wildcard characters: False -``` - -### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### [None] - -## OUTPUTS - -### [None] - -## NOTES -\`\`\` -File Name : Test-CredentialStoreItem.ps1 -Author : Marco Blessing - marco.blessing@googlemail.com -Requires : -\`\`\` - -## RELATED LINKS - -[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore) - diff --git a/docs/about_PSCredentialStore.md b/docs/about_PSCredentialStore.md deleted file mode 100644 index a4694ae..0000000 --- a/docs/about_PSCredentialStore.md +++ /dev/null @@ -1,102 +0,0 @@ -# PSCredentialStore -## about_PSCredentialStore - - -# SHORT DESCRIPTION -PSCredentialStore enables managing multiple PSCredential objects. - - -# LONG DESCRIPTION -The PSCredentialStore is an simple credential manager for PSCredentials. It stores multiple credential objects in a -simple json file. You can choose between a private and shared store. The private one exists in your profile and can -ony accessed by your account on the same machine. The shared store enables you to use different credentials for your -script without exposing them as plain text. - -**The shared store isn't 100% secure and I don't recommend using it in production!** - -PSCredentialStore was developed to simplify the delegation of complex powershell scripts. In this case you often -need to store credentials for non interactive usage like in scheduled tasks. - -To get started read the [about_PSCredentialStore](/src/en-US/about_PSCredential.help.txt) page. - - -## Installation - -## PowerShellGallery.com (Recommended Way) - -* Make sure you use PowerShell 4.0 or higher with `$PSVersionTable`. -* Use the builtin PackageManagement and install with: `Install-Module PSCredentialStore` -* Done. Start exploring the Module with `Import-Module PSCredentialStore ; Get-Command -Module PSCredentialStore` - -## Manual Way - -* Take a look at the [Latest Release](https://github.com/OCram85/PSCredentialStore/releases/latest) page. -* Download the `PSCredentialStore.zip`. -* Unpack the Zip and put it in your Powershell Module path. - * Don't forget to change the NTFS permission flag in the context menu. -* Start with `Import-Module PSCredentialStore` - -**1.** First we need a blank CredentialStore. You can decide between a *private* or *shared* store. The private -Credential Store can only be accessed with your profile on the machine you created it. -```powershell -# Private Credential Store -New-CredentialStore - -# Shared Credential Store -New-CredentialStore -Shared - -#Shared CredentialStore in custom Location -New-CredentialStore -Shared -Path 'C:\CredentialStore.json' -``` - -**2.** Now you can manage your CredentialStoreItems: -```powershell -# This will prompt for credentials and stores it in a private store -New-CredentialStoreItem -RemoteHost 'dc01.myside.local' -Identifier 'AD' - -# You can now use it in other scripts like this: -$DCCreds = Get-CredentialStoreItem -RemoteHost 'dc01.myside.local' -Identifier 'AD' -Invoke-Command -ComputerName 'dc01.myside.local' -Credential $DCCreds -ScripBlock {Get-Process} -``` - -The CredentialStore contains also a simple function to establish a connection with several systems or protocols. -If you have already installed the underlying framework your can connect to: - -* **CiscoUcs** - Establish a connection to a Cisco UCS fabric interconnect. - * Required Modules: [`Cisco.UCS.Core`, `Cisco.UCSManager`](https://software.cisco.com/download/release.html?i=!y&mdfid=286305108&softwareid=284574017&release=2.1.1) -* **FTP** - Establish a connection to a FTP host. - * Required Modules: [`WinSCP`](https://www.powershellgallery.com/packages/WinSCP) -* **NetAppFAS** - Establish a connection to a NetApp Clustered ONTAP filer. - * Required Modules: [`DataONTAP`](http://mysupport.netapp.com/tools/info/ECMLP2310788I.html?productID=61926) -* **VMware** - Establish a connection to a VMware vCenter or ESXi host. - * Required Modules: [`VMware.VimAutomation.Core`](https://www.powershellgallery.com/packages/VMware.PowerCLI) -* **CisServer** - Establish a connection to the CisServer Service on vCenter Host. - * Required Modules: [`VMware.VimAutomation.Cis.Core`](https://www.powershellgallery.com/packages/VMware.PowerCLI)) -* **ExchangeHTTP** - Establish a remote connection with an Exchange endpoint via http. - * Requires PowerShell remoting -* **ExchangeHTTPS** - Establish a remote connection with an Exchange endpoint via https. - * Requires PowerShell remoting -* **SCP** - Establish a SCP connection. - * Required Modules: [`WinSCP`](https://www.powershellgallery.com/packages/WinSCP) -# EXAMPLES - -```powershell -Connect-To -RemoteHost "ucs.myside.local" -Type CiscoUcs -Connect-To -RemoteHost "ftp.myside.local" -Type FTP -Connect-To -RemoteHost "fas.myside.local" -Type NetAppFAS -Connect-To -RemoteHost "esx01.myside.local" -Type VMware -Connect-To -RemoteHost "vcr.myside.local" -Type CisServer -``` -# NOTE - - -# TROUBLESHOOTING NOTE - - -# SEE ALSO - - -# KEYWORDS - -- Credential -- Store -- 2.40.1 From 752a1f3ff841bc8f7908016cfac52df66363b08d Mon Sep 17 00:00:00 2001 From: OCram85 Date: Mon, 8 Apr 2019 12:37:30 +0200 Subject: [PATCH 14/31] update cbh blocks --- src/Certificate/Get-CSCertificate.ps1 | 12 ++++++------ src/Certificate/Get-CSPfxCertificate.ps1 | 8 ++++---- src/Certificate/Import-CSCertificate.ps1 | 20 ++++++++++++-------- src/Certificate/Import-CSPfxCertificate.ps1 | 8 ++++---- src/Certificate/New-CSCertAttribute.ps1 | 12 ++++++------ src/Certificate/New-CSCertificate.ps1 | 6 +++--- src/Certificate/Test-CSCertificate.ps1 | 14 +++++++------- src/Certificate/Test-CSPfxCertificate.ps1 | 6 +++--- src/Certificate/Use-CSCertificate.ps1 | 15 ++++++++++++--- src/Item/Get-CredentialStoreItem.ps1 | 13 ++++++------- 10 files changed, 63 insertions(+), 51 deletions(-) diff --git a/src/Certificate/Get-CSCertificate.ps1 b/src/Certificate/Get-CSCertificate.ps1 index fdff236..5bb654b 100644 --- a/src/Certificate/Get-CSCertificate.ps1 +++ b/src/Certificate/Get-CSCertificate.ps1 @@ -1,16 +1,16 @@ function Get-CSCertificate { <# .SYNOPSIS - Returns the current used valid PfX Certificate. + Returns the current used valid PfX certificate. .DESCRIPTION - Use this function to get the available pfx certficate respecting the config hierarchy. + Use this function to get the available pfx certificate respecting the config hierarchy. .PARAMETER Type Select the current credential store type. .PARAMETER Thumbprint - Provice the crednetials thumbprint for the search. + Provide the credentials thumbprint for the search. .INPUTS [None] @@ -22,9 +22,9 @@ function Get-CSCertificate { Get-CSCertificate -Type 'Shared' -Thumbprint '12334456' .NOTES - File Name : Get-CSCertificate.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : + - File Name : Get-CSCertificate.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore diff --git a/src/Certificate/Get-CSPfxCertificate.ps1 b/src/Certificate/Get-CSPfxCertificate.ps1 index be1d0ef..9afe659 100644 --- a/src/Certificate/Get-CSPfxCertificate.ps1 +++ b/src/Certificate/Get-CSPfxCertificate.ps1 @@ -7,7 +7,7 @@ function Get-CSPfxCertificate { You can use this function to get a stored certificate. Search for the object by its unique thumbprint. .PARAMETER Thumbprint - Provide one or more thumprints. + Provide one or more thumbprints. .PARAMETER StoreName Select the store name in which you want to search the certificates. @@ -25,9 +25,9 @@ function Get-CSPfxCertificate { Get-CSPfxCertificate -Thumbprint '12345678' -StoreName 'My' -StoreLocation 'CurrentUser' .NOTES - File Name : Get-CSPfxCertificate.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : + - File Name : Get-CSPfxCertificate.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore diff --git a/src/Certificate/Import-CSCertificate.ps1 b/src/Certificate/Import-CSCertificate.ps1 index af302d7..8cde799 100644 --- a/src/Certificate/Import-CSCertificate.ps1 +++ b/src/Certificate/Import-CSCertificate.ps1 @@ -1,13 +1,17 @@ function Import-CSCertificate { <# .SYNOPSIS - A brief description of the function or script. + Imports a linked certificate to the valid store location. .DESCRIPTION - Describe the function of the script using a single sentence or more. + Import-CSCertificate takes a pfx certificate file and imports it to the supposed certificate store for + private and shared credential stores. - .PARAMETER One - Description of the Parameter (what it does) + .PARAMETER Type + Select between the a private and shared credential store. + + .PARAMETER Path + Provide a valid path to pfx certificate file. .INPUTS Describe the script input parameters (if any), otherwise it may also list the word "[None]". @@ -19,9 +23,9 @@ function Import-CSCertificate { .\Remove-Some-Script.ps1 -One content .NOTES - File Name : Import-CSCertificate.ps1 - Author : fullname - mail - Requires : ModuleNames + - File Name : Import-CSCertificate.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore @@ -52,7 +56,7 @@ function Import-CSCertificate { } process { - # Import to CurrentUser\My stor for windows and linux + # Import to CurrentUser\My store for windows and linux if ($Type -eq 'Private') { Import-CSPfxCertificate -Path $Path -StoreName 'My' -StoreLocation 'CurrentUser' -OpenFlags 'ReadWrite' } diff --git a/src/Certificate/Import-CSPfxCertificate.ps1 b/src/Certificate/Import-CSPfxCertificate.ps1 index 0db05e6..b261c49 100644 --- a/src/Certificate/Import-CSPfxCertificate.ps1 +++ b/src/Certificate/Import-CSPfxCertificate.ps1 @@ -1,11 +1,11 @@ function Import-CSPfxCertificate { <# .SYNOPSIS - adds a given pfx certificate file to current uerers personal certificate store. + Adds a given pfx certificate file to current user's personal certificate store. .DESCRIPTION - This function is used to import existing pfx certificate files. The Import-PFXCertificate cmdle from the - PKI module imports the certficate into a deprecated store. Thus you can't read the private key afterwards or + This function is used to import existing pfx certificate files. The Import-PFXCertificate cmdlet from the + PKI module imports the certificate into a deprecated store. Thus you can't read the private key afterwards or using it for decrypting data. .PARAMETER Path @@ -64,7 +64,7 @@ function Import-CSPfxCertificate { 'ReadWrite', 'MaxAllowed', 'OpenExistingOnly', - 'InclueArchived' + 'IncludeArchived' )] [string]$OpenFlags = 'ReadWrite' ) diff --git a/src/Certificate/New-CSCertAttribute.ps1 b/src/Certificate/New-CSCertAttribute.ps1 index 484a0c5..6311824 100644 --- a/src/Certificate/New-CSCertAttribute.ps1 +++ b/src/Certificate/New-CSCertAttribute.ps1 @@ -1,13 +1,13 @@ function New-CSCertAttribute { <# .SYNOPSIS - Create required data for a certificate signing request. + Creates required data for a certificate signing request. .DESCRIPTION Defines the certificate related properties for an upcoming New-PfxCertificate execution. .PARAMETER Country - Provide a two letter country code. + County code like EN, DE, IT, FR... .PARAMETER State Certificate state value. @@ -35,12 +35,12 @@ function New-CSCertAttribute { ['PSCredentialStore.Certificate.CSRDetails'] .EXAMPLE - New-CSCertAttribute -CSRSubject @{Country = 'DE'; State = 'BW'; City = 'Karlsruhe'; Organization = 'AwesomeIT'; OrganizationalUnitName = '';CommonName = 'MyPrivateCert'} + New-CSCertAttribute -Country 'DE' -State 'BW' -City 'Karlsruhe' -Organization 'AwesomeIT' -OrganizationalUnitName '' -CommonName 'MyPrivateCert' .NOTES - File Name : New-CSCertAttribute.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : + - File Name : New-CSCertAttribute.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore diff --git a/src/Certificate/New-CSCertificate.ps1 b/src/Certificate/New-CSCertificate.ps1 index a4ed69d..91d5554 100644 --- a/src/Certificate/New-CSCertificate.ps1 +++ b/src/Certificate/New-CSCertificate.ps1 @@ -25,9 +25,9 @@ function New-CSCertificate { New-CSCertificate -CRTAttribute $CRTAttribute -KeyName './myprivate.key' -CertName './mycert.pfx' .NOTES - File Name : New-CSCertificate.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : + - File Name : New-CSCertificate.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore diff --git a/src/Certificate/Test-CSCertificate.ps1 b/src/Certificate/Test-CSCertificate.ps1 index 16f1862..4ef34f6 100644 --- a/src/Certificate/Test-CSCertificate.ps1 +++ b/src/Certificate/Test-CSCertificate.ps1 @@ -1,10 +1,10 @@ function Test-CSCertificate { <# .SYNOPSIS - Tests if the linked certificate is stor ein the specified cert stores. + Tests if the linked certificate is store ein the specified cert stores. .DESCRIPTION - Test-CSCertficate should be an easy high level test for the linked certificate. + Test-CSCertificate should be an easy high level test for the linked certificate. .PARAMETER Type Select between 'Private' or 'Shared'. @@ -16,12 +16,12 @@ function Test-CSCertificate { [bool] .EXAMPLE - .\Remove-Some-Script.ps1 -One content + Test-CSCertificate -Type 'Shared' .NOTES - File Name : Test-CSCertificate.ps1 - Author : Marco Blessin - marco.blessing@googlemail.com - Requires : + - File Name : Test-CSCertificate.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore @@ -42,7 +42,7 @@ function Test-CSCertificate { $CS = Get-CredentialStore -Shared } if ($null -ne $CS.PfxCertificate) { - Write-Warning 'There is a Pfx certificate file linked in the store. Certifcates saved in the Cert store will be ignored!' + Write-Warning 'There is a Pfx certificate file linked in the store. Certificates saved in the Cert store will be ignored!' } } diff --git a/src/Certificate/Test-CSPfxCertificate.ps1 b/src/Certificate/Test-CSPfxCertificate.ps1 index a621931..d03fdf5 100644 --- a/src/Certificate/Test-CSPfxCertificate.ps1 +++ b/src/Certificate/Test-CSPfxCertificate.ps1 @@ -7,7 +7,7 @@ function Test-CSPfxCertificate { Use this function to ensure if a certificate is already imported into a given store. .PARAMETER Thumbprint - Provide one or more thumprints. + Provide one or more thumbprints. .PARAMETER StoreName Select the store name in which you want to search the certificates. @@ -22,10 +22,10 @@ function Test-CSPfxCertificate { [bool] .EXAMPLE - Test-CSPfxCertificat -Thumbprint '12345678' -StoreName 'My' -StoreLocation 'CurrentUser' + Test-CSPfxCertificate -Thumbprint '12345678' -StoreName 'My' -StoreLocation 'CurrentUser' .NOTES - File Name : Test-CSPfxCertificat.ps1 + File Name : Test-CSPfxCertificate.ps1 Author : Marco Blessing - marco.blessing@googlemail.com Requires : diff --git a/src/Certificate/Use-CSCertificate.ps1 b/src/Certificate/Use-CSCertificate.ps1 index a11577d..6ac2acd 100644 --- a/src/Certificate/Use-CSCertificate.ps1 +++ b/src/Certificate/Use-CSCertificate.ps1 @@ -1,7 +1,7 @@ function Use-CSCertificate { <# .SYNOPSIS - Links an existing PFX Certifiacte to a CredentialStore. + Links an existing PFX Certificate to a CredentialStore. .DESCRIPTION Linking a certificate is needed if you plan to use the same CredentialStore in cross platform scenarios. @@ -9,6 +9,15 @@ function Use-CSCertificate { .PARAMETER Path Specify the path to the PFX Certificate you want to link for usage. + .PARAMETER CredentialStore + Specify a custom path for a shared credential store. + + .PARAMETER Shared + Use the credential store in shared mode. + + .PARAMETER UserCertStore + Use the given certificate and import it into the corresponding certificate store. + .INPUTS [None] @@ -16,7 +25,7 @@ function Use-CSCertificate { [None] .EXAMPLE - + Use-CSCertificate -Path 'C:\cert.pfx' .NOTES File Name : Use-CSCertificate.ps1 @@ -98,7 +107,7 @@ Make sure you used the same AES keys for encrypting! } if ($UseCertStore) { - Import-CSCertificate -Type ($PSCmdlet.ParameterSetName -eq "Private") -Path $Path + Import-CSCertificate -Type $PSCmdlet.ParameterSetName -Path $Path $CS.Thumbprint = $PfxCertificate.Thumbprint $CS.PfxCertificate = $null } diff --git a/src/Item/Get-CredentialStoreItem.ps1 b/src/Item/Get-CredentialStoreItem.ps1 index 12f06eb..b33dbad 100644 --- a/src/Item/Get-CredentialStoreItem.ps1 +++ b/src/Item/Get-CredentialStoreItem.ps1 @@ -11,8 +11,8 @@ function Get-CredentialStoreItem { Specify the host, for which you would like to change the credentials. .PARAMETER Identifier - Provide a custom identifier to the given remote host key. This enables you to store multiple credentials - for a single remote host entry. For example ad/sys1, ftp/sys1, mssql/sys1 + Provide a custom identifier to the given remote host key. This enables you to store multiple credentials + for a single remote host entry. For example ad/sys1, ftp/sys1, mssql/sys1 .PARAMETER Path Define a custom path to a shared CredentialStore. @@ -31,11 +31,10 @@ function Get-CredentialStoreItem { $myCreds = Get-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.local" .NOTES - ``` - File Name : Get-CredentialStoreItem.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : - ``` + - File Name : Get-CredentialStoreItem.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : dfgdfg + .LINK https://github.com/OCram85/PSCredentialStore #> -- 2.40.1 From 48c0980b5f5a76414fa3415675c134e0debfef74 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Mon, 8 Apr 2019 13:06:41 +0200 Subject: [PATCH 15/31] update cbh blocks --- src/Connection/Connect-To.ps1 | 6 ++--- src/Connection/Disconnect-From.ps1 | 24 +++++++++---------- src/Connection/Test-CSConnection.ps1 | 20 ++++++++-------- src/Item/Get-CredentialStoreItem.ps1 | 8 +++---- src/Item/New-CredentialStoreItem.ps1 | 18 ++++---------- src/Item/Remove-CredentialStoreItem.ps1 | 8 +++---- src/Item/Set-CredentialStoreItem.ps1 | 8 +++---- src/Item/Test-CredentialStoreItem.ps1 | 8 +++---- .../Get-DefaultCredentialStorePath.ps1 | 10 ++++---- src/Private/Get-ModuleBase.ps1 | 10 ++++---- src/Private/Get-RandomAESKey.ps1 | 10 ++++---- src/Private/Get-TempDir.ps1 | 6 ++--- src/Private/Resolve-Dependency.ps1 | 10 ++++---- src/Private/Test-Module.ps1 | 12 ++++------ src/Store/Get-CredentialStore.ps1 | 12 ++++------ src/Store/New-CredentialStore.ps1 | 9 ++++--- src/Store/Test-CredentialStore.ps1 | 11 ++++----- 17 files changed, 83 insertions(+), 107 deletions(-) diff --git a/src/Connection/Connect-To.ps1 b/src/Connection/Connect-To.ps1 index c39123d..74b1eaa 100644 --- a/src/Connection/Connect-To.ps1 +++ b/src/Connection/Connect-To.ps1 @@ -57,9 +57,9 @@ function Connect-To { Connect-To -RemoteHost "exchange01.myside.local" -Type ExchangeHTTPS .NOTES - File Name : Connect-To.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : + - File Name : Connect-To.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore diff --git a/src/Connection/Disconnect-From.ps1 b/src/Connection/Disconnect-From.ps1 index 1ccaa70..57139b9 100644 --- a/src/Connection/Disconnect-From.ps1 +++ b/src/Connection/Disconnect-From.ps1 @@ -51,9 +51,9 @@ function Disconnect-From { Disconnect-From -RemoteHost "exchange01.myside.local" -Type ExchangeHTTPS .NOTES - File Name : Disconnect-From.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : + - File Name : Disconnect-From.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore @@ -95,7 +95,7 @@ function Disconnect-From { catch { # Write a error message to the log. $MessageParams = @{ - Message = "Unable to disconnect from {0} using Type {1}." -f $RemoteHost, $Type + Message = "Unable to disconnect from {0} using Type {1}." -f $RemoteHost, $Type ErrorAction = "Stop" } Write-Error @MessageParams @@ -114,7 +114,7 @@ function Disconnect-From { catch { # Write a error message to the log. $MessageParams = @{ - Message = "Unable to disconnect from {0} using Type {1}." -f $RemoteHost, $Type + Message = "Unable to disconnect from {0} using Type {1}." -f $RemoteHost, $Type ErrorAction = "Stop" } Write-Error @MessageParams @@ -127,7 +127,7 @@ function Disconnect-From { } else { $MessageParams = @{ - Message = "There is no open WinSCP Session" + Message = "There is no open WinSCP Session" ErrorAction = "Stop" } Write-Error @MessageParams @@ -138,7 +138,7 @@ function Disconnect-From { "NetAppFAS" { try { $MessageParams = @{ - Message = "Setting {0} to `$null, which will disconnect NetAppFAS" -f $Global:CurrentNcController + Message = "Setting {0} to `$null, which will disconnect NetAppFAS" -f $Global:CurrentNcController ErrorAction = "Continue" } Write-Verbose @MessageParams @@ -148,7 +148,7 @@ function Disconnect-From { catch { # Write a error message to the log. $MessageParams = @{ - Message = "Unable to disconnect from {0} using Type {1}." -f $RemoteHost, $Type + Message = "Unable to disconnect from {0} using Type {1}." -f $RemoteHost, $Type ErrorAction = "Stop" } Write-Error @MessageParams @@ -163,7 +163,7 @@ function Disconnect-From { catch { # Write a error message to the log. $MessageParams = @{ - Message = "Unable to disconnect from {0} using Type {1}." -f $RemoteHost, $Type + Message = "Unable to disconnect from {0} using Type {1}." -f $RemoteHost, $Type ErrorAction = "Stop" } Write-Error @MessageParams @@ -176,7 +176,7 @@ function Disconnect-From { } catch { $MessageParams = @{ - Message = "Unable to disconnect from {0} using Type {1}." -f $RemoteHost, $Type + Message = "Unable to disconnect from {0} using Type {1}." -f $RemoteHost, $Type ErrorAction = "Stop" } Write-Error @MessageParams @@ -188,7 +188,7 @@ function Disconnect-From { } else { $MessageParams = @{ - Message = "There is no open WinSCP Session" + Message = "There is no open WinSCP Session" ErrorAction = "Stop" } Write-Error @MessageParams @@ -197,7 +197,7 @@ function Disconnect-From { default { # Write a error message to the log. $MessageParams = @{ - Message = "Unable to disconnect from {0} using Type {1}." -f $RemoteHost, $Type + Message = "Unable to disconnect from {0} using Type {1}." -f $RemoteHost, $Type ErrorAction = "Stop" } Write-Error @MessageParams diff --git a/src/Connection/Test-CSConnection.ps1 b/src/Connection/Test-CSConnection.ps1 index 63f7271..08b483e 100644 --- a/src/Connection/Test-CSConnection.ps1 +++ b/src/Connection/Test-CSConnection.ps1 @@ -17,22 +17,22 @@ function Test-CSConnection { [None] .OUTPUTS - [Boolean] + [bool] .EXAMPLE - .\Test-CMConnection -RemoteHost "r0-i01-vcr01.p0r.kivbf-cloud.net" -Type VMware + Test-CMConnection -RemoteHost "vcr01.internal.net" -Type VMware .NOTES - File Name : Test-CSConnection.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : + - File Name : Test-CSConnection.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore #> [CmdletBinding()] - [OutputType([boolean])] + [OutputType([bool])] param( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] @@ -77,7 +77,7 @@ function Test-CSConnection { 'CiscoUcs' { $MsgParams = @{ ErrorAction = "Stop" - Message = "CiscoUCS connection test is not implemented yet!" + Message = "CiscoUCS connection test is not implemented yet!" } Write-Error @MsgParams return $false @@ -86,7 +86,7 @@ function Test-CSConnection { 'FTP' { $MsgParams = @{ ErrorAction = "Stop" - Message = "FTP connection test is not implemented yet!" + Message = "FTP connection test is not implemented yet!" } Write-Error @MsgParams return $false @@ -95,7 +95,7 @@ function Test-CSConnection { 'NetAppFAS' { $MsgParams = @{ ErrorAction = "Stop" - Message = "NetAppFAS connection test is not implemented yet!" + Message = "NetAppFAS connection test is not implemented yet!" } Write-Error @MsgParams return $false @@ -105,7 +105,7 @@ function Test-CSConnection { Default { $MsgParams = @{ ErrorAction = "Stop" - Message = "Panic: There is an invalid type value! This error should never be thrown." + Message = "Panic: There is an invalid type value! This error should never be thrown." } Write-Error @MsgParams return $false diff --git a/src/Item/Get-CredentialStoreItem.ps1 b/src/Item/Get-CredentialStoreItem.ps1 index b33dbad..bf32e1a 100644 --- a/src/Item/Get-CredentialStoreItem.ps1 +++ b/src/Item/Get-CredentialStoreItem.ps1 @@ -11,8 +11,8 @@ function Get-CredentialStoreItem { Specify the host, for which you would like to change the credentials. .PARAMETER Identifier - Provide a custom identifier to the given remote host key. This enables you to store multiple credentials - for a single remote host entry. For example ad/sys1, ftp/sys1, mssql/sys1 + Provide a custom identifier to the given remote host key. This enables you to store multiple credentials + for a single remote host entry. For example ad/sys1, ftp/sys1, mssql/sys1 .PARAMETER Path Define a custom path to a shared CredentialStore. @@ -32,8 +32,8 @@ function Get-CredentialStoreItem { .NOTES - File Name : Get-CredentialStoreItem.ps1 - - Author : Marco Blessing - marco.blessing@googlemail.com - - Requires : dfgdfg + - Author : Messing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore diff --git a/src/Item/New-CredentialStoreItem.ps1 b/src/Item/New-CredentialStoreItem.ps1 index 6659302..2cd5947 100644 --- a/src/Item/New-CredentialStoreItem.ps1 +++ b/src/Item/New-CredentialStoreItem.ps1 @@ -31,11 +31,10 @@ function New-CredentialStoreItem { New-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.local" .NOTES - ``` - File Name : New-CredentialStoreItem.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : - ``` + - File Name : New-CredentialStoreItem.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : + .LINK https://github.com/OCram85/PSCredentialStore #> @@ -91,15 +90,6 @@ function New-CredentialStoreItem { Write-Error @MessageParams } - # Read the file content based on the given ParameterSetName - <# - if ($PSCmdlet.ParameterSetName -eq 'Private') { - $CSContent = Get-CredentialStore - } - elseif ($PSCmdlet.ParameterSetName -eq 'Shared') { - $CSContent = Get-CredentialStore -Shared -Path $Path - } - #> $CSContent = Get-CredentialStore -Shared -Path $Path $CurrentDate = Get-Date -UFormat "%Y-%m-%d %H:%M:%S" diff --git a/src/Item/Remove-CredentialStoreItem.ps1 b/src/Item/Remove-CredentialStoreItem.ps1 index 0ea0b45..f3296b7 100644 --- a/src/Item/Remove-CredentialStoreItem.ps1 +++ b/src/Item/Remove-CredentialStoreItem.ps1 @@ -39,11 +39,9 @@ function Remove-CredentialStoreItem { Remove-CredentialStoreItem -RemoteHost "esx01.myside.local" -Identifier svc .NOTES - ``` - File Name : Remove-CredentialStoreItem.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : - ``` + - File Name : Remove-CredentialStoreItem.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore diff --git a/src/Item/Set-CredentialStoreItem.ps1 b/src/Item/Set-CredentialStoreItem.ps1 index 738b9fb..5c125c1 100644 --- a/src/Item/Set-CredentialStoreItem.ps1 +++ b/src/Item/Set-CredentialStoreItem.ps1 @@ -30,11 +30,9 @@ function Set-CredentialStoreItem { Set-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.local" -Identifier svc .NOTES - ``` - File Name : Set-CredentialStoreItem.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : - ``` + - File Name : Set-CredentialStoreItem.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore diff --git a/src/Item/Test-CredentialStoreItem.ps1 b/src/Item/Test-CredentialStoreItem.ps1 index 5f125e7..a248f0e 100644 --- a/src/Item/Test-CredentialStoreItem.ps1 +++ b/src/Item/Test-CredentialStoreItem.ps1 @@ -37,11 +37,9 @@ function Test-CredentialStoreItem { } .NOTES - ``` - File Name : Test-CredentialStoreItem.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : - ``` + - File Name : Test-CredentialStoreItem.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore diff --git a/src/Private/Get-DefaultCredentialStorePath.ps1 b/src/Private/Get-DefaultCredentialStorePath.ps1 index 4d9d162..2ee5dc5 100644 --- a/src/Private/Get-DefaultCredentialStorePath.ps1 +++ b/src/Private/Get-DefaultCredentialStorePath.ps1 @@ -16,9 +16,9 @@ function Get-DefaultCredentialStorePath { $Path = Get-DefaultCredentialStorePath .NOTES - File Name : Get-DefaultCredentialStorePath.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : + - File Name : Get-DefaultCredentialStorePath.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore @@ -30,7 +30,7 @@ function Get-DefaultCredentialStorePath { [switch]$Shared ) - begin {} + begin { } process { if ($Shared.IsPresent) { @@ -57,5 +57,5 @@ function Get-DefaultCredentialStorePath { } } - end {} + end { } } diff --git a/src/Private/Get-ModuleBase.ps1 b/src/Private/Get-ModuleBase.ps1 index 118dfeb..acb2451 100644 --- a/src/Private/Get-ModuleBase.ps1 +++ b/src/Private/Get-ModuleBase.ps1 @@ -11,9 +11,9 @@ function Get-ModuleBase { Returns the base path as string .NOTES - File Name : Get-ModuleBase.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : + - File Name : Get-ModuleBase.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore @@ -21,9 +21,9 @@ function Get-ModuleBase { [CmdletBinding()] [OutputType()] param() - begin {} + begin { } process { return $MyInvocation.MyCommand.Module.ModuleBase } - end {} + end { } } diff --git a/src/Private/Get-RandomAESKey.ps1 b/src/Private/Get-RandomAESKey.ps1 index 27baae5..aff07b5 100644 --- a/src/Private/Get-RandomAESKey.ps1 +++ b/src/Private/Get-RandomAESKey.ps1 @@ -16,9 +16,9 @@ function Get-RandomAESKey { .\Get-RandomAESKey .NOTES - File Name : Get-RandomAESKey.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : + - File Name : Get-RandomAESKey.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore @@ -28,7 +28,7 @@ function Get-RandomAESKey { [OutputType([byte[]])] param() - begin {} + begin { } process { $key = [byte[]]::new(32) @@ -40,5 +40,5 @@ function Get-RandomAESKey { } } - end {} + end { } } diff --git a/src/Private/Get-TempDir.ps1 b/src/Private/Get-TempDir.ps1 index c0b1580..b3db4d9 100644 --- a/src/Private/Get-TempDir.ps1 +++ b/src/Private/Get-TempDir.ps1 @@ -15,9 +15,9 @@ function Get-TempDir { Get-TempDir .NOTES - File Name : Get-TempDir.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : + - File Name : Get-TempDir.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore diff --git a/src/Private/Resolve-Dependency.ps1 b/src/Private/Resolve-Dependency.ps1 index c0f6a0a..4b82922 100644 --- a/src/Private/Resolve-Dependency.ps1 +++ b/src/Private/Resolve-Dependency.ps1 @@ -40,11 +40,9 @@ function Resolve-Dependency { } .NOTES - ``` - File Name : ResolveDependency.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : - ``` + - File Name : ResolveDependency.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore @@ -69,7 +67,7 @@ function Resolve-Dependency { } process { - $SelectedDependency = $Dependency.Optional | Where-Object {$_.Name -match $Name} + $SelectedDependency = $Dependency.Optional | Where-Object { $_.Name -match $Name } # return true if there is no dependency defined if ($null -eq $SelectedDependency) { return $true diff --git a/src/Private/Test-Module.ps1 b/src/Private/Test-Module.ps1 index 2872db3..ab68198 100644 --- a/src/Private/Test-Module.ps1 +++ b/src/Private/Test-Module.ps1 @@ -34,11 +34,9 @@ function Test-Module { .\Test-Dependency -Name 'VMware.PowerCLI' -Type 'Module' -StopIfFails .NOTES - ``` - File Name : Test-Module.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : - ``` + - File Name : Test-Module.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore @@ -58,7 +56,7 @@ Could not find the required {0} called {1}. Please install the required {0} to r [Parameter(Mandatory = $false)] [switch]$StopIfFails ) - begin {} + begin { } process { $Message = $MessagePattern -f $Type, $Name @@ -75,5 +73,5 @@ Could not find the required {0} called {1}. Please install the required {0} to r } } - end {} + end { } } diff --git a/src/Store/Get-CredentialStore.ps1 b/src/Store/Get-CredentialStore.ps1 index 20191ff..a30de5f 100644 --- a/src/Store/Get-CredentialStore.ps1 +++ b/src/Store/Get-CredentialStore.ps1 @@ -25,11 +25,9 @@ function Get-CredentialStore { $CSContent = Get-CredentialStore -Path "C:\TMP\mystore.json" .NOTES - ``` - File Name : Get-CredentialStore.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : - ``` + - File Name : Get-CredentialStore.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore #> @@ -45,7 +43,7 @@ function Get-CredentialStore { [switch]$Shared ) - begin {} + begin { } process { # Set the CredentialStore for private, shared or custom mode. @@ -83,6 +81,6 @@ function Get-CredentialStore { } } - end {} + end { } } diff --git a/src/Store/New-CredentialStore.ps1 b/src/Store/New-CredentialStore.ps1 index d3b462e..9502060 100644 --- a/src/Store/New-CredentialStore.ps1 +++ b/src/Store/New-CredentialStore.ps1 @@ -42,11 +42,10 @@ function New-CredentialStore { # Creates a new shared CredentialStore in the given location. .NOTES - ``` - File Name : New-CredentialStore.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : - ``` + - File Name : New-CredentialStore.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : + .LINK https://github.com/OCram85/PSCredentialStore #> diff --git a/src/Store/Test-CredentialStore.ps1 b/src/Store/Test-CredentialStore.ps1 index 3b62aca..2746264 100644 --- a/src/Store/Test-CredentialStore.ps1 +++ b/src/Store/Test-CredentialStore.ps1 @@ -15,11 +15,10 @@ function Test-CredentialStore { can be decrypted across systems. .NOTES - ``` - File Name : Test-CredentialStore.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : - ``` + - File Name : Test-CredentialStore.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : + .LINK https://github.com/OCram85/PSCredentialStore #> @@ -60,6 +59,6 @@ function Test-CredentialStore { } } - end {} + end { } } -- 2.40.1 From ac7a5e0db3da1b844c5df19fe75d1b6613d5e7af Mon Sep 17 00:00:00 2001 From: OCram85 Date: Mon, 8 Apr 2019 13:12:15 +0200 Subject: [PATCH 16/31] update docs --- docs/Connect-To.md | 201 +++++++++++++++++++++++++++++ docs/Disconnect-From.md | 130 +++++++++++++++++++ docs/Get-CSCertificate.md | 78 +++++++++++ docs/Get-CSPfxCertificate.md | 95 ++++++++++++++ docs/Get-CredentialStore.md | 90 +++++++++++++ docs/Get-CredentialStoreItem.md | 120 +++++++++++++++++ docs/Import-CSCertificate.md | 79 ++++++++++++ docs/Import-CSPfxCertificate.md | 113 ++++++++++++++++ docs/New-CSCertAttribute.md | 154 ++++++++++++++++++++++ docs/New-CSCertificate.md | 127 ++++++++++++++++++ docs/New-CredentialStore.md | 113 ++++++++++++++++ docs/New-CredentialStoreItem.md | 138 ++++++++++++++++++++ docs/PSCredentialStore.md | 73 +++++++++++ docs/Remove-CredentialStoreItem.md | 134 +++++++++++++++++++ docs/Set-CredentialStoreItem.md | 137 ++++++++++++++++++++ docs/Test-CSCertificate.md | 63 +++++++++ docs/Test-CSConnection.md | 80 ++++++++++++ docs/Test-CSPfxCertificate.md | 94 ++++++++++++++ docs/Test-CredentialStore.md | 88 +++++++++++++ docs/Test-CredentialStoreItem.md | 129 ++++++++++++++++++ docs/Use-CSCertificate.md | 114 ++++++++++++++++ docs/about_PSCredentialStore.md | 102 +++++++++++++++ 22 files changed, 2452 insertions(+) create mode 100644 docs/Connect-To.md create mode 100644 docs/Disconnect-From.md create mode 100644 docs/Get-CSCertificate.md create mode 100644 docs/Get-CSPfxCertificate.md create mode 100644 docs/Get-CredentialStore.md create mode 100644 docs/Get-CredentialStoreItem.md create mode 100644 docs/Import-CSCertificate.md create mode 100644 docs/Import-CSPfxCertificate.md create mode 100644 docs/New-CSCertAttribute.md create mode 100644 docs/New-CSCertificate.md create mode 100644 docs/New-CredentialStore.md create mode 100644 docs/New-CredentialStoreItem.md create mode 100644 docs/PSCredentialStore.md create mode 100644 docs/Remove-CredentialStoreItem.md create mode 100644 docs/Set-CredentialStoreItem.md create mode 100644 docs/Test-CSCertificate.md create mode 100644 docs/Test-CSConnection.md create mode 100644 docs/Test-CSPfxCertificate.md create mode 100644 docs/Test-CredentialStore.md create mode 100644 docs/Test-CredentialStoreItem.md create mode 100644 docs/Use-CSCertificate.md create mode 100644 docs/about_PSCredentialStore.md diff --git a/docs/Connect-To.md b/docs/Connect-To.md new file mode 100644 index 0000000..ada01c3 --- /dev/null +++ b/docs/Connect-To.md @@ -0,0 +1,201 @@ +--- +external help file: PSCredentialStore-help.xml +Module Name: PSCredentialStore +online version: https://github.com/OCram85/PSCredentialStore +schema: 2.0.0 +--- + +# Connect-To + +## SYNOPSIS +Connects to the given host using the stored CredentialStoreItem. + +## SYNTAX + +### Private (Default) +``` +Connect-To -RemoteHost [-Identifier ] -Type [-Credentials ] [-PassThru] + [] +``` + +### Shared +``` +Connect-To -RemoteHost [-Identifier ] -Type [-Credentials ] [-Shared] + [-Path ] [-PassThru] [] +``` + +## DESCRIPTION +Establish a connection to the selected host using a stored CredentialStoreItem. + +## EXAMPLES + +### BEISPIEL 1 +``` +Connect-To -RemoteHost "ucs.myside.local" -Type CiscoUcs +``` + +### BEISPIEL 2 +``` +Connect-To -RemoteHost "ftp.myside.local" -Type FTP +``` + +### BEISPIEL 3 +``` +Connect-To -RemoteHost "fas.myside.local" -Type NetAppFAS +``` + +### BEISPIEL 4 +``` +Connect-To -RemoteHost "esx01.myside.local" -Type VMware +``` + +### BEISPIEL 5 +``` +Connect-To -RemoteHost "vCenter.myside.local" -Type CisServer +``` + +### BEISPIEL 6 +``` +Connect-To -RemoteHost "exchange01.myside.local" -Type ExchangeHTTP +``` + +### BEISPIEL 7 +``` +Connect-To -RemoteHost "exchange01.myside.local" -Type ExchangeHTTPS +``` + +## PARAMETERS + +### -RemoteHost +Specify the host, for which you would like to change the credentials. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Identifier +Defaults to "". +Specify a string, which separates two CredentialStoreItems for the +same hostname. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Type +Specify the host type of the target. +Currently implemented targets are: Possible connection values are: +CiscoUcs, FTP, NetAppFAS, VMware, CisServer, ExchangeHTTP, ExchangeHTTPS, SCP. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Credentials +Use this parameter to bypass the stored credentials. +Without this parameter Connect-To tries to read the +needed credentials from the CredentialStore. +If you provide this parameter you skip this lookup behavior. +So you can use it to enable credentials without preparing any user interaction. + +```yaml +Type: PSCredential +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Shared +Switch to shared mode with this param. +This enforces the command to work with a shared CredentialStore which +can be decrypted across systems. + +```yaml +Type: SwitchParameter +Parameter Sets: Shared +Aliases: + +Required: True +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Path +Define a custom path to a shared CredentialStore. + +```yaml +Type: String +Parameter Sets: Shared +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +{{ Fill PassThru Description }} + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### [None] +## OUTPUTS + +### [None] +## NOTES +- File Name : Connect-To.ps1 +- Author : Marco Blessing - marco.blessing@googlemail.com +- Requires : + +## RELATED LINKS + +[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore) + diff --git a/docs/Disconnect-From.md b/docs/Disconnect-From.md new file mode 100644 index 0000000..ea84902 --- /dev/null +++ b/docs/Disconnect-From.md @@ -0,0 +1,130 @@ +--- +external help file: PSCredentialStore-help.xml +Module Name: PSCredentialStore +online version: https://github.com/OCram85/PSCredentialStore +schema: 2.0.0 +--- + +# Disconnect-From + +## SYNOPSIS +Terminates a session established with Connect-To using a CredentialStoreItem. + +## SYNTAX + +``` +Disconnect-From [-RemoteHost] [-Type] [-Force] [] +``` + +## DESCRIPTION +Terminates a session established with Connect-To using a CredentialStoreItem. + +## EXAMPLES + +### BEISPIEL 1 +``` +Disconnect-From -RemoteHost "ucs.myside.local" -Type CiscoUcs +``` + +### BEISPIEL 2 +``` +Disconnect-From -RemoteHost "ftp.myside.local" -Type FTP +``` + +### BEISPIEL 3 +``` +Disconnect-From -RemoteHost "fas.myside.local" -Type NetAppFAS +``` + +### BEISPIEL 4 +``` +Disconnect-From -RemoteHost "esx01.myside.local" -Type VMware +``` + +### BEISPIEL 5 +``` +Disconnect-From -RemoteHost "esx01.myside.local" -Type VMware -Force:$True +``` + +### BEISPIEL 6 +``` +Disconnect-From -RemoteHost "vcenter.myside.local" -Type CisServer +``` + +### BEISPIEL 7 +``` +Disconnect-From -RemoteHost "exchange01.myside.local" -Type ExchangeHTTP +``` + +### BEISPIEL 8 +``` +Disconnect-From -RemoteHost "exchange01.myside.local" -Type ExchangeHTTPS +``` + +## PARAMETERS + +### -RemoteHost +Specify the remote endpoint, whose session you would like to terminate. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Type +Specify the host type of the target. +Currently implemented targets are: CiscoUcs, FTP, NetAppFAS, VMware, +CisServer, ExchangeHTTP, ExchangeHTTPS, SCP. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Force +Force the disconnect, even if the disconnect would fail. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### [None] +## OUTPUTS + +### [None] +## NOTES +- File Name : Disconnect-From.ps1 +- Author : Marco Blessing - marco.blessing@googlemail.com +- Requires : + +## RELATED LINKS + +[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore) + diff --git a/docs/Get-CSCertificate.md b/docs/Get-CSCertificate.md new file mode 100644 index 0000000..556aeea --- /dev/null +++ b/docs/Get-CSCertificate.md @@ -0,0 +1,78 @@ +--- +external help file: PSCredentialStore-help.xml +Module Name: PSCredentialStore +online version: https://github.com/OCram85/PSCredentialStore +schema: 2.0.0 +--- + +# Get-CSCertificate + +## SYNOPSIS +Returns the current used valid PfX certificate. + +## SYNTAX + +``` +Get-CSCertificate [-Type] [-Thumbprint] [] +``` + +## DESCRIPTION +Use this function to get the available pfx certificate respecting the config hierarchy. + +## EXAMPLES + +### BEISPIEL 1 +``` +Get-CSCertificate -Type 'Shared' -Thumbprint '12334456' +``` + +## PARAMETERS + +### -Type +Select the current credential store type. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Thumbprint +Provide the credentials thumbprint for the search. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### [None] +## OUTPUTS + +### [System.Security.Cryptography.X509Certificates.X509Certificate2] +## NOTES +- File Name : Get-CSCertificate.ps1 +- Author : Marco Blessing - marco.blessing@googlemail.com +- Requires : + +## RELATED LINKS + +[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore) + diff --git a/docs/Get-CSPfxCertificate.md b/docs/Get-CSPfxCertificate.md new file mode 100644 index 0000000..8fd546c --- /dev/null +++ b/docs/Get-CSPfxCertificate.md @@ -0,0 +1,95 @@ +--- +external help file: PSCredentialStore-help.xml +Module Name: PSCredentialStore +online version: https://github.com/OCram85/PSCredentialStore +schema: 2.0.0 +--- + +# Get-CSPfxCertificate + +## SYNOPSIS +Returns the certificate object given by thumbprint. + +## SYNTAX + +``` +Get-CSPfxCertificate [-Thumbprint] [[-StoreName] ] [[-StoreLocation] ] + [] +``` + +## DESCRIPTION +You can use this function to get a stored certificate. +Search for the object by its unique thumbprint. + +## EXAMPLES + +### BEISPIEL 1 +``` +Get-CSPfxCertificate -Thumbprint '12345678' -StoreName 'My' -StoreLocation 'CurrentUser' +``` + +## PARAMETERS + +### -Thumbprint +Provide one or more thumbprints. + +```yaml +Type: String[] +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -StoreName +Select the store name in which you want to search the certificates. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: My +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StoreLocation +Select between the both available locations CurrentUser odr LocalMachine. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: CurrentUser +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### [string] +## OUTPUTS + +### [System.Security.Cryptography.X509Certificates.X509Certificate2[]] +## NOTES +- File Name : Get-CSPfxCertificate.ps1 +- Author : Marco Blessing - marco.blessing@googlemail.com +- Requires : + +## RELATED LINKS + +[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore) + diff --git a/docs/Get-CredentialStore.md b/docs/Get-CredentialStore.md new file mode 100644 index 0000000..a164d71 --- /dev/null +++ b/docs/Get-CredentialStore.md @@ -0,0 +1,90 @@ +--- +external help file: PSCredentialStore-help.xml +Module Name: PSCredentialStore +online version: https://github.com/OCram85/PSCredentialStore +schema: 2.0.0 +--- + +# Get-CredentialStore + +## SYNOPSIS +Reads the complete content of the credential store and returns it as a new object. + +## SYNTAX + +### Private (Default) +``` +Get-CredentialStore [] +``` + +### Shared +``` +Get-CredentialStore [-Path ] [-Shared] [] +``` + +## DESCRIPTION +The content is in a raw format. +It means there is no transformation to the different credential types. +You can not use the object properties to connect with remote host. +Therefore please use +Get-CredentialStoreItem. + +## EXAMPLES + +### BEISPIEL 1 +``` +$CSContent = Get-CredentialStore -Path "C:\TMP\mystore.json" +``` + +## PARAMETERS + +### -Path +Define a custom path to a shared CredentialStore. + +```yaml +Type: String +Parameter Sets: Shared +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Shared +Switch to shared mode with this param. +This enforces the command to work with a shared CredentialStore which +can be decrypted across systems. + +```yaml +Type: SwitchParameter +Parameter Sets: Shared +Aliases: + +Required: True +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### [None] +## OUTPUTS + +### [PSObject] Returns the credential store content as PSObject. +## NOTES +- File Name : Get-CredentialStore.ps1 +- Author : Marco Blessing - marco.blessing@googlemail.com +- Requires : + +## RELATED LINKS + +[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore) + diff --git a/docs/Get-CredentialStoreItem.md b/docs/Get-CredentialStoreItem.md new file mode 100644 index 0000000..5e7f392 --- /dev/null +++ b/docs/Get-CredentialStoreItem.md @@ -0,0 +1,120 @@ +--- +external help file: PSCredentialStore-help.xml +Module Name: PSCredentialStore +online version: https://github.com/OCram85/PSCredentialStore +schema: 2.0.0 +--- + +# Get-CredentialStoreItem + +## SYNOPSIS +Returns the Credential from a given remote host item. + +## SYNTAX + +### Private (Default) +``` +Get-CredentialStoreItem -RemoteHost [-Identifier ] [] +``` + +### Shared +``` +Get-CredentialStoreItem -RemoteHost [-Identifier ] [-Shared] [-Path ] + [] +``` + +## DESCRIPTION +Return the credential as PSCredential object. + +## EXAMPLES + +### BEISPIEL 1 +``` +$myCreds = Get-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.local" +``` + +## PARAMETERS + +### -RemoteHost +Specify the host, for which you would like to change the credentials. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Identifier +Provide a custom identifier to the given remote host key. +This enables you to store multiple credentials +for a single remote host entry. +For example ad/sys1, ftp/sys1, mssql/sys1 + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Shared +Switch to shared mode with this param. +This enforces the command to work with a shared CredentialStore which +can be decrypted across systems. + +```yaml +Type: SwitchParameter +Parameter Sets: Shared +Aliases: + +Required: True +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Path +Define a custom path to a shared CredentialStore. + +```yaml +Type: String +Parameter Sets: Shared +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### [None] +## OUTPUTS + +### [System.Management.Automation.PSCredential] +## NOTES +- File Name : Get-CredentialStoreItem.ps1 +- Author : Messing - marco.blessing@googlemail.com +- Requires : + +## RELATED LINKS + +[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore) + diff --git a/docs/Import-CSCertificate.md b/docs/Import-CSCertificate.md new file mode 100644 index 0000000..c28de0b --- /dev/null +++ b/docs/Import-CSCertificate.md @@ -0,0 +1,79 @@ +--- +external help file: PSCredentialStore-help.xml +Module Name: PSCredentialStore +online version: https://github.com/OCram85/PSCredentialStore +schema: 2.0.0 +--- + +# Import-CSCertificate + +## SYNOPSIS +Imports a linked certificate to the valid store location. + +## SYNTAX + +``` +Import-CSCertificate [-Type] [-Path] [] +``` + +## DESCRIPTION +Import-CSCertificate takes a pfx certificate file and imports it to the supposed certificate store for +private and shared credential stores. + +## EXAMPLES + +### BEISPIEL 1 +``` +.\Remove-Some-Script.ps1 -One content +``` + +## PARAMETERS + +### -Type +Select between the a private and shared credential store. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Path +Provide a valid path to pfx certificate file. + +```yaml +Type: FileInfo +Parameter Sets: (All) +Aliases: + +Required: True +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Describe the script input parameters (if any), otherwise it may also list the word "[None]". +## OUTPUTS + +### Describe the script output parameters (if any), otherwise it may also list the word "[None]". +## NOTES +- File Name : Import-CSCertificate.ps1 +- Author : Marco Blessing - marco.blessing@googlemail.com +- Requires : + +## RELATED LINKS + +[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore) + diff --git a/docs/Import-CSPfxCertificate.md b/docs/Import-CSPfxCertificate.md new file mode 100644 index 0000000..e8e5b7a --- /dev/null +++ b/docs/Import-CSPfxCertificate.md @@ -0,0 +1,113 @@ +--- +external help file: PSCredentialStore-help.xml +Module Name: PSCredentialStore +online version: https://github.com/OCram85/PSCredentialStore +schema: 2.0.0 +--- + +# Import-CSPfxCertificate + +## SYNOPSIS +Adds a given pfx certificate file to current user's personal certificate store. + +## SYNTAX + +``` +Import-CSPfxCertificate [-Path] [[-StoreName] ] [[-StoreLocation] ] + [[-OpenFlags] ] [] +``` + +## DESCRIPTION +This function is used to import existing pfx certificate files. +The Import-PFXCertificate cmdlet from the +PKI module imports the certificate into a deprecated store. +Thus you can't read the private key afterwards or +using it for decrypting data. + +## EXAMPLES + +### BEISPIEL 1 +``` +Import-CSPfxCertificate -Path (Join-Path -Path $Env:APPDATA -ChildPath '/PSCredentialStore.pfx') +``` + +## PARAMETERS + +### -Path +Path to an existing *.pfx certificate file. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StoreName +Additionally you change change the store where you want the certificate into. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: My +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StoreLocation +{{ Fill StoreLocation Description }} + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: CurrentUser +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OpenFlags +{{ Fill OpenFlags Description }} + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 4 +Default value: ReadWrite +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### [None] +## OUTPUTS + +### [None] +## NOTES +File Name : Import-CSPfxCertificate.ps1 +Author : Marco Blessing - marco.blessing@googlemail.com +Requires : + +## RELATED LINKS + +[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore) + diff --git a/docs/New-CSCertAttribute.md b/docs/New-CSCertAttribute.md new file mode 100644 index 0000000..3908b1a --- /dev/null +++ b/docs/New-CSCertAttribute.md @@ -0,0 +1,154 @@ +--- +external help file: PSCredentialStore-help.xml +Module Name: PSCredentialStore +online version: https://github.com/OCram85/PSCredentialStore +schema: 2.0.0 +--- + +# New-CSCertAttribute + +## SYNOPSIS +Creates required data for a certificate signing request. + +## SYNTAX + +``` +New-CSCertAttribute [-Country] [-State] [-City] [-Organization] + [-OrganizationalUnitName] [-CommonName] [[-Days] ] [] +``` + +## DESCRIPTION +Defines the certificate related properties for an upcoming New-PfxCertificate execution. + +## EXAMPLES + +### BEISPIEL 1 +``` +New-CSCertAttribute -Country 'DE' -State 'BW' -City 'Karlsruhe' -Organization 'AwesomeIT' -OrganizationalUnitName '' -CommonName 'MyPrivateCert' +``` + +## PARAMETERS + +### -Country +County code like EN, DE, IT, FR... + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -State +Certificate state value. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -City +Certificate city value. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Organization +Certificate organization value. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 4 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OrganizationalUnitName +Certificate OrganizationalUnitName value. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 5 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CommonName +The certificate common name. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 6 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Days +{{ Fill Days Description }} + +```yaml +Type: Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: 7 +Default value: 365 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### [None] +## OUTPUTS + +### ['PSCredentialStore.Certificate.CSRDetails'] +## NOTES +- File Name : New-CSCertAttribute.ps1 +- Author : Marco Blessing - marco.blessing@googlemail.com +- Requires : + +## RELATED LINKS + +[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore) + diff --git a/docs/New-CSCertificate.md b/docs/New-CSCertificate.md new file mode 100644 index 0000000..6ad4f74 --- /dev/null +++ b/docs/New-CSCertificate.md @@ -0,0 +1,127 @@ +--- +external help file: PSCredentialStore-help.xml +Module Name: PSCredentialStore +online version: https://github.com/OCram85/PSCredentialStore +schema: 2.0.0 +--- + +# New-CSCertificate + +## SYNOPSIS +Creates a new PFX certificate for the CredentialStore encryption. + +## SYNTAX + +``` +New-CSCertificate [-CRTAttribute] [[-KeyName] ] [[-CertName] ] [-WhatIf] [-Confirm] + [] +``` + +## DESCRIPTION +Use this function to create a custom self signed certificate used by the PSCredentialStore module. + +## EXAMPLES + +### BEISPIEL 1 +``` +New-CSCertificate -CRTAttribute $CRTAttribute -KeyName './myprivate.key' -CertName './mycert.pfx' +``` + +## PARAMETERS + +### -CRTAttribute +Provide certificate related attributes provided by function New-CRTAttribute. + +```yaml +Type: Object +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -KeyName +Provide a custom full path and name for the private key. +The file extension has to be \`*.key\`. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: ./private.key +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CertName +Provide a custom full path and name for the PFX certificate file. +The file extension has to be \`*.pfx\` + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: ./certificate.pfx +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### [PSCredentialStore.Certificate.Attribute] +## OUTPUTS + +### [None] +## NOTES +- File Name : New-CSCertificate.ps1 +- Author : Marco Blessing - marco.blessing@googlemail.com +- Requires : + +## RELATED LINKS + +[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore) + diff --git a/docs/New-CredentialStore.md b/docs/New-CredentialStore.md new file mode 100644 index 0000000..e8e5b7a --- /dev/null +++ b/docs/New-CredentialStore.md @@ -0,0 +1,113 @@ +--- +external help file: PSCredentialStore-help.xml +Module Name: PSCredentialStore +online version: https://github.com/OCram85/PSCredentialStore +schema: 2.0.0 +--- + +# Import-CSPfxCertificate + +## SYNOPSIS +Adds a given pfx certificate file to current user's personal certificate store. + +## SYNTAX + +``` +Import-CSPfxCertificate [-Path] [[-StoreName] ] [[-StoreLocation] ] + [[-OpenFlags] ] [] +``` + +## DESCRIPTION +This function is used to import existing pfx certificate files. +The Import-PFXCertificate cmdlet from the +PKI module imports the certificate into a deprecated store. +Thus you can't read the private key afterwards or +using it for decrypting data. + +## EXAMPLES + +### BEISPIEL 1 +``` +Import-CSPfxCertificate -Path (Join-Path -Path $Env:APPDATA -ChildPath '/PSCredentialStore.pfx') +``` + +## PARAMETERS + +### -Path +Path to an existing *.pfx certificate file. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StoreName +Additionally you change change the store where you want the certificate into. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: My +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StoreLocation +{{ Fill StoreLocation Description }} + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: CurrentUser +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -OpenFlags +{{ Fill OpenFlags Description }} + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 4 +Default value: ReadWrite +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### [None] +## OUTPUTS + +### [None] +## NOTES +File Name : Import-CSPfxCertificate.ps1 +Author : Marco Blessing - marco.blessing@googlemail.com +Requires : + +## RELATED LINKS + +[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore) + diff --git a/docs/New-CredentialStoreItem.md b/docs/New-CredentialStoreItem.md new file mode 100644 index 0000000..4bd392b --- /dev/null +++ b/docs/New-CredentialStoreItem.md @@ -0,0 +1,138 @@ +--- +external help file: PSCredentialStore-help.xml +Module Name: PSCredentialStore +online version: https://github.com/OCram85/PSCredentialStore +schema: 2.0.0 +--- + +# New-CredentialStoreItem + +## SYNOPSIS +Adds a credential store item containing host, user and password to the given store. + +## SYNTAX + +### Private (Default) +``` +New-CredentialStoreItem -RemoteHost [-Identifier ] [-Credential ] + [] +``` + +### Shared +``` +New-CredentialStoreItem -RemoteHost [-Identifier ] [-Credential ] [-Shared] + [-Path ] [] +``` + +## DESCRIPTION +The credentials are stored without any relations to it's further use. +If you need to change an existing +item please use Set-CredentialStoreItem. +You need to decide afterwards, whether to use the credential for +a VIConnection, NetApp FAS or UCS Fabric Interconnect. + +## EXAMPLES + +### BEISPIEL 1 +``` +New-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.local" +``` + +## PARAMETERS + +### -RemoteHost +The identifier or rather name for the given credentials. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Identifier +Provide a custom identifier to the given remote host key. +This enables you to store multiple credentials +for a single remote host entry. +For example ad/sys1, ftp/sys1, mssql/sys1 + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Credential +You can provide credentials optionally as pre existing pscredential object. + +```yaml +Type: PSCredential +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Shared +{{ Fill Shared Description }} + +```yaml +Type: SwitchParameter +Parameter Sets: Shared +Aliases: + +Required: True +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Path +Define the store in which you would like to add a new item. + +```yaml +Type: String +Parameter Sets: Shared +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### [None] +## OUTPUTS + +### [None] +## NOTES +- File Name : New-CredentialStoreItem.ps1 +- Author : Marco Blessing - marco.blessing@googlemail.com +- Requires : + +## RELATED LINKS + +[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore) + diff --git a/docs/PSCredentialStore.md b/docs/PSCredentialStore.md new file mode 100644 index 0000000..efe12ed --- /dev/null +++ b/docs/PSCredentialStore.md @@ -0,0 +1,73 @@ +--- +Module Name: PSCredentialStore +Module Guid: 6800e192-9df8-4e30-b253-eb2c799bbe84 6800e192-9df8-4e30-b253-eb2c799bbe84 +Download Help Link: {{ Update Download Link }} +Help Version: {{ Please enter version of help manually (X.X.X.X) format }} +Locale: en-US +--- + +# PSCredentialStore Module +## Description +[about_PSCredentialStore](about_PSCredentialStore.md) + +## PSCredentialStore Cmdlets +### [Connect-To](Connect-To.md) +Connects to the given host using the stored CredentialStoreItem. + +### [Disconnect-From](Disconnect-From.md) +Terminates a session established with Connect-To using a CredentialStoreItem. + +### [Get-CredentialStore](Get-CredentialStore.md) +Reads the complete content of the credential store and returns it as a new object. + +### [Get-CredentialStoreItem](Get-CredentialStoreItem.md) +Returns the Credential from a given remote host item. + +### [Get-CSCertificate](Get-CSCertificate.md) +Returns the current used valid PfX certificate. + +### [Get-CSPfxCertificate](Get-CSPfxCertificate.md) +Returns the certificate object given by thumbprint. + +### [Import-CSCertificate](Import-CSCertificate.md) +Imports a linked certificate to the valid store location. + +### [Import-CSPfxCertificate](Import-CSPfxCertificate.md) +Adds a given pfx certificate file to current user's personal certificate store. + +### [Import-CSPfxCertificate](Import-CSPfxCertificate.md) +Adds a given pfx certificate file to current user's personal certificate store. + +### [New-CredentialStoreItem](New-CredentialStoreItem.md) +Adds a credential store item containing host, user and password to the given store. + +### [New-CSCertAttribute](New-CSCertAttribute.md) +Creates required data for a certificate signing request. + +### [New-CSCertificate](New-CSCertificate.md) +Creates a new PFX certificate for the CredentialStore encryption. + +### [Remove-CredentialStoreItem](Remove-CredentialStoreItem.md) +Remove the given credentials from the credential store. + +### [Set-CredentialStoreItem](Set-CredentialStoreItem.md) +Changes the credentials for the given remote host in the store. + +### [Test-CredentialStore](Test-CredentialStore.md) +Returns the credential store state. + +### [Test-CredentialStoreItem](Test-CredentialStoreItem.md) +Checks if the given RemoteHost identifier combination exists in the credential store. + +### [Test-CSCertificate](Test-CSCertificate.md) +Tests if the linked certificate is store ein the specified cert stores. + +### [Test-CSConnection](Test-CSConnection.md) +Returns the connection state of a given type to the remote host. + +### [Test-CSPfxCertificate](Test-CSPfxCertificate.md) +Tests if the given certificate exists in a store. + +### [Use-CSCertificate](Use-CSCertificate.md) +Links an existing PFX Certificate to a CredentialStore. + diff --git a/docs/Remove-CredentialStoreItem.md b/docs/Remove-CredentialStoreItem.md new file mode 100644 index 0000000..eb18813 --- /dev/null +++ b/docs/Remove-CredentialStoreItem.md @@ -0,0 +1,134 @@ +--- +external help file: PSCredentialStore-help.xml +Module Name: PSCredentialStore +online version: https://github.com/OCram85/PSCredentialStore +schema: 2.0.0 +--- + +# Remove-CredentialStoreItem + +## SYNOPSIS +Remove the given credentials from the credential store. + +## SYNTAX + +### Private (Default) +``` +Remove-CredentialStoreItem -RemoteHost [-Identifier ] [] +``` + +### Shared +``` +Remove-CredentialStoreItem -RemoteHost [-Identifier ] [-Shared] [-Path ] + [] +``` + +## DESCRIPTION +Use this CMDLet to completely remove an credential store item. + +## EXAMPLES + +### BEISPIEL 1 +``` +Remove-CredentialStoreItem -RemoteHost "esx01.myside.local" +``` + +### BEISPIEL 2 +``` +Remove-CredentialStoreItem -Shared -RemoteHost "esx01.myside.local" +``` + +### BEISPIEL 3 +``` +Remove-CredentialStoreItem -Shared -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.local" +``` + +### BEISPIEL 4 +``` +Remove-CredentialStoreItem -RemoteHost "esx01.myside.local" -Identifier svc +``` + +## PARAMETERS + +### -RemoteHost +Specify the host you for which you would like to change the credentials. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Identifier +Defaults to "". +Specify a string, which separates two CredentialStoreItems for the +same hostname. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Shared +Switch to shared mode with this param. +This enforces the command to work with a shared CredentialStore which +can be decrypted across systems. + +```yaml +Type: SwitchParameter +Parameter Sets: Shared +Aliases: + +Required: True +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Path +Define the store in which your given host entry already exists. + +```yaml +Type: String +Parameter Sets: Shared +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### [None] +## OUTPUTS + +### [None] +## NOTES +- File Name : Remove-CredentialStoreItem.ps1 +- Author : Marco Blessing - marco.blessing@googlemail.com +- Requires : + +## RELATED LINKS + +[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore) + diff --git a/docs/Set-CredentialStoreItem.md b/docs/Set-CredentialStoreItem.md new file mode 100644 index 0000000..0ccd012 --- /dev/null +++ b/docs/Set-CredentialStoreItem.md @@ -0,0 +1,137 @@ +--- +external help file: PSCredentialStore-help.xml +Module Name: PSCredentialStore +online version: https://github.com/OCram85/PSCredentialStore +schema: 2.0.0 +--- + +# Set-CredentialStoreItem + +## SYNOPSIS +Changes the credentials for the given remote host in the store. + +## SYNTAX + +### Private (Default) +``` +Set-CredentialStoreItem -RemoteHost [-Identifier ] [-Credential ] + [] +``` + +### Shared +``` +Set-CredentialStoreItem -RemoteHost [-Identifier ] [-Credential ] [-Shared] + [-Path ] [] +``` + +## DESCRIPTION +{{ Fill in the Description }} + +## EXAMPLES + +### BEISPIEL 1 +``` +Set-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.local" +``` + +Set-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.local" -Identifier svc + +## PARAMETERS + +### -RemoteHost +Specify the host you for which you would like to change the credentials. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Identifier +Defaults to "". +Specify a string, which separates two CredentialStoreItems for the +same hostname. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Credential +{{ Fill Credential Description }} + +```yaml +Type: PSCredential +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Shared +Switch to shared mode with this param. +This enforces the command to work with a shared CredentialStore which +can be decrypted across systems. + +```yaml +Type: SwitchParameter +Parameter Sets: Shared +Aliases: + +Required: True +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Path +Define the store in which your given host entry already exists. + +```yaml +Type: String +Parameter Sets: Shared +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### [None] +## OUTPUTS + +### [None] +## NOTES +- File Name : Set-CredentialStoreItem.ps1 +- Author : Marco Blessing - marco.blessing@googlemail.com +- Requires : + +## RELATED LINKS + +[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore) + diff --git a/docs/Test-CSCertificate.md b/docs/Test-CSCertificate.md new file mode 100644 index 0000000..4cc3507 --- /dev/null +++ b/docs/Test-CSCertificate.md @@ -0,0 +1,63 @@ +--- +external help file: PSCredentialStore-help.xml +Module Name: PSCredentialStore +online version: https://github.com/OCram85/PSCredentialStore +schema: 2.0.0 +--- + +# Test-CSCertificate + +## SYNOPSIS +Tests if the linked certificate is store ein the specified cert stores. + +## SYNTAX + +``` +Test-CSCertificate [-Type] [] +``` + +## DESCRIPTION +Test-CSCertificate should be an easy high level test for the linked certificate. + +## EXAMPLES + +### BEISPIEL 1 +``` +Test-CSCertificate -Type 'Shared' +``` + +## PARAMETERS + +### -Type +Select between 'Private' or 'Shared'. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### [None] +## OUTPUTS + +### [bool] +## NOTES +- File Name : Test-CSCertificate.ps1 +- Author : Marco Blessing - marco.blessing@googlemail.com +- Requires : + +## RELATED LINKS + +[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore) + diff --git a/docs/Test-CSConnection.md b/docs/Test-CSConnection.md new file mode 100644 index 0000000..4eae574 --- /dev/null +++ b/docs/Test-CSConnection.md @@ -0,0 +1,80 @@ +--- +external help file: PSCredentialStore-help.xml +Module Name: PSCredentialStore +online version: https://github.com/OCram85/PSCredentialStore +schema: 2.0.0 +--- + +# Test-CSConnection + +## SYNOPSIS +Returns the connection state of a given type to the remote host. + +## SYNTAX + +``` +Test-CSConnection [-RemoteHost] [-Type] [] +``` + +## DESCRIPTION +Use this script to check a connection which was established with the \`Connect-To\` cmdlet. + +## EXAMPLES + +### BEISPIEL 1 +``` +Test-CMConnection -RemoteHost "vcr01.internal.net" -Type VMware +``` + +## PARAMETERS + +### -RemoteHost +Define the remote host you would like to check. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Type +Define the connection type you would like to check. +See the \`Connect-To\` documentation +for valid type values. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### [None] +## OUTPUTS + +### [bool] +## NOTES +- File Name : Test-CSConnection.ps1 +- Author : Marco Blessing - marco.blessing@googlemail.com +- Requires : + +## RELATED LINKS + +[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore) + diff --git a/docs/Test-CSPfxCertificate.md b/docs/Test-CSPfxCertificate.md new file mode 100644 index 0000000..2f61c90 --- /dev/null +++ b/docs/Test-CSPfxCertificate.md @@ -0,0 +1,94 @@ +--- +external help file: PSCredentialStore-help.xml +Module Name: PSCredentialStore +online version: https://github.com/OCram85/PSCredentialStore +schema: 2.0.0 +--- + +# Test-CSPfxCertificate + +## SYNOPSIS +Tests if the given certificate exists in a store. + +## SYNTAX + +``` +Test-CSPfxCertificate [-Thumbprint] [[-StoreName] ] [[-StoreLocation] ] + [] +``` + +## DESCRIPTION +Use this function to ensure if a certificate is already imported into a given store. + +## EXAMPLES + +### BEISPIEL 1 +``` +Test-CSPfxCertificate -Thumbprint '12345678' -StoreName 'My' -StoreLocation 'CurrentUser' +``` + +## PARAMETERS + +### -Thumbprint +Provide one or more thumbprints. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -StoreName +Select the store name in which you want to search the certificates. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: My +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StoreLocation +Select between the both available locations CurrentUser odr LocalMachine. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: CurrentUser +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### [None] +## OUTPUTS + +### [bool] +## NOTES +File Name : Test-CSPfxCertificate.ps1 +Author : Marco Blessing - marco.blessing@googlemail.com +Requires : + +## RELATED LINKS + +[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore) + diff --git a/docs/Test-CredentialStore.md b/docs/Test-CredentialStore.md new file mode 100644 index 0000000..5352e56 --- /dev/null +++ b/docs/Test-CredentialStore.md @@ -0,0 +1,88 @@ +--- +external help file: PSCredentialStore-help.xml +Module Name: PSCredentialStore +online version: https://github.com/OCram85/PSCredentialStore +schema: 2.0.0 +--- + +# Test-CredentialStore + +## SYNOPSIS +Returns the credential store state. + +## SYNTAX + +### Private (Default) +``` +Test-CredentialStore [] +``` + +### Shared +``` +Test-CredentialStore [-Path ] [-Shared] [] +``` + +## DESCRIPTION +Use this script to test your credential store. +For now it only checks if +the file exists. + +## EXAMPLES + +### Example 1 +```powershell +PS C:> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -Path +Define a custom path to a shared CredentialStore. + +```yaml +Type: String +Parameter Sets: Shared +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Shared +Switch to shared mode with this param. +This enforces the command to work with a shared CredentialStore which +can be decrypted across systems. + +```yaml +Type: SwitchParameter +Parameter Sets: Shared +Aliases: + +Required: True +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES +- File Name : Test-CredentialStore.ps1 +- Author : Marco Blessing - marco.blessing@googlemail.com +- Requires : + +## RELATED LINKS + +[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore) + diff --git a/docs/Test-CredentialStoreItem.md b/docs/Test-CredentialStoreItem.md new file mode 100644 index 0000000..0bb078c --- /dev/null +++ b/docs/Test-CredentialStoreItem.md @@ -0,0 +1,129 @@ +--- +external help file: PSCredentialStore-help.xml +Module Name: PSCredentialStore +online version: https://github.com/OCram85/PSCredentialStore +schema: 2.0.0 +--- + +# Test-CredentialStoreItem + +## SYNOPSIS +Checks if the given RemoteHost identifier combination exists in the credential store. + +## SYNTAX + +### Private (Default) +``` +Test-CredentialStoreItem -RemoteHost [-Identifier ] [] +``` + +### Shared +``` +Test-CredentialStoreItem [-Path ] -RemoteHost [-Identifier ] [-Shared] + [] +``` + +## DESCRIPTION +Use this cmdlet for basic checks with a single item. +Check the item first with this function before +you try to interact with it. + +## EXAMPLES + +### BEISPIEL 1 +``` +If (Test-CredentialStoreItem -RemoteHost "Default") { +``` + +Get-CredentialStoreItem -RemoteHost "Default" +} +Else { + Write-Warning ("The given Remote Host {0} does not exist in the credential Store!" -f $RemoteHost) +} + +## PARAMETERS + +### -Path +Define a custom credential store you try to read from. +Without the \`-Path\` parameter +\`Test-CredentialStoreItem\` tries to read from the default private store. + +```yaml +Type: String +Parameter Sets: Shared +Aliases: + +Required: False +Position: Named +Default value: "{0}\PSCredentialStore\CredentialStore.json" -f $env:ProgramData +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RemoteHost +Specify the host, for which you would like to change the credentials. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Identifier +Adds an optional identifier to the given RemoteHost. +Makes it possible to store multiple credentials +for a single host. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Shared +Switch to shared mode with this param. +This enforces the command to work with a shared CredentialStore which +can be decrypted across systems. + +```yaml +Type: SwitchParameter +Parameter Sets: Shared +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### [None] +## OUTPUTS + +### [None] +## NOTES +- File Name : Test-CredentialStoreItem.ps1 +- Author : Marco Blessing - marco.blessing@googlemail.com +- Requires : + +## RELATED LINKS + +[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore) + diff --git a/docs/Use-CSCertificate.md b/docs/Use-CSCertificate.md new file mode 100644 index 0000000..e48a0b2 --- /dev/null +++ b/docs/Use-CSCertificate.md @@ -0,0 +1,114 @@ +--- +external help file: PSCredentialStore-help.xml +Module Name: PSCredentialStore +online version: https://github.com/OCram85/PSCredentialStore +schema: 2.0.0 +--- + +# Use-CSCertificate + +## SYNOPSIS +Links an existing PFX Certificate to a CredentialStore. + +## SYNTAX + +### Private (Default) +``` +Use-CSCertificate -Path [-UseCertStore] [] +``` + +### Shared +``` +Use-CSCertificate -Path [-CredentialStore ] [-Shared] [-UseCertStore] [] +``` + +## DESCRIPTION +Linking a certificate is needed if you plan to use the same CredentialStore in cross platform scenarios. + +## EXAMPLES + +### BEISPIEL 1 +``` +Use-CSCertificate -Path 'C:\cert.pfx' +``` + +## PARAMETERS + +### -Path +Specify the path to the PFX Certificate you want to link for usage. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CredentialStore +Specify a custom path for a shared credential store. + +```yaml +Type: String +Parameter Sets: Shared +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Shared +Use the credential store in shared mode. + +```yaml +Type: SwitchParameter +Parameter Sets: Shared +Aliases: + +Required: True +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UseCertStore +{{ Fill UseCertStore Description }} + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### [None] +## OUTPUTS + +### [None] +## NOTES +File Name : Use-CSCertificate.ps1 +Author : Marco Blessing - marco.blessing@googlemail.com +Requires : + +## RELATED LINKS + +[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore) + diff --git a/docs/about_PSCredentialStore.md b/docs/about_PSCredentialStore.md new file mode 100644 index 0000000..726bf1b --- /dev/null +++ b/docs/about_PSCredentialStore.md @@ -0,0 +1,102 @@ +# PSCredentialStore +## about_PSCredentialStore + + +# SHORT DESCRIPTION +PSCredentialStore enables managing multiple PSCredential objects. + + +# LONG DESCRIPTION +The PSCredentialStore is an simple credential manager for PSCredentials. It stores multiple credential objects in a +simple json file. You can choose between a private and shared store. The private one exists in your profile and can +ony accessed by your account on the same machine. The shared store enables you to use different credentials for your +script without exposing them as plain text. + +**The shared store isn't 100% secure and I don't recommend using it in production!** + +PSCredentialStore was developed to simplify the delegation of complex powershell scripts. In this case you often +need to store credentials for non interactive usage like in scheduled tasks. + +To get started read the [about_PSCredentialStore](/src/en-US/about_PSCredential.help.txt) page. + + +## Installation + +## PowerShellGallery.com (Recommended Way) + +* Make sure you use PowerShell 4.0 or higher with `$PSVersionTable`. +* Use the builtin PackageManagement and install with: `Install-Module PSCredentialStore` +* Done. Start exploring the Module with `Import-Module PSCredentialStore ; Get-Command -Module PSCredentialStore` + +## Manual Way + +* Take a look at the [Latest Release](https://github.com/OCram85/PSCredentialStore/releases/latest) page. +* Download the `PSCredentialStore.zip`. +* Unpack the Zip and put it in your Powershell Module path. + * Don't forget to change the NTFS permission flag in the context menu. +* Start with `Import-Module PSCredentialStore` + +**1.** First we need a blank CredentialStore. You can decide between a *private* or *shared* store. The private +Credential Store can only be accessed with your profile on the machine you created it. +```powershell +# Private Credential Store +New-CredentialStore + +# Shared Credential Store +New-CredentialStore -Shared + +#Shared CredentialStore in custom Location +New-CredentialStore -Shared -Path 'C:\CredentialStore.json' +``` + +**2.** Now you can manage your CredentialStoreItems: +```powershell +# This will prompt for credentials and stores it in a private store +New-CredentialStoreItem -RemoteHost 'dc01.myside.local' -Identifier 'AD' + +# You can now use it in other scripts like this: +$DCCreds = Get-CredentialStoreItem -RemoteHost 'dc01.myside.local' -Identifier 'AD' +Invoke-Command -ComputerName 'dc01.myside.local' -Credential $DCCreds -ScripBlock {Get-Process} +``` + +The CredentialStore contains also a simple function to establish a connection with several systems or protocols. +If you have already installed the underlying framework your can connect to: + +* **CiscoUcs** - Establish a connection to a Cisco UCS fabric interconnect. + * Required Modules: [`Cisco.UCS.Core`, `Cisco.UCSManager`](https://software.cisco.com/download/release.html?i=!y&mdfid=286305108&softwareid=284574017&release=2.1.1) +* **FTP** - Establish a connection to a FTP host. + * Required Modules: [`WinSCP`](https://www.powershellgallery.com/packages/WinSCP) +* **NetAppFAS** - Establish a connection to a NetApp Clustered ONTAP filer. + * Required Modules: [`DataONTAP`](http://mysupport.netapp.com/tools/info/ECMLP2310788I.html?productID=61926) +* **VMware** - Establish a connection to a VMware vCenter or ESXi host. + * Required Modules: [`VMware.VimAutomation.Core`](https://www.powershellgallery.com/packages/VMware.PowerCLI) +* **CisServer** - Establish a connection to the CisServer Service on vCenter Host. + * Required Modules: [`VMware.VimAutomation.Cis.Core`](https://www.powershellgallery.com/packages/VMware.PowerCLI)) +* **ExchangeHTTP** - Establish a remote connection with an Exchange endpoint via http. + * Requires PowerShell remoting +* **ExchangeHTTPS** - Establish a remote connection with an Exchange endpoint via https. + * Requires PowerShell remoting +* **SCP** - Establish a SCP connection. + * Required Modules: [`WinSCP`](https://www.powershellgallery.com/packages/WinSCP) +# EXAMPLES + +```powershell +Connect-To -RemoteHost "ucs.myside.local" -Type CiscoUcs +Connect-To -RemoteHost "ftp.myside.local" -Type FTP +Connect-To -RemoteHost "fas.myside.local" -Type NetAppFAS +Connect-To -RemoteHost "esx01.myside.local" -Type VMware +Connect-To -RemoteHost "vcr.myside.local" -Type CisServer +``` +# NOTE + + +# TROUBLESHOOTING NOTE + + +# SEE ALSO + + +# KEYWORDS + +- Credential +- Store -- 2.40.1 From 7a03ba5f33d54fc76309e8321b3bcc2a7fac7dd5 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Mon, 8 Apr 2019 14:53:58 +0200 Subject: [PATCH 17/31] move .net wrapper forpfx files --- src/{Certificate => PfxCertificate}/Get-CSPfxCertificate.ps1 | 0 src/{Certificate => PfxCertificate}/Import-CSPfxCertificate.ps1 | 0 src/{Certificate => PfxCertificate}/Test-CSPfxCertificate.ps1 | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename src/{Certificate => PfxCertificate}/Get-CSPfxCertificate.ps1 (100%) rename src/{Certificate => PfxCertificate}/Import-CSPfxCertificate.ps1 (100%) rename src/{Certificate => PfxCertificate}/Test-CSPfxCertificate.ps1 (100%) diff --git a/src/Certificate/Get-CSPfxCertificate.ps1 b/src/PfxCertificate/Get-CSPfxCertificate.ps1 similarity index 100% rename from src/Certificate/Get-CSPfxCertificate.ps1 rename to src/PfxCertificate/Get-CSPfxCertificate.ps1 diff --git a/src/Certificate/Import-CSPfxCertificate.ps1 b/src/PfxCertificate/Import-CSPfxCertificate.ps1 similarity index 100% rename from src/Certificate/Import-CSPfxCertificate.ps1 rename to src/PfxCertificate/Import-CSPfxCertificate.ps1 diff --git a/src/Certificate/Test-CSPfxCertificate.ps1 b/src/PfxCertificate/Test-CSPfxCertificate.ps1 similarity index 100% rename from src/Certificate/Test-CSPfxCertificate.ps1 rename to src/PfxCertificate/Test-CSPfxCertificate.ps1 -- 2.40.1 From cdd5a8d451d0affc0968acfdef8830e535bb4647 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Mon, 8 Apr 2019 14:54:14 +0200 Subject: [PATCH 18/31] do not export .net wrapper functions --- src/PSCredentialStore.psd1 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/PSCredentialStore.psd1 b/src/PSCredentialStore.psd1 index 30308f1..8103507 100644 --- a/src/PSCredentialStore.psd1 +++ b/src/PSCredentialStore.psd1 @@ -64,14 +64,15 @@ FunctionsToExport = @( # Certificate 'Get-CSCertificate', - 'Get-CSPfxCertificate', 'Import-CSCertificate', - 'Import-CSPfxCertificate', 'New-CSCertAttribute', 'New-CSCertificate', 'Test-CSCertificate', - 'Test-CSPfxCertificate', 'Use-CSCertificate', + # Pfx Certificate + # 'Get-CSPfxCertificate', + # 'Import-CSPfxCertificate', + # 'Test-CSPfxCertificate', # Connection 'Connect-To', 'Disconnect-From', -- 2.40.1 From ff00144ce1c4af01c4d91c39d8836defdeec93de Mon Sep 17 00:00:00 2001 From: OCram85 Date: Mon, 8 Apr 2019 15:25:08 +0200 Subject: [PATCH 19/31] update docs --- README.md | 33 +++-- docs/Connect-To.md | 99 ++++++------- docs/Disconnect-From.md | 37 ++--- docs/Get-CSCertificate.md | 37 ++--- docs/Get-CSPfxCertificate.md | 95 ------------- docs/Get-CredentialStore.md | 7 - docs/Get-CredentialStoreItem.md | 67 ++++----- docs/Import-CSCertificate.md | 37 ++--- docs/Import-CSPfxCertificate.md | 113 --------------- docs/New-CSCertAttribute.md | 85 +++++------ docs/New-CSCertificate.md | 51 +++---- docs/New-CredentialStore.md | 174 +++++++++++++++++------ docs/New-CredentialStoreItem.md | 57 ++++---- docs/PSCredentialStore.md | 21 +-- docs/Remove-CredentialStoreItem.md | 67 ++++----- docs/Set-CredentialStoreItem.md | 57 ++++---- docs/Test-CSCertificate.md | 7 - docs/Test-CSConnection.md | 7 - docs/Test-CSPfxCertificate.md | 94 ------------ docs/Test-CredentialStore.md | 7 - docs/Test-CredentialStoreItem.md | 41 +++--- docs/Use-CSCertificate.md | 37 ++--- docs/about_PSCredentialStore.md | 37 +++-- src/Certificate/Import-CSCertificate.ps1 | 6 +- src/Certificate/New-CSCertAttribute.ps1 | 7 +- src/Certificate/Use-CSCertificate.ps1 | 2 +- src/Connection/Connect-To.ps1 | 3 + src/Item/New-CredentialStoreItem.ps1 | 4 + src/Item/Set-CredentialStoreItem.ps1 | 6 + src/Store/New-CredentialStore.ps1 | 9 ++ src/Store/Test-CredentialStore.ps1 | 3 + 31 files changed, 504 insertions(+), 803 deletions(-) delete mode 100644 docs/Get-CSPfxCertificate.md delete mode 100644 docs/Import-CSPfxCertificate.md delete mode 100644 docs/Test-CSPfxCertificate.md diff --git a/README.md b/README.md index dfb10b7..113a127 100644 --- a/README.md +++ b/README.md @@ -10,31 +10,25 @@ General ======= -The PSCredentialStore is a simple credential manager for PSCredentials. It stores PSCredentials in a simple json +The PSCredentialStore is a simple credential manager for `PSCredential` objects. It stores PSCredentials in a simple json file. You can choose between a private and shared credential store. The private one exists in your profile and can ony accessed by your account on the same machine. The shared store enables you to use different credentials for your scripts without exposing them as plain text. -**The shared store isn't 100% secure and I don't recommend using it in production!** - PSCredentialStore was developed to simplify the delegation of complex powershell scripts. In this case you often need to store credentials for non interactive usage like in scheduled tasks. +Starting with version `1.0.0` PSCredential uses Pfx certificates fo encryption. You can use Pfx certification files +or certificates stored in the certification store. + For more details read the [about_PSCredentialStore](/docs/about_PSCredentialStore.md) page on github or via CLI with `Get-Help about_PSCredentialStore`. -:exclamation: Upcoming Changes :exclamation: -================ +Requirements +============ -The will be some breaking changes starting with the `0.5.0.xxx`: - -- **PSCredentialStore will use PFX certificates to encrypt your credentials.** - - This replaces the the current encryption methods and you need to recreate or upgrade your pre existing stores. -- The changes allows the PSCredentialStore module to support the PowerShell `Core` editions. - - Yes this means, you can use the module on any PowerShell 6 supported linux distribution. -- It's also possible to create a shared credential store and transfer it onto a another platform like: -`Windows -- to --> Linux` and vice versa. -- Automatically creates self signed certificate with 2048 bits RSA keys for encryption. +- PowerShell >= `5.1` +- .NET Framework >= `4.6` or .NET Core >= `1.0` Installation ============ @@ -61,10 +55,18 @@ Quick Start **1.** First we need a blank credential store. You can decide between a *private* or *shared* store. The private Credential Store can only be accessed with your profile on the machine you created it. + +Starting with version `1.0.0` you can decide the storage type of your fresh created certificate. As default +PSCredentialStore creates a new pfx certificate file beside the credential store itself. Optionally you can provide +the parameter `-UseCertStore`. This imports the new certificate in the user or machine certification store as well. + ```powershell # Private credential store New-CredentialStore +# Private credential store with certification store usage +New-CredentialStore -UseCertStore + # Shared credential rtore New-CredentialStore -Shared @@ -110,6 +112,9 @@ Connect-To -RemoteHost "ftp.myside.local" -Type FTP Connect-To -RemoteHost "fas.myside.local" -Type NetAppFAS Connect-To -RemoteHost "esx01.myside.local" -Type VMware Connect-To -RemoteHost "vcr.myside.local" -Type CisServer +Connect-To -RemoteHost "exchange1.myside.local" -Type ExchangeHTTP +Connect-To -RemoteHost "exchange1.myside.local" -Type ExchangeHTTPS +Connect-To -RemoteHost "ubuntu.myside.local" -Type SCP ``` Credits diff --git a/docs/Connect-To.md b/docs/Connect-To.md index ada01c3..523fe42 100644 --- a/docs/Connect-To.md +++ b/docs/Connect-To.md @@ -1,10 +1,3 @@ ---- -external help file: PSCredentialStore-help.xml -Module Name: PSCredentialStore -online version: https://github.com/OCram85/PSCredentialStore -schema: 2.0.0 ---- - # Connect-To ## SYNOPSIS @@ -66,15 +59,19 @@ Connect-To -RemoteHost "exchange01.myside.local" -Type ExchangeHTTPS ## PARAMETERS -### -RemoteHost -Specify the host, for which you would like to change the credentials. +### -Credentials +Use this parameter to bypass the stored credentials. +Without this parameter Connect-To tries to read the +needed credentials from the CredentialStore. +If you provide this parameter you skip this lookup behavior. +So you can use it to enable credentials without preparing any user interaction. ```yaml -Type: String +Type: PSCredential Parameter Sets: (All) Aliases: -Required: True +Required: False Position: Named Default value: None Accept pipeline input: False @@ -98,10 +95,38 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Type -Specify the host type of the target. -Currently implemented targets are: Possible connection values are: -CiscoUcs, FTP, NetAppFAS, VMware, CisServer, ExchangeHTTP, ExchangeHTTPS, SCP. +### -PassThru +Returns the value from the underlying connection type function. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Path +Define a custom path to a shared CredentialStore. + +```yaml +Type: String +Parameter Sets: Shared +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RemoteHost +Specify the host, for which you would like to change the credentials. ```yaml Type: String @@ -115,25 +140,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Credentials -Use this parameter to bypass the stored credentials. -Without this parameter Connect-To tries to read the -needed credentials from the CredentialStore. -If you provide this parameter you skip this lookup behavior. -So you can use it to enable credentials without preparing any user interaction. - -```yaml -Type: PSCredential -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -Shared Switch to shared mode with this param. This enforces the command to work with a shared CredentialStore which @@ -151,32 +157,19 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Path -Define a custom path to a shared CredentialStore. +### -Type +Specify the host type of the target. +Currently implemented targets are: Possible connection values are: +CiscoUcs, FTP, NetAppFAS, VMware, CisServer, ExchangeHTTP, ExchangeHTTPS, SCP. ```yaml Type: String -Parameter Sets: Shared -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -PassThru -{{ Fill PassThru Description }} - -```yaml -Type: SwitchParameter Parameter Sets: (All) Aliases: -Required: False +Required: True Position: Named -Default value: False +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` diff --git a/docs/Disconnect-From.md b/docs/Disconnect-From.md index ea84902..5bc96c4 100644 --- a/docs/Disconnect-From.md +++ b/docs/Disconnect-From.md @@ -1,10 +1,3 @@ ---- -external help file: PSCredentialStore-help.xml -Module Name: PSCredentialStore -online version: https://github.com/OCram85/PSCredentialStore -schema: 2.0.0 ---- - # Disconnect-From ## SYNOPSIS @@ -63,6 +56,21 @@ Disconnect-From -RemoteHost "exchange01.myside.local" -Type ExchangeHTTPS ## PARAMETERS +### -Force +Force the disconnect, even if the disconnect would fail. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -RemoteHost Specify the remote endpoint, whose session you would like to terminate. @@ -95,21 +103,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Force -Force the disconnect, even if the disconnect would fail. - -```yaml -Type: SwitchParameter -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: False -Accept pipeline input: False -Accept wildcard characters: False -``` - ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/docs/Get-CSCertificate.md b/docs/Get-CSCertificate.md index 556aeea..6231e51 100644 --- a/docs/Get-CSCertificate.md +++ b/docs/Get-CSCertificate.md @@ -1,10 +1,3 @@ ---- -external help file: PSCredentialStore-help.xml -Module Name: PSCredentialStore -online version: https://github.com/OCram85/PSCredentialStore -schema: 2.0.0 ---- - # Get-CSCertificate ## SYNOPSIS @@ -28,21 +21,6 @@ Get-CSCertificate -Type 'Shared' -Thumbprint '12334456' ## PARAMETERS -### -Type -Select the current credential store type. - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: True -Position: 1 -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -Thumbprint Provide the credentials thumbprint for the search. @@ -58,6 +36,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -Type +Select the current credential store type. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/docs/Get-CSPfxCertificate.md b/docs/Get-CSPfxCertificate.md deleted file mode 100644 index 8fd546c..0000000 --- a/docs/Get-CSPfxCertificate.md +++ /dev/null @@ -1,95 +0,0 @@ ---- -external help file: PSCredentialStore-help.xml -Module Name: PSCredentialStore -online version: https://github.com/OCram85/PSCredentialStore -schema: 2.0.0 ---- - -# Get-CSPfxCertificate - -## SYNOPSIS -Returns the certificate object given by thumbprint. - -## SYNTAX - -``` -Get-CSPfxCertificate [-Thumbprint] [[-StoreName] ] [[-StoreLocation] ] - [] -``` - -## DESCRIPTION -You can use this function to get a stored certificate. -Search for the object by its unique thumbprint. - -## EXAMPLES - -### BEISPIEL 1 -``` -Get-CSPfxCertificate -Thumbprint '12345678' -StoreName 'My' -StoreLocation 'CurrentUser' -``` - -## PARAMETERS - -### -Thumbprint -Provide one or more thumbprints. - -```yaml -Type: String[] -Parameter Sets: (All) -Aliases: - -Required: True -Position: 1 -Default value: None -Accept pipeline input: True (ByValue) -Accept wildcard characters: False -``` - -### -StoreName -Select the store name in which you want to search the certificates. - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: 2 -Default value: My -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -StoreLocation -Select between the both available locations CurrentUser odr LocalMachine. - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: 3 -Default value: CurrentUser -Accept pipeline input: False -Accept wildcard characters: False -``` - -### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### [string] -## OUTPUTS - -### [System.Security.Cryptography.X509Certificates.X509Certificate2[]] -## NOTES -- File Name : Get-CSPfxCertificate.ps1 -- Author : Marco Blessing - marco.blessing@googlemail.com -- Requires : - -## RELATED LINKS - -[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore) - diff --git a/docs/Get-CredentialStore.md b/docs/Get-CredentialStore.md index a164d71..4184077 100644 --- a/docs/Get-CredentialStore.md +++ b/docs/Get-CredentialStore.md @@ -1,10 +1,3 @@ ---- -external help file: PSCredentialStore-help.xml -Module Name: PSCredentialStore -online version: https://github.com/OCram85/PSCredentialStore -schema: 2.0.0 ---- - # Get-CredentialStore ## SYNOPSIS diff --git a/docs/Get-CredentialStoreItem.md b/docs/Get-CredentialStoreItem.md index 5e7f392..6600ad8 100644 --- a/docs/Get-CredentialStoreItem.md +++ b/docs/Get-CredentialStoreItem.md @@ -1,10 +1,3 @@ ---- -external help file: PSCredentialStore-help.xml -Module Name: PSCredentialStore -online version: https://github.com/OCram85/PSCredentialStore -schema: 2.0.0 ---- - # Get-CredentialStoreItem ## SYNOPSIS @@ -35,21 +28,6 @@ $myCreds = Get-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx0 ## PARAMETERS -### -RemoteHost -Specify the host, for which you would like to change the credentials. - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: True -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -Identifier Provide a custom identifier to the given remote host key. This enables you to store multiple credentials @@ -68,6 +46,36 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -Path +Define a custom path to a shared CredentialStore. + +```yaml +Type: String +Parameter Sets: Shared +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RemoteHost +Specify the host, for which you would like to change the credentials. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Shared Switch to shared mode with this param. This enforces the command to work with a shared CredentialStore which @@ -85,21 +93,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Path -Define a custom path to a shared CredentialStore. - -```yaml -Type: String -Parameter Sets: Shared -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/docs/Import-CSCertificate.md b/docs/Import-CSCertificate.md index c28de0b..235afff 100644 --- a/docs/Import-CSCertificate.md +++ b/docs/Import-CSCertificate.md @@ -1,10 +1,3 @@ ---- -external help file: PSCredentialStore-help.xml -Module Name: PSCredentialStore -online version: https://github.com/OCram85/PSCredentialStore -schema: 2.0.0 ---- - # Import-CSCertificate ## SYNOPSIS @@ -29,21 +22,6 @@ private and shared credential stores. ## PARAMETERS -### -Type -Select between the a private and shared credential store. - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: True -Position: 1 -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -Path Provide a valid path to pfx certificate file. @@ -59,6 +37,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -Type +Select between the a private and shared credential store. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/docs/Import-CSPfxCertificate.md b/docs/Import-CSPfxCertificate.md deleted file mode 100644 index e8e5b7a..0000000 --- a/docs/Import-CSPfxCertificate.md +++ /dev/null @@ -1,113 +0,0 @@ ---- -external help file: PSCredentialStore-help.xml -Module Name: PSCredentialStore -online version: https://github.com/OCram85/PSCredentialStore -schema: 2.0.0 ---- - -# Import-CSPfxCertificate - -## SYNOPSIS -Adds a given pfx certificate file to current user's personal certificate store. - -## SYNTAX - -``` -Import-CSPfxCertificate [-Path] [[-StoreName] ] [[-StoreLocation] ] - [[-OpenFlags] ] [] -``` - -## DESCRIPTION -This function is used to import existing pfx certificate files. -The Import-PFXCertificate cmdlet from the -PKI module imports the certificate into a deprecated store. -Thus you can't read the private key afterwards or -using it for decrypting data. - -## EXAMPLES - -### BEISPIEL 1 -``` -Import-CSPfxCertificate -Path (Join-Path -Path $Env:APPDATA -ChildPath '/PSCredentialStore.pfx') -``` - -## PARAMETERS - -### -Path -Path to an existing *.pfx certificate file. - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: True -Position: 1 -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -StoreName -Additionally you change change the store where you want the certificate into. - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: 2 -Default value: My -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -StoreLocation -{{ Fill StoreLocation Description }} - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: 3 -Default value: CurrentUser -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -OpenFlags -{{ Fill OpenFlags Description }} - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: 4 -Default value: ReadWrite -Accept pipeline input: False -Accept wildcard characters: False -``` - -### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### [None] -## OUTPUTS - -### [None] -## NOTES -File Name : Import-CSPfxCertificate.ps1 -Author : Marco Blessing - marco.blessing@googlemail.com -Requires : - -## RELATED LINKS - -[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore) - diff --git a/docs/New-CSCertAttribute.md b/docs/New-CSCertAttribute.md index 3908b1a..770b9af 100644 --- a/docs/New-CSCertAttribute.md +++ b/docs/New-CSCertAttribute.md @@ -1,10 +1,3 @@ ---- -external help file: PSCredentialStore-help.xml -Module Name: PSCredentialStore -online version: https://github.com/OCram85/PSCredentialStore -schema: 2.0.0 ---- - # New-CSCertAttribute ## SYNOPSIS @@ -29,6 +22,36 @@ New-CSCertAttribute -Country 'DE' -State 'BW' -City 'Karlsruhe' -Organization 'A ## PARAMETERS +### -City +Certificate city value. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CommonName +The certificate common name. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 6 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Country County code like EN, DE, IT, FR... @@ -44,32 +67,17 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -State -Certificate state value. +### -Days +{{ Fill Days Description }} ```yaml -Type: String +Type: Int32 Parameter Sets: (All) Aliases: -Required: True -Position: 2 -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -City -Certificate city value. - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: True -Position: 3 -Default value: None +Required: False +Position: 7 +Default value: 365 Accept pipeline input: False Accept wildcard characters: False ``` @@ -104,8 +112,8 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -CommonName -The certificate common name. +### -State +Certificate state value. ```yaml Type: String @@ -113,27 +121,12 @@ Parameter Sets: (All) Aliases: Required: True -Position: 6 +Position: 2 Default value: None Accept pipeline input: False Accept wildcard characters: False ``` -### -Days -{{ Fill Days Description }} - -```yaml -Type: Int32 -Parameter Sets: (All) -Aliases: - -Required: False -Position: 7 -Default value: 365 -Accept pipeline input: False -Accept wildcard characters: False -``` - ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/docs/New-CSCertificate.md b/docs/New-CSCertificate.md index 6ad4f74..30677dd 100644 --- a/docs/New-CSCertificate.md +++ b/docs/New-CSCertificate.md @@ -1,10 +1,3 @@ ---- -external help file: PSCredentialStore-help.xml -Module Name: PSCredentialStore -online version: https://github.com/OCram85/PSCredentialStore -schema: 2.0.0 ---- - # New-CSCertificate ## SYNOPSIS @@ -29,6 +22,22 @@ New-CSCertificate -CRTAttribute $CRTAttribute -KeyName './myprivate.key' -CertNa ## PARAMETERS +### -CertName +Provide a custom full path and name for the PFX certificate file. +The file extension has to be \`*.pfx\` + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 3 +Default value: ./certificate.pfx +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -CRTAttribute Provide certificate related attributes provided by function New-CRTAttribute. @@ -60,18 +69,17 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -CertName -Provide a custom full path and name for the PFX certificate file. -The file extension has to be \`*.pfx\` +### -Confirm +Prompts you for confirmation before running the cmdlet. ```yaml -Type: String +Type: SwitchParameter Parameter Sets: (All) -Aliases: +Aliases: cf Required: False -Position: 3 -Default value: ./certificate.pfx +Position: Named +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` @@ -92,21 +100,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Confirm -Prompts you for confirmation before running the cmdlet. - -```yaml -Type: SwitchParameter -Parameter Sets: (All) -Aliases: cf - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/docs/New-CredentialStore.md b/docs/New-CredentialStore.md index e8e5b7a..ca191da 100644 --- a/docs/New-CredentialStore.md +++ b/docs/New-CredentialStore.md @@ -1,94 +1,181 @@ ---- -external help file: PSCredentialStore-help.xml -Module Name: PSCredentialStore -online version: https://github.com/OCram85/PSCredentialStore -schema: 2.0.0 ---- - -# Import-CSPfxCertificate +# New-CredentialStore ## SYNOPSIS -Adds a given pfx certificate file to current user's personal certificate store. +Creates a new credential store File ## SYNTAX +### Private (Default) ``` -Import-CSPfxCertificate [-Path] [[-StoreName] ] [[-StoreLocation] ] - [[-OpenFlags] ] [] +New-CredentialStore [-Force] [-PassThru] [-SkipPFXCertCreation] [-UseCertStore] [-WhatIf] [-Confirm] + [] +``` + +### Shared +``` +New-CredentialStore [-Shared] [-Path ] [-Force] [-PassThru] [-SkipPFXCertCreation] [-UseCertStore] + [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION -This function is used to import existing pfx certificate files. -The Import-PFXCertificate cmdlet from the -PKI module imports the certificate into a deprecated store. -Thus you can't read the private key afterwards or -using it for decrypting data. +You need to run this script first to create a new credential store before you try to +save new credentials with New-CredentialStoreItem. ## EXAMPLES ### BEISPIEL 1 ``` -Import-CSPfxCertificate -Path (Join-Path -Path $Env:APPDATA -ChildPath '/PSCredentialStore.pfx') +New-CredentialStore ``` +# Creates a new private CredentialStore + +### BEISPIEL 2 +``` +New-CredentialStore -Force +``` + +# Resets an existing private CredentialStore + +### BEISPIEL 3 +``` +New-CredentialStore -Shared +``` + +# Creates a new shared CredentialStore + +### BEISPIEL 4 +``` +New-CredentialStore -Shared -Path "C:\TMP\CredentialStore.json" +``` + +# Creates a new shared CredentialStore in the given location. + ## PARAMETERS -### -Path -Path to an existing *.pfx certificate file. +### -Force +Use this switch to reset an existing store. +The complete content will be wiped. ```yaml -Type: String +Type: SwitchParameter Parameter Sets: (All) Aliases: -Required: True -Position: 1 +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +{{ Fill PassThru Description }} + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Path +Define a location for the new shared CredentialStore. +The default store will be created in +$Env:ProgramData\PSCredentialStore dir. + +```yaml +Type: FileInfo +Parameter Sets: Shared +Aliases: + +Required: False +Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` -### -StoreName -Additionally you change change the store where you want the certificate into. +### -Shared +Creates a CredentialStore in the Shared mode. +This enables you to read the CredentialStore Items on +different systems or profiles. +In addition you can optionally provide a custom path wit the -Path parameter. ```yaml -Type: String -Parameter Sets: (All) +Type: SwitchParameter +Parameter Sets: Shared Aliases: -Required: False -Position: 2 -Default value: My +Required: True +Position: Named +Default value: False Accept pipeline input: False Accept wildcard characters: False ``` -### -StoreLocation -{{ Fill StoreLocation Description }} +### -SkipPFXCertCreation +{{ Fill SkipPFXCertCreation Description }} ```yaml -Type: String +Type: SwitchParameter Parameter Sets: (All) Aliases: Required: False -Position: 3 -Default value: CurrentUser +Position: Named +Default value: False Accept pipeline input: False Accept wildcard characters: False ``` -### -OpenFlags -{{ Fill OpenFlags Description }} +### -UseCertStore +{{ Fill UseCertStore Description }} ```yaml -Type: String +Type: SwitchParameter Parameter Sets: (All) Aliases: Required: False -Position: 4 -Default value: ReadWrite +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` @@ -101,11 +188,12 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ### [None] ## OUTPUTS -### [None] +### ['PSCredentialStore.Store'] Returns the recently created CredentialStore object if the -PassThru parameter +### was given. ## NOTES -File Name : Import-CSPfxCertificate.ps1 -Author : Marco Blessing - marco.blessing@googlemail.com -Requires : +- File Name : New-CredentialStore.ps1 +- Author : Marco Blessing - marco.blessing@googlemail.com +- Requires : ## RELATED LINKS diff --git a/docs/New-CredentialStoreItem.md b/docs/New-CredentialStoreItem.md index 4bd392b..996b9bc 100644 --- a/docs/New-CredentialStoreItem.md +++ b/docs/New-CredentialStoreItem.md @@ -1,10 +1,3 @@ ---- -external help file: PSCredentialStore-help.xml -Module Name: PSCredentialStore -online version: https://github.com/OCram85/PSCredentialStore -schema: 2.0.0 ---- - # New-CredentialStoreItem ## SYNOPSIS @@ -40,18 +33,18 @@ New-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.lo ## PARAMETERS -### -RemoteHost -The identifier or rather name for the given credentials. +### -Credential +You can provide credentials optionally as pre existing pscredential object. ```yaml -Type: String +Type: PSCredential Parameter Sets: (All) Aliases: -Required: True +Required: False Position: Named Default value: None -Accept pipeline input: False +Accept pipeline input: True (ByValue) Accept wildcard characters: False ``` @@ -73,18 +66,33 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Credential -You can provide credentials optionally as pre existing pscredential object. +### -Path +Define the store in which you would like to add a new item. ```yaml -Type: PSCredential -Parameter Sets: (All) +Type: String +Parameter Sets: Shared Aliases: Required: False Position: Named Default value: None -Accept pipeline input: True (ByValue) +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RemoteHost +The identifier or rather name for the given credentials. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False Accept wildcard characters: False ``` @@ -103,21 +111,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Path -Define the store in which you would like to add a new item. - -```yaml -Type: String -Parameter Sets: Shared -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/docs/PSCredentialStore.md b/docs/PSCredentialStore.md index efe12ed..7a67d83 100644 --- a/docs/PSCredentialStore.md +++ b/docs/PSCredentialStore.md @@ -1,11 +1,3 @@ ---- -Module Name: PSCredentialStore -Module Guid: 6800e192-9df8-4e30-b253-eb2c799bbe84 6800e192-9df8-4e30-b253-eb2c799bbe84 -Download Help Link: {{ Update Download Link }} -Help Version: {{ Please enter version of help manually (X.X.X.X) format }} -Locale: en-US ---- - # PSCredentialStore Module ## Description [about_PSCredentialStore](about_PSCredentialStore.md) @@ -26,17 +18,11 @@ Returns the Credential from a given remote host item. ### [Get-CSCertificate](Get-CSCertificate.md) Returns the current used valid PfX certificate. -### [Get-CSPfxCertificate](Get-CSPfxCertificate.md) -Returns the certificate object given by thumbprint. - ### [Import-CSCertificate](Import-CSCertificate.md) Imports a linked certificate to the valid store location. -### [Import-CSPfxCertificate](Import-CSPfxCertificate.md) -Adds a given pfx certificate file to current user's personal certificate store. - -### [Import-CSPfxCertificate](Import-CSPfxCertificate.md) -Adds a given pfx certificate file to current user's personal certificate store. +### [Import-CSCertificate](Import-CSCertificate.md) +Imports a linked certificate to the valid store location. ### [New-CredentialStoreItem](New-CredentialStoreItem.md) Adds a credential store item containing host, user and password to the given store. @@ -65,9 +51,6 @@ Tests if the linked certificate is store ein the specified cert stores. ### [Test-CSConnection](Test-CSConnection.md) Returns the connection state of a given type to the remote host. -### [Test-CSPfxCertificate](Test-CSPfxCertificate.md) -Tests if the given certificate exists in a store. - ### [Use-CSCertificate](Use-CSCertificate.md) Links an existing PFX Certificate to a CredentialStore. diff --git a/docs/Remove-CredentialStoreItem.md b/docs/Remove-CredentialStoreItem.md index eb18813..46caaac 100644 --- a/docs/Remove-CredentialStoreItem.md +++ b/docs/Remove-CredentialStoreItem.md @@ -1,10 +1,3 @@ ---- -external help file: PSCredentialStore-help.xml -Module Name: PSCredentialStore -online version: https://github.com/OCram85/PSCredentialStore -schema: 2.0.0 ---- - # Remove-CredentialStoreItem ## SYNOPSIS @@ -50,21 +43,6 @@ Remove-CredentialStoreItem -RemoteHost "esx01.myside.local" -Identifier svc ## PARAMETERS -### -RemoteHost -Specify the host you for which you would like to change the credentials. - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: True -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -Identifier Defaults to "". Specify a string, which separates two CredentialStoreItems for the @@ -82,6 +60,36 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -Path +Define the store in which your given host entry already exists. + +```yaml +Type: String +Parameter Sets: Shared +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RemoteHost +Specify the host you for which you would like to change the credentials. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Shared Switch to shared mode with this param. This enforces the command to work with a shared CredentialStore which @@ -99,21 +107,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Path -Define the store in which your given host entry already exists. - -```yaml -Type: String -Parameter Sets: Shared -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/docs/Set-CredentialStoreItem.md b/docs/Set-CredentialStoreItem.md index 0ccd012..803d878 100644 --- a/docs/Set-CredentialStoreItem.md +++ b/docs/Set-CredentialStoreItem.md @@ -1,10 +1,3 @@ ---- -external help file: PSCredentialStore-help.xml -Module Name: PSCredentialStore -online version: https://github.com/OCram85/PSCredentialStore -schema: 2.0.0 ---- - # Set-CredentialStoreItem ## SYNOPSIS @@ -38,18 +31,18 @@ Set-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.lo ## PARAMETERS -### -RemoteHost -Specify the host you for which you would like to change the credentials. +### -Credential +{{ Fill Credential Description }} ```yaml -Type: String +Type: PSCredential Parameter Sets: (All) Aliases: -Required: True +Required: False Position: Named Default value: None -Accept pipeline input: False +Accept pipeline input: True (ByValue) Accept wildcard characters: False ``` @@ -70,18 +63,33 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Credential -{{ Fill Credential Description }} +### -Path +Define the store in which your given host entry already exists. ```yaml -Type: PSCredential -Parameter Sets: (All) +Type: String +Parameter Sets: Shared Aliases: Required: False Position: Named Default value: None -Accept pipeline input: True (ByValue) +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RemoteHost +Specify the host you for which you would like to change the credentials. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False Accept wildcard characters: False ``` @@ -102,21 +110,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Path -Define the store in which your given host entry already exists. - -```yaml -Type: String -Parameter Sets: Shared -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/docs/Test-CSCertificate.md b/docs/Test-CSCertificate.md index 4cc3507..9ccb447 100644 --- a/docs/Test-CSCertificate.md +++ b/docs/Test-CSCertificate.md @@ -1,10 +1,3 @@ ---- -external help file: PSCredentialStore-help.xml -Module Name: PSCredentialStore -online version: https://github.com/OCram85/PSCredentialStore -schema: 2.0.0 ---- - # Test-CSCertificate ## SYNOPSIS diff --git a/docs/Test-CSConnection.md b/docs/Test-CSConnection.md index 4eae574..f462334 100644 --- a/docs/Test-CSConnection.md +++ b/docs/Test-CSConnection.md @@ -1,10 +1,3 @@ ---- -external help file: PSCredentialStore-help.xml -Module Name: PSCredentialStore -online version: https://github.com/OCram85/PSCredentialStore -schema: 2.0.0 ---- - # Test-CSConnection ## SYNOPSIS diff --git a/docs/Test-CSPfxCertificate.md b/docs/Test-CSPfxCertificate.md deleted file mode 100644 index 2f61c90..0000000 --- a/docs/Test-CSPfxCertificate.md +++ /dev/null @@ -1,94 +0,0 @@ ---- -external help file: PSCredentialStore-help.xml -Module Name: PSCredentialStore -online version: https://github.com/OCram85/PSCredentialStore -schema: 2.0.0 ---- - -# Test-CSPfxCertificate - -## SYNOPSIS -Tests if the given certificate exists in a store. - -## SYNTAX - -``` -Test-CSPfxCertificate [-Thumbprint] [[-StoreName] ] [[-StoreLocation] ] - [] -``` - -## DESCRIPTION -Use this function to ensure if a certificate is already imported into a given store. - -## EXAMPLES - -### BEISPIEL 1 -``` -Test-CSPfxCertificate -Thumbprint '12345678' -StoreName 'My' -StoreLocation 'CurrentUser' -``` - -## PARAMETERS - -### -Thumbprint -Provide one or more thumbprints. - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: True -Position: 1 -Default value: None -Accept pipeline input: True (ByValue) -Accept wildcard characters: False -``` - -### -StoreName -Select the store name in which you want to search the certificates. - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: 2 -Default value: My -Accept pipeline input: False -Accept wildcard characters: False -``` - -### -StoreLocation -Select between the both available locations CurrentUser odr LocalMachine. - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: 3 -Default value: CurrentUser -Accept pipeline input: False -Accept wildcard characters: False -``` - -### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). - -## INPUTS - -### [None] -## OUTPUTS - -### [bool] -## NOTES -File Name : Test-CSPfxCertificate.ps1 -Author : Marco Blessing - marco.blessing@googlemail.com -Requires : - -## RELATED LINKS - -[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore) - diff --git a/docs/Test-CredentialStore.md b/docs/Test-CredentialStore.md index 5352e56..7efbbfc 100644 --- a/docs/Test-CredentialStore.md +++ b/docs/Test-CredentialStore.md @@ -1,10 +1,3 @@ ---- -external help file: PSCredentialStore-help.xml -Module Name: PSCredentialStore -online version: https://github.com/OCram85/PSCredentialStore -schema: 2.0.0 ---- - # Test-CredentialStore ## SYNOPSIS diff --git a/docs/Test-CredentialStoreItem.md b/docs/Test-CredentialStoreItem.md index 0bb078c..aa5d3f6 100644 --- a/docs/Test-CredentialStoreItem.md +++ b/docs/Test-CredentialStoreItem.md @@ -1,10 +1,3 @@ ---- -external help file: PSCredentialStore-help.xml -Module Name: PSCredentialStore -online version: https://github.com/OCram85/PSCredentialStore -schema: 2.0.0 ---- - # Test-CredentialStoreItem ## SYNOPSIS @@ -43,6 +36,23 @@ Else { ## PARAMETERS +### -Identifier +Adds an optional identifier to the given RemoteHost. +Makes it possible to store multiple credentials +for a single host. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Path Define a custom credential store you try to read from. Without the \`-Path\` parameter @@ -75,23 +85,6 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -Identifier -Adds an optional identifier to the given RemoteHost. -Makes it possible to store multiple credentials -for a single host. - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: False -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -Shared Switch to shared mode with this param. This enforces the command to work with a shared CredentialStore which diff --git a/docs/Use-CSCertificate.md b/docs/Use-CSCertificate.md index e48a0b2..a0b4faa 100644 --- a/docs/Use-CSCertificate.md +++ b/docs/Use-CSCertificate.md @@ -1,10 +1,3 @@ ---- -external help file: PSCredentialStore-help.xml -Module Name: PSCredentialStore -online version: https://github.com/OCram85/PSCredentialStore -schema: 2.0.0 ---- - # Use-CSCertificate ## SYNOPSIS @@ -34,21 +27,6 @@ Use-CSCertificate -Path 'C:\cert.pfx' ## PARAMETERS -### -Path -Specify the path to the PFX Certificate you want to link for usage. - -```yaml -Type: String -Parameter Sets: (All) -Aliases: - -Required: True -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -CredentialStore Specify a custom path for a shared credential store. @@ -64,6 +42,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -Path +Specify the path to the PFX Certificate you want to link for usage. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Shared Use the credential store in shared mode. diff --git a/docs/about_PSCredentialStore.md b/docs/about_PSCredentialStore.md index 726bf1b..0172bf8 100644 --- a/docs/about_PSCredentialStore.md +++ b/docs/about_PSCredentialStore.md @@ -7,24 +7,30 @@ PSCredentialStore enables managing multiple PSCredential objects. # LONG DESCRIPTION -The PSCredentialStore is an simple credential manager for PSCredentials. It stores multiple credential objects in a -simple json file. You can choose between a private and shared store. The private one exists in your profile and can +The PSCredentialStore is a simple credential manager for `PSCredential` objects. It stores PSCredentials in a simple json +file. You can choose between a private and shared credential store. The private one exists in your profile and can ony accessed by your account on the same machine. The shared store enables you to use different credentials for your -script without exposing them as plain text. - -**The shared store isn't 100% secure and I don't recommend using it in production!** +scripts without exposing them as plain text. PSCredentialStore was developed to simplify the delegation of complex powershell scripts. In this case you often need to store credentials for non interactive usage like in scheduled tasks. -To get started read the [about_PSCredentialStore](/src/en-US/about_PSCredential.help.txt) page. +Starting with version `1.0.0` PSCredential uses Pfx certificates fo encryption. You can use Pfx certification files +or certificates stored in the certification store. +For more details read the [about_PSCredentialStore](/docs/about_PSCredentialStore.md) page on github or via CLI with +`Get-Help about_PSCredentialStore`. + +## Requirements + +- PowerShell >= `5.1` +- .NET Framework >= `4.6` or .NET Core >= `1.0` ## Installation ## PowerShellGallery.com (Recommended Way) -* Make sure you use PowerShell 4.0 or higher with `$PSVersionTable`. +* Make sure you use PowerShell 5.1 or higher with `$PSVersionTable`. * Use the builtin PackageManagement and install with: `Install-Module PSCredentialStore` * Done. Start exploring the Module with `Import-Module PSCredentialStore ; Get-Command -Module PSCredentialStore` @@ -36,19 +42,28 @@ To get started read the [about_PSCredentialStore](/src/en-US/about_PSCredential. * Don't forget to change the NTFS permission flag in the context menu. * Start with `Import-Module PSCredentialStore` -**1.** First we need a blank CredentialStore. You can decide between a *private* or *shared* store. The private +**1.** First we need a blank credential store. You can decide between a *private* or *shared* store. The private Credential Store can only be accessed with your profile on the machine you created it. + +Starting with version `1.0.0` you can decide the storage type of your fresh created certificate. As default +PSCredentialStore creates a new pfx certificate file beside the credential store itself. Optionally you can provide +the parameter `-UseCertStore`. This imports the new certificate in the user or machine certification store as well. + ```powershell -# Private Credential Store +# Private credential store New-CredentialStore -# Shared Credential Store +# Private credential store with certification store usage +New-CredentialStore -UseCertStore + +# Shared credential rtore New-CredentialStore -Shared -#Shared CredentialStore in custom Location +#Shared credential store in custom Location New-CredentialStore -Shared -Path 'C:\CredentialStore.json' ``` + **2.** Now you can manage your CredentialStoreItems: ```powershell # This will prompt for credentials and stores it in a private store diff --git a/src/Certificate/Import-CSCertificate.ps1 b/src/Certificate/Import-CSCertificate.ps1 index 8cde799..244eb63 100644 --- a/src/Certificate/Import-CSCertificate.ps1 +++ b/src/Certificate/Import-CSCertificate.ps1 @@ -14,13 +14,13 @@ function Import-CSCertificate { Provide a valid path to pfx certificate file. .INPUTS - Describe the script input parameters (if any), otherwise it may also list the word "[None]". + [None] .OUTPUTS - Describe the script output parameters (if any), otherwise it may also list the word "[None]". + [None] .EXAMPLE - .\Remove-Some-Script.ps1 -One content + Import-CSCertificate -Type 'Private' -Path (Join-Path -Path $Env:APPDATA -ChildItem 'PfxCertificate.pfx') .NOTES - File Name : Import-CSCertificate.ps1 diff --git a/src/Certificate/New-CSCertAttribute.ps1 b/src/Certificate/New-CSCertAttribute.ps1 index 6311824..e199a83 100644 --- a/src/Certificate/New-CSCertAttribute.ps1 +++ b/src/Certificate/New-CSCertAttribute.ps1 @@ -24,15 +24,14 @@ function New-CSCertAttribute { .PARAMETER CommonName The certificate common name. - .PARAMETER CSRSubject - you can provide the needed certificate properties with in one hashtable. This hashtable has to contain the - following keys: 'Country', 'State', 'City', 'Organization', 'OrganizationalUnitName', 'CommonName'. + .PARAMETER Days + The validation time itself. .INPUTS [None] .OUTPUTS - ['PSCredentialStore.Certificate.CSRDetails'] + [PSCredentialStore.Certificate.CSRDetails] .EXAMPLE New-CSCertAttribute -Country 'DE' -State 'BW' -City 'Karlsruhe' -Organization 'AwesomeIT' -OrganizationalUnitName '' -CommonName 'MyPrivateCert' diff --git a/src/Certificate/Use-CSCertificate.ps1 b/src/Certificate/Use-CSCertificate.ps1 index 6ac2acd..76f0f40 100644 --- a/src/Certificate/Use-CSCertificate.ps1 +++ b/src/Certificate/Use-CSCertificate.ps1 @@ -15,7 +15,7 @@ function Use-CSCertificate { .PARAMETER Shared Use the credential store in shared mode. - .PARAMETER UserCertStore + .PARAMETER UseCertStore Use the given certificate and import it into the corresponding certificate store. .INPUTS diff --git a/src/Connection/Connect-To.ps1 b/src/Connection/Connect-To.ps1 index 74b1eaa..3de40cd 100644 --- a/src/Connection/Connect-To.ps1 +++ b/src/Connection/Connect-To.ps1 @@ -29,6 +29,9 @@ function Connect-To { Switch to shared mode with this param. This enforces the command to work with a shared CredentialStore which can be decrypted across systems. + .PARAMETER PassThru + Returns the value from the underlying connection type function. + .INPUTS [None] diff --git a/src/Item/New-CredentialStoreItem.ps1 b/src/Item/New-CredentialStoreItem.ps1 index 2cd5947..a95c2d4 100644 --- a/src/Item/New-CredentialStoreItem.ps1 +++ b/src/Item/New-CredentialStoreItem.ps1 @@ -21,6 +21,10 @@ function New-CredentialStoreItem { .PARAMETER Credential You can provide credentials optionally as pre existing pscredential object. + .PARAMETER Shared + Define the CredentialStore where you want to add the new item. Default is always personal but can be + changed to shared, or even shared with custom path. + .INPUTS [None] diff --git a/src/Item/Set-CredentialStoreItem.ps1 b/src/Item/Set-CredentialStoreItem.ps1 index 5c125c1..3194d58 100644 --- a/src/Item/Set-CredentialStoreItem.ps1 +++ b/src/Item/Set-CredentialStoreItem.ps1 @@ -4,6 +4,7 @@ function Set-CredentialStoreItem { Changes the credentials for the given remote host in the store. .DESCRIPTION + Use this function to update your already stored RemoteHost items. .PARAMETER Path Define the store in which your given host entry already exists. @@ -19,6 +20,9 @@ function Set-CredentialStoreItem { Switch to shared mode with this param. This enforces the command to work with a shared CredentialStore which can be decrypted across systems. + .PARAMETER Credential + Provided the new credentials you want to update inside the RemoteHost item. + .INPUTS [None] @@ -27,6 +31,8 @@ function Set-CredentialStoreItem { .EXAMPLE Set-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.local" + + .EXAMPLE Set-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.local" -Identifier svc .NOTES diff --git a/src/Store/New-CredentialStore.ps1 b/src/Store/New-CredentialStore.ps1 index 9502060..91a6e81 100644 --- a/src/Store/New-CredentialStore.ps1 +++ b/src/Store/New-CredentialStore.ps1 @@ -18,6 +18,15 @@ function New-CredentialStore { .PARAMETER Force Use this switch to reset an existing store. The complete content will be wiped. + .PARAMETER SkipPFXCertCreation + You can skip the pfx certification process. This makes sense if you have a previously created cert or want to + import a cert in cross-platform environments. + + .Parameter UseCertStore + Instead of using a plain pfx file beside your CredentialStore file you can import it into the user or machine + certification store. In this case the system itself secures the cert and you don't hat to set custom NTFS + permissions so secure your shared certificate. + .INPUTS [None] diff --git a/src/Store/Test-CredentialStore.ps1 b/src/Store/Test-CredentialStore.ps1 index 2746264..afbc429 100644 --- a/src/Store/Test-CredentialStore.ps1 +++ b/src/Store/Test-CredentialStore.ps1 @@ -14,6 +14,9 @@ function Test-CredentialStore { 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 -- 2.40.1 From 376f97f9a873e394486d607e9e417bbcd28fe7ab Mon Sep 17 00:00:00 2001 From: OCram85 Date: Mon, 8 Apr 2019 15:56:27 +0200 Subject: [PATCH 20/31] rename tests --- ...bute.Tests.ps1 => 50_New-CSCertAttribute.Tests.ps1} | 0 ...ficate.Tests.ps1 => 51_New-CSCertificate.Tests.ps1} | 0 .../PfxCertificate/60_Test-CSPfxCertificate.Tests.ps1 | 10 ++++++++++ 3 files changed, 10 insertions(+) rename tests/Certificate/{01_New-CSCertAttribute.Tests.ps1 => 50_New-CSCertAttribute.Tests.ps1} (100%) rename tests/Certificate/{02_New-CSCertificate.Tests.ps1 => 51_New-CSCertificate.Tests.ps1} (100%) create mode 100644 tests/PfxCertificate/60_Test-CSPfxCertificate.Tests.ps1 diff --git a/tests/Certificate/01_New-CSCertAttribute.Tests.ps1 b/tests/Certificate/50_New-CSCertAttribute.Tests.ps1 similarity index 100% rename from tests/Certificate/01_New-CSCertAttribute.Tests.ps1 rename to tests/Certificate/50_New-CSCertAttribute.Tests.ps1 diff --git a/tests/Certificate/02_New-CSCertificate.Tests.ps1 b/tests/Certificate/51_New-CSCertificate.Tests.ps1 similarity index 100% rename from tests/Certificate/02_New-CSCertificate.Tests.ps1 rename to tests/Certificate/51_New-CSCertificate.Tests.ps1 diff --git a/tests/PfxCertificate/60_Test-CSPfxCertificate.Tests.ps1 b/tests/PfxCertificate/60_Test-CSPfxCertificate.Tests.ps1 new file mode 100644 index 0000000..9665cb6 --- /dev/null +++ b/tests/PfxCertificate/60_Test-CSPfxCertificate.Tests.ps1 @@ -0,0 +1,10 @@ +Describe "Test-CSPfxCertificate" { + Context "Basic Tests" { + It "Should not Throw" { + { Test-CSPfxCertificate -Thumbprint '12345' -StoreName My -StoreLocation CurrentUser } | Should -Not -Throw + } + It "Should return false" { + Test-CSPfxCertificate -Thumbprint '12345' -StoreName My -StoreLocation CurrentUser | Should -Be $false + } + } +} -- 2.40.1 From 828bd90fa4503c58a168fb11964ed3ce058abb02 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Mon, 8 Apr 2019 15:59:51 +0200 Subject: [PATCH 21/31] fix private functions location --- src/{PfxCertificate => Private}/Get-CSPfxCertificate.ps1 | 0 src/{PfxCertificate => Private}/Import-CSPfxCertificate.ps1 | 0 src/{PfxCertificate => Private}/Test-CSPfxCertificate.ps1 | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename src/{PfxCertificate => Private}/Get-CSPfxCertificate.ps1 (100%) rename src/{PfxCertificate => Private}/Import-CSPfxCertificate.ps1 (100%) rename src/{PfxCertificate => Private}/Test-CSPfxCertificate.ps1 (100%) diff --git a/src/PfxCertificate/Get-CSPfxCertificate.ps1 b/src/Private/Get-CSPfxCertificate.ps1 similarity index 100% rename from src/PfxCertificate/Get-CSPfxCertificate.ps1 rename to src/Private/Get-CSPfxCertificate.ps1 diff --git a/src/PfxCertificate/Import-CSPfxCertificate.ps1 b/src/Private/Import-CSPfxCertificate.ps1 similarity index 100% rename from src/PfxCertificate/Import-CSPfxCertificate.ps1 rename to src/Private/Import-CSPfxCertificate.ps1 diff --git a/src/PfxCertificate/Test-CSPfxCertificate.ps1 b/src/Private/Test-CSPfxCertificate.ps1 similarity index 100% rename from src/PfxCertificate/Test-CSPfxCertificate.ps1 rename to src/Private/Test-CSPfxCertificate.ps1 -- 2.40.1 From 4a8898efdcfeb79633830bb4954468409ba33c04 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Tue, 9 Apr 2019 10:10:36 +0200 Subject: [PATCH 22/31] - fixes #44: FTP connection --- src/Connection/Connect-To.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Connection/Connect-To.ps1 b/src/Connection/Connect-To.ps1 index 3de40cd..b7e1abb 100644 --- a/src/Connection/Connect-To.ps1 +++ b/src/Connection/Connect-To.ps1 @@ -197,7 +197,7 @@ function Connect-To { } try { $FTPSessionOption = New-WinSCPSessionOption @WinSCPConParams - $Global:WinSCPSession = New-WinSCPSession @FTPSessionOption + $Global:WinSCPSession = New-WinSCPSession -SessionOption $FTPSessionOption } catch { throw "Could not connect to {0} using {1} protocol!" -f $RemoteHost, $Type -- 2.40.1 From 37071eae74f6acc4385e67476c3af30bf48723c0 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Mon, 15 Apr 2019 10:35:50 +0200 Subject: [PATCH 23/31] add link to reference --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 113a127..aa4b16f 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,8 @@ or certificates stored in the certification store. For more details read the [about_PSCredentialStore](/docs/about_PSCredentialStore.md) page on github or via CLI with `Get-Help about_PSCredentialStore`. +You can find the [reference](/docs/PSCredentialStore.md) in the /docs/ path as well. + Requirements ============ -- 2.40.1 From 5ded38ed6ceeeed2eb93d8d186546fbb3cafacbb Mon Sep 17 00:00:00 2001 From: OCram85 Date: Mon, 29 Apr 2019 10:12:43 +0200 Subject: [PATCH 24/31] add format files --- src/Formats/PSCredential.Store.Format.ps1xml | 35 ++++++++++++++++++ ...edentialStore.Certificate.Attribute.ps1xml | 37 +++++++++++++++++++ src/PSCredentialStore.psd1 | 5 ++- 3 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 src/Formats/PSCredential.Store.Format.ps1xml create mode 100644 src/Formats/PSCredentialStore.Certificate.Attribute.ps1xml diff --git a/src/Formats/PSCredential.Store.Format.ps1xml b/src/Formats/PSCredential.Store.Format.ps1xml new file mode 100644 index 0000000..9779e40 --- /dev/null +++ b/src/Formats/PSCredential.Store.Format.ps1xml @@ -0,0 +1,35 @@ + + + + + PSCredentialStore.Store + + PSCredentialStore.Store + + + + + + + Version + + + Created + + + + $_.PfxCertificate | Split-Path -Leaf + + + Thumbprint + + + Type + + + + + + + + diff --git a/src/Formats/PSCredentialStore.Certificate.Attribute.ps1xml b/src/Formats/PSCredentialStore.Certificate.Attribute.ps1xml new file mode 100644 index 0000000..d75dee6 --- /dev/null +++ b/src/Formats/PSCredentialStore.Certificate.Attribute.ps1xml @@ -0,0 +1,37 @@ + + + + + PSCredentialStore.Certificate.Attribute + + PSCredentialStore.Certificate.Attribute + + + + + + + Country + + + State + + + City + + + Organization + + + OrganizationalUnitName + + + CommonName + + + + + + + + diff --git a/src/PSCredentialStore.psd1 b/src/PSCredentialStore.psd1 index 8103507..24820b5 100644 --- a/src/PSCredentialStore.psd1 +++ b/src/PSCredentialStore.psd1 @@ -55,7 +55,10 @@ # TypesToProcess = @() # Format files (.ps1xml) to be loaded when importing this module - # FormatsToProcess = @() + FormatsToProcess = @( + 'Formats/PSCredential.Store.Format.ps1xml', + 'Formats/PSCredentialStore.Certificate.Attribute.ps1xml' + ) # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess # NestedModules = @() -- 2.40.1 From 40981ec986c06228176300d2dd4fe83bd45e5d50 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Mon, 29 Apr 2019 10:44:35 +0200 Subject: [PATCH 25/31] add preview version shield --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index aa4b16f..818cd78 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![AppVeyor tests branch](https://img.shields.io/appveyor/tests/OCram85/PSCredentialStore/master.svg?style=plastic "Pester Tests Results")](https://ci.appveyor.com/project/OCram85/pscredentialstore/branch/master/tests) [![Coveralls github](https://img.shields.io/coveralls/github/OCram85/PSCredentialStore.svg?style=plastic "Coveralls.io Coverage Report")](https://coveralls.io/github/OCram85/PSCredentialStore?branch=master) [![PowerShell Gallery](https://img.shields.io/powershellgallery/v/PSCredentialStore.svg?style=plastic "PowershellGallery Published Version")](https://www.powershellgallery.com/packages/PSCredentialStore) +[![PowerShell Gallery](https://img.shields.io/powershellgallery/vpre/PSCredentialStore.svg?label=latest%20preview&style=plastic "PowershellGallery Latest Preview Version")](https://www.powershellgallery.com/packages/PSCredentialStore) [![PowerShell Gallery](https://img.shields.io/powershellgallery/dt/PSCredentialStore.svg?style=plastic "PowershellGallery Downloads")](https://www.powershellgallery.com/packages/PSCredentialStore) ![forthebadge](http://forthebadge.com/images/badges/built-with-love.svg) -- 2.40.1 From f5c4add6c5266832601bc726a762bfeb4b285731 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Mon, 29 Apr 2019 11:38:56 +0200 Subject: [PATCH 26/31] update markdown help files (platyps) --- docs/Connect-To.md | 2 +- docs/Disconnect-From.md | 2 +- docs/Get-CSCertificate.md | 2 +- docs/Get-CredentialStore.md | 2 +- docs/Get-CredentialStoreItem.md | 2 +- docs/Import-CSCertificate.md | 8 ++++---- docs/New-CSCertAttribute.md | 6 +++--- docs/New-CSCertificate.md | 2 +- docs/New-CredentialStore.md | 11 ++++++++--- docs/New-CredentialStoreItem.md | 6 ++++-- docs/Remove-CredentialStoreItem.md | 2 +- docs/Set-CredentialStoreItem.md | 9 ++++++--- docs/Test-CSCertificate.md | 2 +- docs/Test-CSConnection.md | 2 +- docs/Test-CredentialStore.md | 10 ++++------ docs/Test-CredentialStoreItem.md | 2 +- docs/Use-CSCertificate.md | 4 ++-- 17 files changed, 41 insertions(+), 33 deletions(-) diff --git a/docs/Connect-To.md b/docs/Connect-To.md index 523fe42..f0fb164 100644 --- a/docs/Connect-To.md +++ b/docs/Connect-To.md @@ -175,7 +175,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/docs/Disconnect-From.md b/docs/Disconnect-From.md index 5bc96c4..5d0d6df 100644 --- a/docs/Disconnect-From.md +++ b/docs/Disconnect-From.md @@ -104,7 +104,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/docs/Get-CSCertificate.md b/docs/Get-CSCertificate.md index 6231e51..266e8e7 100644 --- a/docs/Get-CSCertificate.md +++ b/docs/Get-CSCertificate.md @@ -52,7 +52,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/docs/Get-CredentialStore.md b/docs/Get-CredentialStore.md index 4184077..24b83e3 100644 --- a/docs/Get-CredentialStore.md +++ b/docs/Get-CredentialStore.md @@ -64,7 +64,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/docs/Get-CredentialStoreItem.md b/docs/Get-CredentialStoreItem.md index 6600ad8..6b0ab1c 100644 --- a/docs/Get-CredentialStoreItem.md +++ b/docs/Get-CredentialStoreItem.md @@ -94,7 +94,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/docs/Import-CSCertificate.md b/docs/Import-CSCertificate.md index 235afff..2211efa 100644 --- a/docs/Import-CSCertificate.md +++ b/docs/Import-CSCertificate.md @@ -17,7 +17,7 @@ private and shared credential stores. ### BEISPIEL 1 ``` -.\Remove-Some-Script.ps1 -One content +Import-CSCertificate -Type 'Private' -Path (Join-Path -Path $Env:APPDATA -ChildItem 'PfxCertificate.pfx') ``` ## PARAMETERS @@ -53,14 +53,14 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS -### Describe the script input parameters (if any), otherwise it may also list the word "[None]". +### [None] ## OUTPUTS -### Describe the script output parameters (if any), otherwise it may also list the word "[None]". +### [None] ## NOTES - File Name : Import-CSCertificate.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com diff --git a/docs/New-CSCertAttribute.md b/docs/New-CSCertAttribute.md index 770b9af..8e778c5 100644 --- a/docs/New-CSCertAttribute.md +++ b/docs/New-CSCertAttribute.md @@ -68,7 +68,7 @@ Accept wildcard characters: False ``` ### -Days -{{ Fill Days Description }} +The validation time itself. ```yaml Type: Int32 @@ -128,14 +128,14 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS ### [None] ## OUTPUTS -### ['PSCredentialStore.Certificate.CSRDetails'] +### [PSCredentialStore.Certificate.CSRDetails] ## NOTES - File Name : New-CSCertAttribute.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com diff --git a/docs/New-CSCertificate.md b/docs/New-CSCertificate.md index 30677dd..163288c 100644 --- a/docs/New-CSCertificate.md +++ b/docs/New-CSCertificate.md @@ -101,7 +101,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/docs/New-CredentialStore.md b/docs/New-CredentialStore.md index ca191da..d5b7744 100644 --- a/docs/New-CredentialStore.md +++ b/docs/New-CredentialStore.md @@ -120,7 +120,9 @@ Accept wildcard characters: False ``` ### -SkipPFXCertCreation -{{ Fill SkipPFXCertCreation Description }} +You can skip the pfx certification process. +This makes sense if you have a previously created cert or want to +import a cert in cross-platform environments. ```yaml Type: SwitchParameter @@ -135,7 +137,10 @@ Accept wildcard characters: False ``` ### -UseCertStore -{{ Fill UseCertStore Description }} +Instead of using a plain pfx file beside your CredentialStore file you can import it into the user or machine +certification store. +In this case the system itself secures the cert and you don't hat to set custom NTFS +permissions so secure your shared certificate. ```yaml Type: SwitchParameter @@ -181,7 +186,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/docs/New-CredentialStoreItem.md b/docs/New-CredentialStoreItem.md index 996b9bc..dc185fe 100644 --- a/docs/New-CredentialStoreItem.md +++ b/docs/New-CredentialStoreItem.md @@ -97,7 +97,9 @@ Accept wildcard characters: False ``` ### -Shared -{{ Fill Shared Description }} +Define the CredentialStore where you want to add the new item. +Default is always personal but can be +changed to shared, or even shared with custom path. ```yaml Type: SwitchParameter @@ -112,7 +114,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/docs/Remove-CredentialStoreItem.md b/docs/Remove-CredentialStoreItem.md index 46caaac..20ee2e9 100644 --- a/docs/Remove-CredentialStoreItem.md +++ b/docs/Remove-CredentialStoreItem.md @@ -108,7 +108,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/docs/Set-CredentialStoreItem.md b/docs/Set-CredentialStoreItem.md index 803d878..ae8d989 100644 --- a/docs/Set-CredentialStoreItem.md +++ b/docs/Set-CredentialStoreItem.md @@ -18,7 +18,7 @@ Set-CredentialStoreItem -RemoteHost [-Identifier ] [-Credential ``` ## DESCRIPTION -{{ Fill in the Description }} +Use this function to update your already stored RemoteHost items. ## EXAMPLES @@ -27,12 +27,15 @@ Set-CredentialStoreItem -RemoteHost [-Identifier ] [-Credential Set-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.local" ``` +### BEISPIEL 2 +``` Set-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.local" -Identifier svc +``` ## PARAMETERS ### -Credential -{{ Fill Credential Description }} +Provided the new credentials you want to update inside the RemoteHost item. ```yaml Type: PSCredential @@ -111,7 +114,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/docs/Test-CSCertificate.md b/docs/Test-CSCertificate.md index 9ccb447..8234de1 100644 --- a/docs/Test-CSCertificate.md +++ b/docs/Test-CSCertificate.md @@ -37,7 +37,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/docs/Test-CSConnection.md b/docs/Test-CSConnection.md index f462334..ee3ee78 100644 --- a/docs/Test-CSConnection.md +++ b/docs/Test-CSConnection.md @@ -54,7 +54,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/docs/Test-CredentialStore.md b/docs/Test-CredentialStore.md index 7efbbfc..1b6768b 100644 --- a/docs/Test-CredentialStore.md +++ b/docs/Test-CredentialStore.md @@ -22,12 +22,10 @@ the file exists. ## EXAMPLES -### Example 1 -```powershell -PS C:> {{ Add example code here }} +### BEISPIEL 1 +``` +Test-CredentialStore -eq $true ``` - -{{ Add example description here }} ## PARAMETERS @@ -64,7 +62,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/docs/Test-CredentialStoreItem.md b/docs/Test-CredentialStoreItem.md index aa5d3f6..229ee6c 100644 --- a/docs/Test-CredentialStoreItem.md +++ b/docs/Test-CredentialStoreItem.md @@ -103,7 +103,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS diff --git a/docs/Use-CSCertificate.md b/docs/Use-CSCertificate.md index a0b4faa..90675d1 100644 --- a/docs/Use-CSCertificate.md +++ b/docs/Use-CSCertificate.md @@ -73,7 +73,7 @@ Accept wildcard characters: False ``` ### -UseCertStore -{{ Fill UseCertStore Description }} +Use the given certificate and import it into the corresponding certificate store. ```yaml Type: SwitchParameter @@ -88,7 +88,7 @@ Accept wildcard characters: False ``` ### CommonParameters -This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS -- 2.40.1 From 5e26d1cfda9f6cd12578be6c60c08b7b56ae0d0a Mon Sep 17 00:00:00 2001 From: OCram85 Date: Mon, 29 Apr 2019 11:58:24 +0200 Subject: [PATCH 27/31] add emoji images in captions --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 818cd78..47b1502 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ ![forthebadge](http://forthebadge.com/images/badges/built-with-love.svg) ![forthebadge](http://forthebadge.com/images/badges/for-you.svg) -General +:key: General ======= The PSCredentialStore is a simple credential manager for `PSCredential` objects. It stores PSCredentials in a simple json @@ -27,16 +27,16 @@ For more details read the [about_PSCredentialStore](/docs/about_PSCredentialStor You can find the [reference](/docs/PSCredentialStore.md) in the /docs/ path as well. -Requirements +:vulcan_salute: Requirements ============ - PowerShell >= `5.1` - .NET Framework >= `4.6` or .NET Core >= `1.0` -Installation +:hammer_and_wrench: Installation ============ -PowerShellGallery.com (Recommended Way) +:artificial_satellite: PowerShellGallery.com (Recommended Way) --------------------------------------- * Make sure you use PowerShell 5.1 or higher with `$PSVersionTable`. @@ -44,7 +44,7 @@ PowerShellGallery.com (Recommended Way) * Additionally use the `-AllowPrerelease` switch until we publish the final release! * Done. Start exploring the Module with `Import-Module PSCredentialStore ; Get-Command -Module PSCredentialStore` -Manual Way +:building_construction: Manual Way ---------- * Take a look at the [Latest Release](https://github.com/OCram85/PSCredentialStore/releases/latest) page. @@ -53,7 +53,7 @@ Manual Way * Don't forget to change the NTFS permission flag in the context menu. * Start with `Import-Module PSCredentialStore` -Quick Start +:sparkles: Quick Start ----------- **1.** First we need a blank credential store. You can decide between a *private* or *shared* store. The private @@ -120,7 +120,7 @@ Connect-To -RemoteHost "exchange1.myside.local" -Type ExchangeHTTPS Connect-To -RemoteHost "ubuntu.myside.local" -Type SCP ``` -Credits +:pushpin: Credits ------- A huge thanks to all the people who helped with their projects and indirect contributions which made this possible! -- 2.40.1 From 3b00f281e2cb8bd5368969487bd54e0bf9d0ebd5 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Mon, 29 Apr 2019 12:27:53 +0200 Subject: [PATCH 28/31] fix typos --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 47b1502..28a36f6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![AppVeyor branch](https://img.shields.io/appveyor/ci/OCram85/PSCredentialStore/master.svg?style=plastic "Master Banch Build Status")](https://ci.appveyor.com/project/OCram85/pscredentialstore/branch/master) +[![AppVeyor branch](https://img.shields.io/appveyor/ci/OCram85/PSCredentialStore/master.svg?style=plastic "Master Branch Build Status")](https://ci.appveyor.com/project/OCram85/pscredentialstore/branch/master) [![AppVeyor tests branch](https://img.shields.io/appveyor/tests/OCram85/PSCredentialStore/master.svg?style=plastic "Pester Tests Results")](https://ci.appveyor.com/project/OCram85/pscredentialstore/branch/master/tests) [![Coveralls github](https://img.shields.io/coveralls/github/OCram85/PSCredentialStore.svg?style=plastic "Coveralls.io Coverage Report")](https://coveralls.io/github/OCram85/PSCredentialStore?branch=master) [![PowerShell Gallery](https://img.shields.io/powershellgallery/v/PSCredentialStore.svg?style=plastic "PowershellGallery Published Version")](https://www.powershellgallery.com/packages/PSCredentialStore) @@ -70,10 +70,10 @@ New-CredentialStore # Private credential store with certification store usage New-CredentialStore -UseCertStore -# Shared credential rtore +# Shared credential store New-CredentialStore -Shared -#Shared credential store in custom Location +#Shared credential store in custom location New-CredentialStore -Shared -Path 'C:\CredentialStore.json' ``` @@ -125,7 +125,7 @@ Connect-To -RemoteHost "ubuntu.myside.local" -Type SCP A huge thanks to all the people who helped with their projects and indirect contributions which made this possible! -- This module is inspired by the awesome work of @dlwyatt with articles like these: +- This module is inspired by the awesome work of Dave Wyatt ([@dlwyatt](https://github.com/dlwyatt)) with articles like these: - https://powershell.org/2013/11/24/saving-passwords-and-preventing-other-processes-from-decrypting-them/ - https://powershell.org/2014/02/01/revisited-powershell-and-encryption/ - The awesome people from [LibreSSL](http://www.libressl.org/) which publishes the [portable openssl/libressl binaries](https://github.com/libressl-portable/portable)! -- 2.40.1 From aea1ae7b2f878f7bc70fcc13469d1d273c91e2d3 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Mon, 29 Apr 2019 15:37:30 +0200 Subject: [PATCH 29/31] fix typos --- README.md | 8 ++++---- docs/New-CredentialStore.md | 4 ++-- docs/about_PSCredentialStore.md | 8 ++++---- src/Store/New-CredentialStore.ps1 | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 28a36f6..d8dd59b 100644 --- a/README.md +++ b/README.md @@ -19,8 +19,8 @@ scripts without exposing them as plain text. PSCredentialStore was developed to simplify the delegation of complex powershell scripts. In this case you often need to store credentials for non interactive usage like in scheduled tasks. -Starting with version `1.0.0` PSCredential uses Pfx certificates fo encryption. You can use Pfx certification files -or certificates stored in the certification store. +Starting with version `1.0.0` PSCredential uses Pfx certificates fo encryption. You can use Pfx certificate files +or certificates stored in the certificate store. For more details read the [about_PSCredentialStore](/docs/about_PSCredentialStore.md) page on github or via CLI with `Get-Help about_PSCredentialStore`. @@ -61,13 +61,13 @@ Credential Store can only be accessed with your profile on the machine you creat Starting with version `1.0.0` you can decide the storage type of your fresh created certificate. As default PSCredentialStore creates a new pfx certificate file beside the credential store itself. Optionally you can provide -the parameter `-UseCertStore`. This imports the new certificate in the user or machine certification store as well. +the parameter `-UseCertStore`. This imports the new certificate in the user or machine certificate store as well. ```powershell # Private credential store New-CredentialStore -# Private credential store with certification store usage +# Private credential store with certificate store usage New-CredentialStore -UseCertStore # Shared credential store diff --git a/docs/New-CredentialStore.md b/docs/New-CredentialStore.md index d5b7744..60a1172 100644 --- a/docs/New-CredentialStore.md +++ b/docs/New-CredentialStore.md @@ -120,7 +120,7 @@ Accept wildcard characters: False ``` ### -SkipPFXCertCreation -You can skip the pfx certification process. +You can skip the pfx certificate creation process. This makes sense if you have a previously created cert or want to import a cert in cross-platform environments. @@ -138,7 +138,7 @@ Accept wildcard characters: False ### -UseCertStore Instead of using a plain pfx file beside your CredentialStore file you can import it into the user or machine -certification store. +certificate store. In this case the system itself secures the cert and you don't hat to set custom NTFS permissions so secure your shared certificate. diff --git a/docs/about_PSCredentialStore.md b/docs/about_PSCredentialStore.md index 0172bf8..95db59b 100644 --- a/docs/about_PSCredentialStore.md +++ b/docs/about_PSCredentialStore.md @@ -15,8 +15,8 @@ scripts without exposing them as plain text. PSCredentialStore was developed to simplify the delegation of complex powershell scripts. In this case you often need to store credentials for non interactive usage like in scheduled tasks. -Starting with version `1.0.0` PSCredential uses Pfx certificates fo encryption. You can use Pfx certification files -or certificates stored in the certification store. +Starting with version `1.0.0` PSCredential uses Pfx certificates fo encryption. You can use Pfx certificate files +or certificates stored in the certificate store. For more details read the [about_PSCredentialStore](/docs/about_PSCredentialStore.md) page on github or via CLI with `Get-Help about_PSCredentialStore`. @@ -47,13 +47,13 @@ Credential Store can only be accessed with your profile on the machine you creat Starting with version `1.0.0` you can decide the storage type of your fresh created certificate. As default PSCredentialStore creates a new pfx certificate file beside the credential store itself. Optionally you can provide -the parameter `-UseCertStore`. This imports the new certificate in the user or machine certification store as well. +the parameter `-UseCertStore`. This imports the new certificate in the user or machine certificate store as well. ```powershell # Private credential store New-CredentialStore -# Private credential store with certification store usage +# Private credential store with certificate store usage New-CredentialStore -UseCertStore # Shared credential rtore diff --git a/src/Store/New-CredentialStore.ps1 b/src/Store/New-CredentialStore.ps1 index 91a6e81..5a99a0f 100644 --- a/src/Store/New-CredentialStore.ps1 +++ b/src/Store/New-CredentialStore.ps1 @@ -19,12 +19,12 @@ function New-CredentialStore { Use this switch to reset an existing store. The complete content will be wiped. .PARAMETER SkipPFXCertCreation - You can skip the pfx certification process. This makes sense if you have a previously created cert or want to + You can skip the pfx certificate creation process. This makes sense if you have a previously created cert or want to import a cert in cross-platform environments. .Parameter UseCertStore Instead of using a plain pfx file beside your CredentialStore file you can import it into the user or machine - certification store. In this case the system itself secures the cert and you don't hat to set custom NTFS + certificate store. In this case the system itself secures the cert and you don't hat to set custom NTFS permissions so secure your shared certificate. .INPUTS -- 2.40.1 From 53a1e166588a3e644f0af51d36d7dd23ec53dc34 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Mon, 29 Apr 2019 15:37:51 +0200 Subject: [PATCH 30/31] fix typo --- src/Store/New-CredentialStore.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Store/New-CredentialStore.ps1 b/src/Store/New-CredentialStore.ps1 index 5a99a0f..cfa1ce2 100644 --- a/src/Store/New-CredentialStore.ps1 +++ b/src/Store/New-CredentialStore.ps1 @@ -108,7 +108,7 @@ function New-CredentialStore { $ErrorParams = @{ ErrorAction = 'Stop' Exception = [System.IO.InvalidDataException]::new( - 'Your provided path does not conain the required file extension .json !' + 'Your provided path does not contain the required file extension .json !' ) } Write-Error @ErrorParams -- 2.40.1 From c64677b2ff57545bfd7371efd02739f4c6569a56 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Mon, 29 Apr 2019 15:46:54 +0200 Subject: [PATCH 31/31] prepare version numbers --- appveyor.yml | 5 +---- src/PSCredentialStore.psd1 | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index b51512b..6f3197b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,8 +1,5 @@ -# release version: -#version: 0.5.0.{build} - # pre release version: -version: 0.5.{build} +version: 1.0.{build} #branches: # only: diff --git a/src/PSCredentialStore.psd1 b/src/PSCredentialStore.psd1 index 24820b5..35ae51b 100644 --- a/src/PSCredentialStore.psd1 +++ b/src/PSCredentialStore.psd1 @@ -128,10 +128,10 @@ IconUri = 'https://raw.githubusercontent.com/OCram85/PSCredentialStore/master/assets/logo256.png' # ReleaseNotes of this module - ReleaseNotes = 'This is a pre-release version!. Do not use in production!' + ReleaseNotes = 'See https://github.com/OCram85/PSCredentialStore/releases page for details.' # Prerelease string of this module - Prerelease = 'preview' + #Prerelease = 'preview' # Flag to indicate whether the module requires explicit user acceptance for install/update # RequireLicenseAcceptance = $false -- 2.40.1