From ff00144ce1c4af01c4d91c39d8836defdeec93de Mon Sep 17 00:00:00 2001 From: OCram85 Date: Mon, 8 Apr 2019 15:25:08 +0200 Subject: [PATCH] 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