forked from OCram85/PSCredentialStore
Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
2422afbd8f | |||
691255957c | |||
cb11209702 | |||
6659c2b317 | |||
599232ecec | |||
855cb920c8 | |||
8c92028b09 | |||
b63fd6780a | |||
dbe5319537 |
2
.vscode/tasks.json
vendored
2
.vscode/tasks.json
vendored
@ -28,7 +28,7 @@
|
|||||||
"taskName": "Test",
|
"taskName": "Test",
|
||||||
"suppressTaskName": true,
|
"suppressTaskName": true,
|
||||||
"args": [
|
"args": [
|
||||||
"Write-Host 'Invoking Pester...'; $ProgressPreference = 'SilentlyContinue'; Invoke-Pester -Script '.\\tests\\*' -EnableExit $flase -PesterOption @{IncludeVSCodeMarker=$true};",
|
"Write-Host 'Invoking Pester...'; $ProgressPreference = 'SilentlyContinue'; Invoke-Pester -Script ( Get-ChildItem -Path '.\\tests\\*.Tests.ps1' -Recurse | Sort-Object -Property Name ) -EnableExit $flase -PesterOption @{IncludeVSCodeMarker=$true};",
|
||||||
"Invoke-Command { Write-Host 'Completed Test task in task runner.' }"
|
"Invoke-Command { Write-Host 'Completed Test task in task runner.' }"
|
||||||
],
|
],
|
||||||
"problemMatcher": "$pester",
|
"problemMatcher": "$pester",
|
||||||
|
45
README.md
45
README.md
@ -1,21 +1,27 @@
|
|||||||
| AppVeyor Overall | AppVeyor Master | AppVeyor Dev | Coveralls.io | Download |
|
[](https://ci.appveyor.com/project/OCram85/pscredentialstore/branch/master)
|
||||||
| :--------------: | :-------------: | :----------: | :-----------: | :--------:|
|
[](https://ci.appveyor.com/project/OCram85/pscredentialstore/branch/master/tests)
|
||||||
| [](https://ci.appveyor.com/project/OCram85/PSCredentialStore) | [](https://ci.appveyor.com/project/OCram85/PSCredentialStore/branch/master) | [](https://ci.appveyor.com/project/OCram85/PSCredentialStore/branch/dev) | [](https://coveralls.io/github/OCram85/PSCredentialStore?branch=master) | [](https://www.powershellgallery.com/packages/PSCredentialStore)
|
[](https://coveralls.io/github/OCram85/PSCredentialStore?branch=master)
|
||||||
|
[](https://www.powershellgallery.com/packages/PSCredentialStore)
|
||||||
|
[](https://www.powershellgallery.com/packages/PSCredentialStore)
|
||||||
|
|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
General
|
General
|
||||||
=======
|
=======
|
||||||
|
|
||||||
The PSCredentialStore is an simple credential manager for PSCredentials. It stores multiple credential objects in a
|
The PSCredentialStore is a simple credential manager for PSCredentials. It stores PSCredentials in a simple json
|
||||||
simple json file. You can choose between a private and shared store. The private one exists in your profile and can
|
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
|
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.
|
scripts without exposing them as plain text.
|
||||||
|
|
||||||
**The shared store isn't 100% secure and I don't recommend using it in production!**
|
**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
|
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.
|
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.
|
For more details read the [about_PSCredentialStore](/docs/about_PSCredentialStore.md) page on github or via CLI with
|
||||||
|
`Get-Help about_PSCredentialStore`.
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
============
|
============
|
||||||
@ -32,27 +38,27 @@ Manual Way
|
|||||||
|
|
||||||
* Take a look at the [Latest Release](https://github.com/OCram85/PSCredentialStore/releases/latest) page.
|
* Take a look at the [Latest Release](https://github.com/OCram85/PSCredentialStore/releases/latest) page.
|
||||||
* Download the `PSCredentialStore.zip`.
|
* Download the `PSCredentialStore.zip`.
|
||||||
* Unpack the Zip and put it in your Powershell Module path.
|
* Unpack the zip file and put it in your Powershell module path.
|
||||||
* Don't forget to change the NTFS permission flag in the context menu.
|
* Don't forget to change the NTFS permission flag in the context menu.
|
||||||
* Start with `Import-Module PSCredentialStore`
|
* Start with `Import-Module PSCredentialStore`
|
||||||
|
|
||||||
Quick Start
|
Quick Start
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
**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.
|
Credential Store can only be accessed with your profile on the machine you created it.
|
||||||
```powershell
|
```powershell
|
||||||
# Private Credential Store
|
# Private credential store
|
||||||
New-CredentialStore
|
New-CredentialStore
|
||||||
|
|
||||||
# Shared Credential Store
|
# Shared credential rtore
|
||||||
New-CredentialStore -Shared
|
New-CredentialStore -Shared
|
||||||
|
|
||||||
#Shared CredentialStore in custom Location
|
#Shared credential store in custom Location
|
||||||
New-CredentialStore -Shared -Path 'C:\CredentialStore.json'
|
New-CredentialStore -Shared -Path 'C:\CredentialStore.json'
|
||||||
```
|
```
|
||||||
|
|
||||||
**2.** Now you can manage your CredentialStoreItems:
|
**2.** Now you can manage your credential store items:
|
||||||
```powershell
|
```powershell
|
||||||
# This will prompt for credentials and stores it in a private store
|
# This will prompt for credentials and stores it in a private store
|
||||||
New-CredentialStoreItem -RemoteHost 'dc01.myside.local' -Identifier 'AD'
|
New-CredentialStoreItem -RemoteHost 'dc01.myside.local' -Identifier 'AD'
|
||||||
@ -62,8 +68,8 @@ $DCCreds = Get-CredentialStoreItem -RemoteHost 'dc01.myside.local' -Identifier '
|
|||||||
Invoke-Command -ComputerName 'dc01.myside.local' -Credential $DCCreds -ScripBlock {Get-Process}
|
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.
|
The credential store 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:
|
If you have already installed the underlying framework / modules, you can connect these endpoints:
|
||||||
|
|
||||||
* **CiscoUcs** - Establish a connection to a Cisco UCS fabric interconnect.
|
* **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)
|
* Required Modules: [`Cisco.UCS.Core`, `Cisco.UCSManager`](https://software.cisco.com/download/release.html?i=!y&mdfid=286305108&softwareid=284574017&release=2.1.1)
|
||||||
@ -73,6 +79,14 @@ If you have already installed the underlying framework your can connect to:
|
|||||||
* Required Modules: [`DataONTAP`](http://mysupport.netapp.com/tools/info/ECMLP2310788I.html?productID=61926)
|
* Required Modules: [`DataONTAP`](http://mysupport.netapp.com/tools/info/ECMLP2310788I.html?productID=61926)
|
||||||
* **VMware** - Establish a connection to a VMware vCenter or ESXi host.
|
* **VMware** - Establish a connection to a VMware vCenter or ESXi host.
|
||||||
* Required Modules: [`VMware.VimAutomation.Core`](https://www.powershellgallery.com/packages/VMware.PowerCLI)
|
* 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)
|
||||||
|
|
||||||
Here are some basic examples:
|
Here are some basic examples:
|
||||||
|
|
||||||
@ -81,4 +95,5 @@ Connect-To -RemoteHost "ucs.myside.local" -Type CiscoUcs
|
|||||||
Connect-To -RemoteHost "ftp.myside.local" -Type FTP
|
Connect-To -RemoteHost "ftp.myside.local" -Type FTP
|
||||||
Connect-To -RemoteHost "fas.myside.local" -Type NetAppFAS
|
Connect-To -RemoteHost "fas.myside.local" -Type NetAppFAS
|
||||||
Connect-To -RemoteHost "esx01.myside.local" -Type VMware
|
Connect-To -RemoteHost "esx01.myside.local" -Type VMware
|
||||||
|
Connect-To -RemoteHost "vcr.myside.local" -Type CisServer
|
||||||
```
|
```
|
||||||
|
42
appveyor.yml
42
appveyor.yml
@ -1,4 +1,4 @@
|
|||||||
version: 0.1.{build}
|
version: 0.2.1.{build}
|
||||||
|
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
@ -13,16 +13,14 @@ skip_tags: true
|
|||||||
image: Visual Studio 2017
|
image: Visual Studio 2017
|
||||||
|
|
||||||
# Install pester module and init the Appveyor support.
|
# Install pester module and init the Appveyor support.
|
||||||
|
|
||||||
|
# Enable RDP connection for debugging
|
||||||
|
#init:
|
||||||
|
# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- ps: Install-PackageProvider -Name NuGet -MinimumVersion '2.8.5.201' -Force -Verbose
|
|
||||||
- ps: Import-PackageProvider NuGet -MinimumVersion '2.8.5.201' -Force
|
|
||||||
- ps: Install-Module -Name 'Pester' -Scope CurrentUser -Force -SkipPublisherCheck -AllowClobber
|
|
||||||
- ps: Update-Module 'Pester'
|
|
||||||
- ps: Install-Module -Name 'posh-git' -Scope CurrentUser -Force -SkipPublisherCheck -AllowClobber
|
|
||||||
- ps: Update-Module 'posh-git'
|
|
||||||
- ps: Install-Module -Name 'PSCoverage' -Scope CurrentUser -Force -SkipPublisherCheck -AllowClobber
|
|
||||||
- ps: Import-Module 'PSCoverage'
|
|
||||||
- ps: Import-Module .\tools\AppVeyor.psm1
|
- ps: Import-Module .\tools\AppVeyor.psm1
|
||||||
|
- ps: Invoke-InstallDependencies -Verbose
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
NuGetToken:
|
NuGetToken:
|
||||||
@ -40,17 +38,35 @@ build_script:
|
|||||||
|
|
||||||
test_script:
|
test_script:
|
||||||
- ps: Invoke-AppVeyorTests
|
- ps: Invoke-AppVeyorTests
|
||||||
- ps: Invoke-CoverageReport
|
- ps: |
|
||||||
|
if ($null -ne $Env:CoverallsToken) {
|
||||||
|
Invoke-CoverageReport
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Warning "No CoverallsToken found. This build seems to be triggered by a PR. Skipping this step..."
|
||||||
|
}
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
|
#- provider: GitHub
|
||||||
|
# auth_token:
|
||||||
|
# secure: M+bBX5/nKdJB0eViP7xtrLVTwf3vGDUA9N2MMprZp2i+9ZR3CBVcJnSzJWUmalhB
|
||||||
|
# artifact: PSCredentialStore.zip # upload all NuGet packages to release assets
|
||||||
|
# draft: true
|
||||||
|
# prerelease: true
|
||||||
|
# on:
|
||||||
|
# branch: dev
|
||||||
- provider: GitHub
|
- provider: GitHub
|
||||||
auth_token:
|
auth_token:
|
||||||
secure: M+bBX5/nKdJB0eViP7xtrLVTwf3vGDUA9N2MMprZp2i+9ZR3CBVcJnSzJWUmalhB
|
secure: M+bBX5/nKdJB0eViP7xtrLVTwf3vGDUA9N2MMprZp2i+9ZR3CBVcJnSzJWUmalhB
|
||||||
artifact: PSCredentialStore.zip # upload all NuGet packages to release assets
|
artifact: PSCredentialStore.zip # upload all NuGet packages to release assets
|
||||||
draft: false
|
draft: false
|
||||||
prerelease: true
|
prerelease: false
|
||||||
on:
|
on:
|
||||||
branch: master # release from master branch only
|
branch: master # build release on master branch changes
|
||||||
|
|
||||||
after_deploy:
|
after_deploy:
|
||||||
- ps: Invoke-AppVeyorPSGallery
|
- ps: Invoke-AppVeyorPSGallery -OnBranch 'master'
|
||||||
|
|
||||||
|
# Pause build until `lock` on desktop is deleted.
|
||||||
|
#on_finish:
|
||||||
|
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||||
|
1
docs/.gitkeep
Normal file
1
docs/.gitkeep
Normal file
@ -0,0 +1 @@
|
|||||||
|
This is a placeholder file.
|
189
docs/Connect-To.md
Normal file
189
docs/Connect-To.md
Normal file
@ -0,0 +1,189 @@
|
|||||||
|
---
|
||||||
|
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 <String> [-Identifier <String>] -Type <String> [-Credentials <PSCredential>]
|
||||||
|
[<CommonParameters>]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Shared
|
||||||
|
```
|
||||||
|
Connect-To -RemoteHost <String> [-Identifier <String>] -Type <String> [-Credentials <PSCredential>]
|
||||||
|
[-Path <String>] [-Shared] [<CommonParameters>]
|
||||||
|
```
|
||||||
|
|
||||||
|
## 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)
|
||||||
|
|
133
docs/Disconnect-From.md
Normal file
133
docs/Disconnect-From.md
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
---
|
||||||
|
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] <String> [-Type] <String> [-Force] [<CommonParameters>]
|
||||||
|
```
|
||||||
|
|
||||||
|
## 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)
|
||||||
|
|
95
docs/Get-CredentialStore.md
Normal file
95
docs/Get-CredentialStore.md
Normal file
@ -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-CredentialStore
|
||||||
|
|
||||||
|
## SYNOPSIS
|
||||||
|
Reads the complete content of the credential store and returns it as a new object.
|
||||||
|
|
||||||
|
## SYNTAX
|
||||||
|
|
||||||
|
### Private (Default)
|
||||||
|
```
|
||||||
|
Get-CredentialStore [<CommonParameters>]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Shared
|
||||||
|
```
|
||||||
|
Get-CredentialStore [-Path <String>] [-Shared] [<CommonParameters>]
|
||||||
|
```
|
||||||
|
|
||||||
|
## 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: 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
|
||||||
|
|
||||||
|
### [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)
|
||||||
|
|
125
docs/Get-CredentialStoreItem.md
Normal file
125
docs/Get-CredentialStoreItem.md
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
---
|
||||||
|
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 <String> [-Identifier <String>] [<CommonParameters>]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Shared
|
||||||
|
```
|
||||||
|
Get-CredentialStoreItem [-Path <String>] -RemoteHost <String> [-Identifier <String>] [-Shared]
|
||||||
|
[<CommonParameters>]
|
||||||
|
```
|
||||||
|
|
||||||
|
## 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: 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
|
||||||
|
|
||||||
|
### [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)
|
||||||
|
|
134
docs/New-CredentialStore.md
Normal file
134
docs/New-CredentialStore.md
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
---
|
||||||
|
external help file: PSCredentialStore-help.xml
|
||||||
|
Module Name: PSCredentialStore
|
||||||
|
online version: https://github.com/OCram85/PSCredentialStore
|
||||||
|
schema: 2.0.0
|
||||||
|
---
|
||||||
|
|
||||||
|
# New-CredentialStore
|
||||||
|
|
||||||
|
## SYNOPSIS
|
||||||
|
Creates a new credential store File
|
||||||
|
|
||||||
|
## SYNTAX
|
||||||
|
|
||||||
|
### Private (Default)
|
||||||
|
```
|
||||||
|
New-CredentialStore [-Force] [<CommonParameters>]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Shared
|
||||||
|
```
|
||||||
|
New-CredentialStore [-Shared] [-Path <String>] [-Force] [<CommonParameters>]
|
||||||
|
```
|
||||||
|
|
||||||
|
## DESCRIPTION
|
||||||
|
You need to run this script first to create a new credential store before you try to
|
||||||
|
save new credentials with New-CredentialStoreItem.
|
||||||
|
|
||||||
|
## EXAMPLES
|
||||||
|
|
||||||
|
### EXAMPLE 1
|
||||||
|
```
|
||||||
|
New-CredentialStore
|
||||||
|
```
|
||||||
|
|
||||||
|
# Creates a new private CredentialStore
|
||||||
|
|
||||||
|
### EXAMPLE 2
|
||||||
|
```
|
||||||
|
New-CredentialStore -Force
|
||||||
|
```
|
||||||
|
|
||||||
|
# Resets an existing private CredentialStore
|
||||||
|
|
||||||
|
### EXAMPLE 3
|
||||||
|
```
|
||||||
|
New-CredentialStore -Shared
|
||||||
|
```
|
||||||
|
|
||||||
|
# Creates a new shared CredentialStore
|
||||||
|
|
||||||
|
### EXAMPLE 4
|
||||||
|
```
|
||||||
|
New-CredentialStore -Shared -Path "C:\TMP\CredentialStore.json"
|
||||||
|
```
|
||||||
|
|
||||||
|
# Creates a new shared CredentialStore in the given location.
|
||||||
|
|
||||||
|
## PARAMETERS
|
||||||
|
|
||||||
|
### -Force
|
||||||
|
Use this switch to reset an existing store.
|
||||||
|
The complete content will be wiped.
|
||||||
|
|
||||||
|
```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: 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
|
||||||
|
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: 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 : New-CredentialStore.ps1
|
||||||
|
Author : Marco Blessing - marco.blessing@googlemail.com
|
||||||
|
Requires :
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
## RELATED LINKS
|
||||||
|
|
||||||
|
[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore)
|
||||||
|
|
143
docs/New-CredentialStoreItem.md
Normal file
143
docs/New-CredentialStoreItem.md
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
---
|
||||||
|
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 <String> [-Identifier <String>] [-Credential <PSCredential>]
|
||||||
|
[<CommonParameters>]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Shared
|
||||||
|
```
|
||||||
|
New-CredentialStoreItem [-Path <String>] -RemoteHost <String> [-Identifier <String>]
|
||||||
|
[-Credential <PSCredential>] [-Shared] [<CommonParameters>]
|
||||||
|
```
|
||||||
|
|
||||||
|
## 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: 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
|
||||||
|
```
|
||||||
|
|
||||||
|
### -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: 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 : New-CredentialStoreItem.ps1
|
||||||
|
Author : Marco Blessing - marco.blessing@googlemail.com
|
||||||
|
Requires :
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
## RELATED LINKS
|
||||||
|
|
||||||
|
[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore)
|
||||||
|
|
46
docs/PSCredentialStore.md
Normal file
46
docs/PSCredentialStore.md
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
---
|
||||||
|
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)
|
||||||
|
{{Manually Enter Connect-To Description Here}}
|
||||||
|
|
||||||
|
### [Disconnect-From](Disconnect-From.md)
|
||||||
|
{{Manually Enter Disconnect-From Description Here}}
|
||||||
|
|
||||||
|
### [Get-CredentialStore](Get-CredentialStore.md)
|
||||||
|
{{Manually Enter Get-CredentialStore Description Here}}
|
||||||
|
|
||||||
|
### [Get-CredentialStoreItem](Get-CredentialStoreItem.md)
|
||||||
|
{{Manually Enter Get-CredentialStoreItem Description Here}}
|
||||||
|
|
||||||
|
### [New-CredentialStore](New-CredentialStore.md)
|
||||||
|
{{Manually Enter New-CredentialStore Description Here}}
|
||||||
|
|
||||||
|
### [New-CredentialStoreItem](New-CredentialStoreItem.md)
|
||||||
|
{{Manually Enter New-CredentialStoreItem Description Here}}
|
||||||
|
|
||||||
|
### [Remove-CredentialStoreItem](Remove-CredentialStoreItem.md)
|
||||||
|
{{Manually Enter Remove-CredentialStoreItem Description Here}}
|
||||||
|
|
||||||
|
### [Set-CredentialStoreItem](Set-CredentialStoreItem.md)
|
||||||
|
{{Manually Enter Set-CredentialStoreItem Description Here}}
|
||||||
|
|
||||||
|
### [Test-CredentialStore](Test-CredentialStore.md)
|
||||||
|
{{Manually Enter Test-CredentialStore Description Here}}
|
||||||
|
|
||||||
|
### [Test-CredentialStoreItem](Test-CredentialStoreItem.md)
|
||||||
|
{{Manually Enter Test-CredentialStoreItem Description Here}}
|
||||||
|
|
||||||
|
### [Test-CSConnection](Test-CSConnection.md)
|
||||||
|
{{Manually Enter Test-CSConnection Description Here}}
|
||||||
|
|
126
docs/Remove-CredentialStoreItem.md
Normal file
126
docs/Remove-CredentialStoreItem.md
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
---
|
||||||
|
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 <String> [-Identifier <String>] [<CommonParameters>]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Shared
|
||||||
|
```
|
||||||
|
Remove-CredentialStoreItem [-Path <String>] -RemoteHost <String> [-Identifier <String>] [-Shared]
|
||||||
|
[<CommonParameters>]
|
||||||
|
```
|
||||||
|
|
||||||
|
## 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: 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 : Remove-CredentialStoreItem.ps1
|
||||||
|
Author : Marco Blessing - marco.blessing@googlemail.com
|
||||||
|
Requires :
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
## RELATED LINKS
|
||||||
|
|
||||||
|
[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore)
|
||||||
|
|
126
docs/Set-CredentialStoreItem.md
Normal file
126
docs/Set-CredentialStoreItem.md
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
---
|
||||||
|
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 <String> [-Identifier <String>] [<CommonParameters>]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Shared
|
||||||
|
```
|
||||||
|
Set-CredentialStoreItem [-Path <String>] -RemoteHost <String> [-Identifier <String>] [-Shared]
|
||||||
|
[<CommonParameters>]
|
||||||
|
```
|
||||||
|
|
||||||
|
## 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
|
||||||
|
|
||||||
|
### -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: 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 : Set-CredentialStoreItem.ps1
|
||||||
|
Author : Marco Blessing - marco.blessing@googlemail.com
|
||||||
|
Requires :
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
## RELATED LINKS
|
||||||
|
|
||||||
|
[https://github.com/OCram85/PSCredentialStore](https://github.com/OCram85/PSCredentialStore)
|
||||||
|
|
83
docs/Test-CSConnection.md
Normal file
83
docs/Test-CSConnection.md
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
---
|
||||||
|
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] <String> [-Type] <String> [<CommonParameters>]
|
||||||
|
```
|
||||||
|
|
||||||
|
## 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)
|
||||||
|
|
91
docs/Test-CredentialStore.md
Normal file
91
docs/Test-CredentialStore.md
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
---
|
||||||
|
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 [<CommonParameters>]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Shared
|
||||||
|
```
|
||||||
|
Test-CredentialStore [-Path <String>] [-Shared] [<CommonParameters>]
|
||||||
|
```
|
||||||
|
|
||||||
|
## 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: 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
|
||||||
|
|
||||||
|
## 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)
|
||||||
|
|
134
docs/Test-CredentialStoreItem.md
Normal file
134
docs/Test-CredentialStoreItem.md
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
---
|
||||||
|
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 <String> [-Identifier <String>] [<CommonParameters>]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Shared
|
||||||
|
```
|
||||||
|
Test-CredentialStoreItem [-Path <String>] -RemoteHost <String> [-Identifier <String>] [-Shared]
|
||||||
|
[<CommonParameters>]
|
||||||
|
```
|
||||||
|
|
||||||
|
## 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)
|
||||||
|
|
102
docs/about_PSCredentialStore.md
Normal file
102
docs/about_PSCredentialStore.md
Normal file
@ -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
|
38
resources/Dependency.json
Normal file
38
resources/Dependency.json
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
{
|
||||||
|
"Version": 0.1,
|
||||||
|
"Mandatory": {},
|
||||||
|
"Optional": [
|
||||||
|
{
|
||||||
|
"Name": "foobar2000",
|
||||||
|
"Modules": [
|
||||||
|
"foobar2000"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "foo",
|
||||||
|
"Modules": [
|
||||||
|
"foo",
|
||||||
|
"bar"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "bar",
|
||||||
|
"Modules": [
|
||||||
|
"bar"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "Existing",
|
||||||
|
"Modules": [
|
||||||
|
"PowerShellGet"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "PSGetMixed",
|
||||||
|
"Modules": [
|
||||||
|
"PowerShellGet",
|
||||||
|
"foobar2000"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -19,10 +19,11 @@ function Get-ChallengeFile {
|
|||||||
.\Get-RandomKey -Path "C:\TMP\Challenge.bin"
|
.\Get-RandomKey -Path "C:\TMP\Challenge.bin"
|
||||||
|
|
||||||
.NOTES
|
.NOTES
|
||||||
|
```
|
||||||
File Name : Get-ChallengeFile.ps1
|
File Name : Get-ChallengeFile.ps1
|
||||||
Author : Marco Blessing - marco.blessing@googlemail.com
|
Author : Marco Blessing - marco.blessing@googlemail.com
|
||||||
Requires :
|
Requires :
|
||||||
|
```
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/OCram85/PSCredentialStore
|
https://github.com/OCram85/PSCredentialStore
|
||||||
#>
|
#>
|
||||||
|
@ -14,11 +14,8 @@ function Connect-To {
|
|||||||
same hostname.
|
same hostname.
|
||||||
|
|
||||||
.PARAMETER Type
|
.PARAMETER Type
|
||||||
Specify the host type of the target. Currently implemented targets are:
|
Specify the host type of the target. Currently implemented targets are: Possible connection values are:
|
||||||
- CiscoUcs Establish a connection to a Cisco UCS fabric interconnect.
|
CiscoUcs, FTP, NetAppFAS, VMware, CisServer, ExchangeHTTP, ExchangeHTTPS, SCP.
|
||||||
- FTP Establish a connection to a FTP host.
|
|
||||||
- NetAppFAS Establish a connection to a NetApp Clustered ONTAP filer.
|
|
||||||
- VMware Establish a connection to a VMware vCenter or ESXi host.
|
|
||||||
|
|
||||||
.PARAMETER Credentials
|
.PARAMETER Credentials
|
||||||
Use this parameter to bypass the stored credentials. Without this parameter Connect-To tries to read the
|
Use this parameter to bypass the stored credentials. Without this parameter Connect-To tries to read the
|
||||||
@ -40,38 +37,57 @@ function Connect-To {
|
|||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Connect-To -RemoteHost "ucs.myside.local" -Type CiscoUcs
|
Connect-To -RemoteHost "ucs.myside.local" -Type CiscoUcs
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
Connect-To -RemoteHost "ftp.myside.local" -Type FTP
|
Connect-To -RemoteHost "ftp.myside.local" -Type FTP
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
Connect-To -RemoteHost "fas.myside.local" -Type NetAppFAS
|
Connect-To -RemoteHost "fas.myside.local" -Type NetAppFAS
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
Connect-To -RemoteHost "esx01.myside.local" -Type VMware
|
Connect-To -RemoteHost "esx01.myside.local" -Type VMware
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
$MyCreds = Get-Credential
|
Connect-To -RemoteHost "vCenter.myside.local" -Type CisServer
|
||||||
Connect-To -RemoteHost "vcr01.myside.local" -Type VMware -Credentials $MyCreds
|
|
||||||
Get-VM -Name "*vlm*" | Select-Object -Property Name
|
.EXAMPLE
|
||||||
Disconnect-From -RemoteHost "vcr01.myside.local" -Type VMware
|
Connect-To -RemoteHost "exchange01.myside.local" -Type ExchangeHTTP
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
Connect-To -RemoteHost "exchange01.myside.local" -Type ExchangeHTTPS
|
||||||
|
|
||||||
.NOTES
|
.NOTES
|
||||||
File Name : Connect-To.ps1
|
File Name : Connect-To.ps1
|
||||||
Author : Marco Blessing - marco.blessing@googlemail.com
|
Author : Marco Blessing - marco.blessing@googlemail.com
|
||||||
Requires : PSFTP, PowerCLI
|
Requires :
|
||||||
|
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/OCram85/PSCredentialStore
|
https://github.com/OCram85/PSCredentialStore
|
||||||
#>
|
#>
|
||||||
|
|
||||||
[CmdletBinding(DefaultParameterSetName = "Private")]
|
[CmdletBinding(DefaultParameterSetName = "Private")]
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory = $true, ParameterSetName = "Shared")]
|
[Parameter(Mandatory = $true, ParameterSetName = "Shared")]
|
||||||
[Parameter(Mandatory = $true, ParameterSetName = "Private")]
|
[Parameter(Mandatory = $true, ParameterSetName = "Private")]
|
||||||
[String]$RemoteHost,
|
[string]$RemoteHost,
|
||||||
|
|
||||||
[Parameter(Mandatory = $false, ParameterSetName = "Shared")]
|
[Parameter(Mandatory = $false, ParameterSetName = "Shared")]
|
||||||
[Parameter(Mandatory = $false, ParameterSetName = "Private")]
|
[Parameter(Mandatory = $false, ParameterSetName = "Private")]
|
||||||
[String]$Identifier,
|
[string]$Identifier,
|
||||||
|
|
||||||
[Parameter(Mandatory = $true, ParameterSetName = "Shared")]
|
[Parameter(Mandatory = $true, ParameterSetName = "Shared")]
|
||||||
[Parameter(Mandatory = $true, ParameterSetName = "Private")]
|
[Parameter(Mandatory = $true, ParameterSetName = "Private")]
|
||||||
[ValidateSet("CiscoUcs", "FTP", "NetAppFAS", "VMware")]
|
[ValidateSet(
|
||||||
[String]$Type,
|
'CiscoUcs',
|
||||||
|
'FTP',
|
||||||
|
'NetAppFAS',
|
||||||
|
'VMware',
|
||||||
|
'CisServer',
|
||||||
|
'ExchangeHTTP',
|
||||||
|
'ExchangeHTTPS',
|
||||||
|
'SCP'
|
||||||
|
)]
|
||||||
|
[string]$Type,
|
||||||
|
|
||||||
[Parameter(Mandatory = $False, ParameterSetName = "Shared")]
|
[Parameter(Mandatory = $False, ParameterSetName = "Shared")]
|
||||||
[Parameter(Mandatory = $False, ParameterSetName = "Private")]
|
[Parameter(Mandatory = $False, ParameterSetName = "Private")]
|
||||||
@ -79,10 +95,10 @@ function Connect-To {
|
|||||||
|
|
||||||
[Parameter(Mandatory = $False, ParameterSetName = "Shared")]
|
[Parameter(Mandatory = $False, ParameterSetName = "Shared")]
|
||||||
[ValidateNotNullOrEmpty()]
|
[ValidateNotNullOrEmpty()]
|
||||||
[String]$Path = "{0}\PSCredentialStore\CredentialStore.json" -f $env:ProgramData,
|
[string]$Path = "{0}\PSCredentialStore\CredentialStore.json" -f $env:ProgramData,
|
||||||
|
|
||||||
[Parameter(Mandatory = $false, ParameterSetNAme = "Shared")]
|
[Parameter(Mandatory = $false, ParameterSetNAme = "Shared")]
|
||||||
[Switch]$Shared
|
[switch]$Shared
|
||||||
)
|
)
|
||||||
|
|
||||||
begin {
|
begin {
|
||||||
@ -123,7 +139,11 @@ function Connect-To {
|
|||||||
}
|
}
|
||||||
|
|
||||||
catch {
|
catch {
|
||||||
Write-Message2 ("Unable to look up credential store item for RemoteHost {0}/Identifier {1}!" -f $RemoteHost, $Identifier) -ErrorAction Stop
|
$MessageParams = @{
|
||||||
|
Message = "Unable to look up credential store item for RemoteHost {0}/Identifier {1}!" -f $RemoteHost, $Identifier
|
||||||
|
ErrorAction = "Stop"
|
||||||
|
}
|
||||||
|
Write-Error @MessageParams
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -131,8 +151,11 @@ function Connect-To {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($creds.UserName -eq "" -or $creds.Password.GetType().Name -ne "SecureString") {
|
if ($creds.UserName -eq "" -or $creds.Password.GetType().Name -ne "SecureString") {
|
||||||
# Write a error message to the log.
|
$MessageParams = @{
|
||||||
Write-Message2 ("Please provide valid credentials for RemoteHost {0}!" -f $RemoteHost) -ErrorAction Stop
|
Message = "Please provide valid credentials for RemoteHost {0}!" -f $RemoteHost
|
||||||
|
ErrorAction = "Stop"
|
||||||
|
}
|
||||||
|
Write-Error @MessageParams
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
switch ($Type) {
|
switch ($Type) {
|
||||||
@ -143,8 +166,11 @@ function Connect-To {
|
|||||||
}
|
}
|
||||||
|
|
||||||
catch {
|
catch {
|
||||||
# Write a error message to the log.
|
$MessageParams = @{
|
||||||
Write-Message2 ("Unable to connect to {0} using Type {1}." -f $RemoteHost, $Type) -ErrorAction Stop
|
Message = "Unable to connect to {0} using Type {1}." -f $RemoteHost, $Type
|
||||||
|
ErrorAction = "Stop"
|
||||||
|
}
|
||||||
|
Write-Error @MessageParams
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"FTP" {
|
"FTP" {
|
||||||
@ -199,6 +225,88 @@ function Connect-To {
|
|||||||
Write-Error @MessageParams
|
Write-Error @MessageParams
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
"CisServer" {
|
||||||
|
try {
|
||||||
|
Connect-CisServer -Server $RemoteHost -Credential $creds -ErrorAction Stop | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
catch {
|
||||||
|
# Write a error message to the log.
|
||||||
|
$MessageParams = @{
|
||||||
|
Message = "Unable to connect to {0} using Type {1}." -f $RemoteHost, $Type
|
||||||
|
ErrorAction = "Stop"
|
||||||
|
}
|
||||||
|
Write-Error @MessageParams
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"ExchangeHTTP" {
|
||||||
|
try {
|
||||||
|
$ConnectionParams = @{
|
||||||
|
ConnectionURI = "http://{0}/powershell" -f $RemoteHost
|
||||||
|
ConfigurationName = 'Microsoft.Exchange'
|
||||||
|
Credential = $creds
|
||||||
|
ErrorAction = 'Stop'
|
||||||
|
}
|
||||||
|
$Global:PSExchangeRemote = New-PSSession @ConnectionParams
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
# Write a error message to the log.
|
||||||
|
$MessageParams = @{
|
||||||
|
Message = "Unable to connect to {0} using Type {1}." -f $RemoteHost, $Type
|
||||||
|
ErrorAction = "Stop"
|
||||||
|
}
|
||||||
|
Write-Error @MessageParams
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"ExchangeHTTPS" {
|
||||||
|
try {
|
||||||
|
$ConnectionParams = @{
|
||||||
|
ConnectionURI = "https://{0}/powershell" -f $RemoteHost
|
||||||
|
ConfigurationName = 'Microsoft.Exchange'
|
||||||
|
Credential = $creds
|
||||||
|
ErrorAction = 'Stop'
|
||||||
|
}
|
||||||
|
$Global:PSExchangeRemote = New-PSSession @ConnectionParams
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
# Write a error message to the log.
|
||||||
|
$MessageParams = @{
|
||||||
|
Message = "Unable to connect to {0} using Type {1}." -f $RemoteHost, $Type
|
||||||
|
ErrorAction = "Stop"
|
||||||
|
}
|
||||||
|
Write-Error @MessageParams
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"SCP" {
|
||||||
|
$WinSCPSessionParams = @{
|
||||||
|
Credential = $creds
|
||||||
|
Hostname = $RemoteHost
|
||||||
|
Protocol = 'Scp'
|
||||||
|
GiveUpSecurityAndAcceptAnySshHostKey = $True
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
$SessionOption = New-WinSCPSessionOption @WinSCPSessionParams
|
||||||
|
$Global:WinSCPSession = New-WinSCPSession -SessionOption $SessionOption
|
||||||
|
Write-Verbose -Message ("SCP Connection established with {0}" -f $Global:WinSCPSession.Hostname)
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
# Write a error message to the log.
|
||||||
|
$MessageParams = @{
|
||||||
|
Message = "Unable to connect to {0} using Type {1}." -f $RemoteHost, $Type
|
||||||
|
ErrorAction = "Stop"
|
||||||
|
}
|
||||||
|
Write-Error @MessageParams
|
||||||
|
}
|
||||||
|
# Check the Connection State
|
||||||
|
if (!($WinSCPSession.Opened)) {
|
||||||
|
# Check the connection state and find out if the session is still open.
|
||||||
|
$MessageParams = @{
|
||||||
|
Message = "Connection to {0} using Type {1} was established. But now it seems to be lost!" -f $RemoteHost, $Type
|
||||||
|
ErrorAction = "Stop"
|
||||||
|
}
|
||||||
|
Write-Error @MessageParams
|
||||||
|
}
|
||||||
|
}
|
||||||
default {
|
default {
|
||||||
# Write a error message to the log.
|
# Write a error message to the log.
|
||||||
$MessageParams = @{
|
$MessageParams = @{
|
||||||
|
@ -14,11 +14,8 @@ function Disconnect-From {
|
|||||||
same hostname.
|
same hostname.
|
||||||
|
|
||||||
.PARAMETER Type
|
.PARAMETER Type
|
||||||
Specify the host type of the target. Currently implemented targets are:
|
Specify the host type of the target. Currently implemented targets are: CiscoUcs, FTP, NetAppFAS, VMware,
|
||||||
- CiscoUcs Establish a connection to a Cisco UCS Fabric Interconnect.
|
CisServer, ExchangeHTTP, ExchangeHTTPS, SCP.
|
||||||
- FTP Establish a connection to a FTP host.
|
|
||||||
- NetAppFAS Establish a connection to a NetApp Clustered ONTAP filer.
|
|
||||||
- VMware Establish a connection to a VMware vCenter or ESXi host.
|
|
||||||
|
|
||||||
.PARAMETER Force
|
.PARAMETER Force
|
||||||
Force the disconnect, even if the disconnect would fail.
|
Force the disconnect, even if the disconnect would fail.
|
||||||
@ -44,8 +41,17 @@ function Disconnect-From {
|
|||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Disconnect-From -RemoteHost "esx01.myside.local" -Type VMware -Force:$True
|
Disconnect-From -RemoteHost "esx01.myside.local" -Type VMware -Force:$True
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
Disconnect-From -RemoteHost "vcenter.myside.local" -Type CisServer
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
Disconnect-From -RemoteHost "exchange01.myside.local" -Type ExchangeHTTP
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
Disconnect-From -RemoteHost "exchange01.myside.local" -Type ExchangeHTTPS
|
||||||
|
|
||||||
.NOTES
|
.NOTES
|
||||||
File Name : Disconnect-To.ps1
|
File Name : Disconnect-From.ps1
|
||||||
Author : Marco Blessing - marco.blessing@googlemail.com
|
Author : Marco Blessing - marco.blessing@googlemail.com
|
||||||
Requires :
|
Requires :
|
||||||
|
|
||||||
@ -59,14 +65,23 @@ function Disconnect-From {
|
|||||||
[string]$RemoteHost,
|
[string]$RemoteHost,
|
||||||
|
|
||||||
[Parameter(Mandatory = $true)]
|
[Parameter(Mandatory = $true)]
|
||||||
[ValidateSet("CiscoUcs", "FTP", "NetAppFAS", "VMware")]
|
[ValidateSet(
|
||||||
|
'CiscoUcs',
|
||||||
|
'FTP',
|
||||||
|
'NetAppFAS',
|
||||||
|
'VMware',
|
||||||
|
'CisServer',
|
||||||
|
'ExchangeHTTP',
|
||||||
|
'ExchangeHTTPS',
|
||||||
|
'SCP'
|
||||||
|
)]
|
||||||
[string]$Type,
|
[string]$Type,
|
||||||
|
|
||||||
[Parameter(Mandatory = $false)]
|
[Parameter(Mandatory = $false)]
|
||||||
[switch]$Force
|
[switch]$Force
|
||||||
)
|
)
|
||||||
|
|
||||||
switch ($Type) {
|
switch -Regex ($Type) {
|
||||||
"VMware" {
|
"VMware" {
|
||||||
try {
|
try {
|
||||||
if ($Force) {
|
if ($Force) {
|
||||||
@ -85,7 +100,25 @@ function Disconnect-From {
|
|||||||
}
|
}
|
||||||
Write-Error @MessageParams
|
Write-Error @MessageParams
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
"CisServer" {
|
||||||
|
try {
|
||||||
|
if ($Force) {
|
||||||
|
Disconnect-CisServer -Server $RemoteHost -Confirm:$false -ErrorAction Stop -Force:$true
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Disconnect-CisServer -Server $RemoteHost -Confirm:$false -ErrorAction Stop
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
catch {
|
||||||
|
# Write a error message to the log.
|
||||||
|
$MessageParams = @{
|
||||||
|
Message = "Unable to disconnect from {0} using Type {1}." -f $RemoteHost, $Type
|
||||||
|
ErrorAction = "Stop"
|
||||||
|
}
|
||||||
|
Write-Error @MessageParams
|
||||||
|
}
|
||||||
}
|
}
|
||||||
# Check for an existing WinSCP Session var
|
# Check for an existing WinSCP Session var
|
||||||
"FTP" {
|
"FTP" {
|
||||||
@ -111,6 +144,7 @@ function Disconnect-From {
|
|||||||
Write-Verbose @MessageParams
|
Write-Verbose @MessageParams
|
||||||
$Global:CurrentNcController = $null
|
$Global:CurrentNcController = $null
|
||||||
}
|
}
|
||||||
|
|
||||||
catch {
|
catch {
|
||||||
# Write a error message to the log.
|
# Write a error message to the log.
|
||||||
$MessageParams = @{
|
$MessageParams = @{
|
||||||
@ -135,6 +169,31 @@ function Disconnect-From {
|
|||||||
Write-Error @MessageParams
|
Write-Error @MessageParams
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
"ExchangeHTTP*" {
|
||||||
|
try {
|
||||||
|
Get-Variable -Name 'PSExchangeRemote' -Scope Global -ErrorAction Stop
|
||||||
|
Remove-PSSession -Session $Global:PSExchangeRemote -ErrorAction Stop
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$MessageParams = @{
|
||||||
|
Message = "Unable to disconnect from {0} using Type {1}." -f $RemoteHost, $Type
|
||||||
|
ErrorAction = "Stop"
|
||||||
|
}
|
||||||
|
Write-Error @MessageParams
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"SCP" {
|
||||||
|
if ($Global:WinSCPSession.Opened) {
|
||||||
|
Remove-WinSCPSession -WinSCPSession $Global:WinSCPSession
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$MessageParams = @{
|
||||||
|
Message = "There is no open WinSCP Session"
|
||||||
|
ErrorAction = "Stop"
|
||||||
|
}
|
||||||
|
Write-Error @MessageParams
|
||||||
|
}
|
||||||
|
}
|
||||||
default {
|
default {
|
||||||
# Write a error message to the log.
|
# Write a error message to the log.
|
||||||
$MessageParams = @{
|
$MessageParams = @{
|
||||||
|
114
src/Connection/Test-CSConnection.ps1
Normal file
114
src/Connection/Test-CSConnection.ps1
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
function Test-CSConnection {
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Returns the connection state of a given type to the remote host.
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
Use this script to check a connection which was established with the `Connect-To` cmdlet.
|
||||||
|
|
||||||
|
.PARAMETER RemoteHost
|
||||||
|
Define the remote host you would like to check.
|
||||||
|
|
||||||
|
.Parameter Type
|
||||||
|
Define the connection type you would like to check. See the `Connect-To` documentation
|
||||||
|
for valid type values.
|
||||||
|
|
||||||
|
.INPUTS
|
||||||
|
[None]
|
||||||
|
|
||||||
|
.OUTPUTS
|
||||||
|
[Boolean]
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
.\Test-CMConnection -RemoteHost "r0-i01-vcr01.p0r.kivbf-cloud.net" -Type VMware
|
||||||
|
|
||||||
|
.NOTES
|
||||||
|
File Name : Test-CSConnection.ps1
|
||||||
|
Author : Marco Blessing - marco.blessing@googlemail.com
|
||||||
|
Requires :
|
||||||
|
|
||||||
|
.LINK
|
||||||
|
https://github.com/OCram85/PSCredentialStore
|
||||||
|
#>
|
||||||
|
|
||||||
|
[CmdletBinding()]
|
||||||
|
[OutputType([boolean])]
|
||||||
|
param(
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
|
[ValidateNotNullOrEmpty()]
|
||||||
|
[string]$RemoteHost,
|
||||||
|
|
||||||
|
[Parameter(Mandatory = $True)]
|
||||||
|
[ValidateNotNullOrEmpty()]
|
||||||
|
[ValidateSet("CiscoUcs", "FTP", "NetAppFAS", "VMware")]
|
||||||
|
[string]$Type
|
||||||
|
)
|
||||||
|
|
||||||
|
switch ($Type) {
|
||||||
|
'VMware' {
|
||||||
|
try {
|
||||||
|
$Conn = Get-Variable -Name DefaultVIServer -Scope Global -ErrorAction Stop
|
||||||
|
}
|
||||||
|
catch [System.Management.Automation.ItemNotFoundException] {
|
||||||
|
$MsgParams = @{
|
||||||
|
Message = "There is no open PowerCLI VMware connection bound to 'DefaultVIServer'."
|
||||||
|
}
|
||||||
|
Write-Verbose @MsgParams
|
||||||
|
return $false
|
||||||
|
}
|
||||||
|
if ($Conn.Value.Name -eq $RemoteHost) {
|
||||||
|
if ($Conn.Value.IsConnected) {
|
||||||
|
$MsgParams = @{
|
||||||
|
Message = "'DefaultVIServer' found. Connection to given remote host already established."
|
||||||
|
}
|
||||||
|
Write-Verbose @MsgParams
|
||||||
|
return $True
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$MsgParams = @{
|
||||||
|
Message = "'DefaultVIServer' found. RemoteHost matches but the connection is closed."
|
||||||
|
}
|
||||||
|
Write-Verbose @MsgParams
|
||||||
|
return $false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
'CiscoUcs' {
|
||||||
|
$MsgParams = @{
|
||||||
|
ErrorAction = "Stop"
|
||||||
|
Message = "CiscoUCS connection test is not implemented yet!"
|
||||||
|
}
|
||||||
|
Write-Error @MsgParams
|
||||||
|
return $false
|
||||||
|
}
|
||||||
|
|
||||||
|
'FTP' {
|
||||||
|
$MsgParams = @{
|
||||||
|
ErrorAction = "Stop"
|
||||||
|
Message = "FTP connection test is not implemented yet!"
|
||||||
|
}
|
||||||
|
Write-Error @MsgParams
|
||||||
|
return $false
|
||||||
|
}
|
||||||
|
|
||||||
|
'NetAppFAS' {
|
||||||
|
$MsgParams = @{
|
||||||
|
ErrorAction = "Stop"
|
||||||
|
Message = "NetAppFAS connection test is not implemented yet!"
|
||||||
|
}
|
||||||
|
Write-Error @MsgParams
|
||||||
|
return $false
|
||||||
|
}
|
||||||
|
|
||||||
|
# The Default section will never be shown as long as the powershell framework isn't broken.
|
||||||
|
Default {
|
||||||
|
$MsgParams = @{
|
||||||
|
ErrorAction = "Stop"
|
||||||
|
Message = "Panic: There is an invalid type value! This error should never be thrown."
|
||||||
|
}
|
||||||
|
Write-Error @MsgParams
|
||||||
|
return $false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -26,6 +26,18 @@
|
|||||||
"Modules": [
|
"Modules": [
|
||||||
"DataONTAP"
|
"DataONTAP"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "CisServer",
|
||||||
|
"Modules": [
|
||||||
|
"VMware.VimAutomation.Cis.Core"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "SCP",
|
||||||
|
"Modules": [
|
||||||
|
"WinSCP"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
29
src/Helper/Get-ModuleBase.ps1
Normal file
29
src/Helper/Get-ModuleBase.ps1
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
function Get-ModuleBase {
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Returns the base path of the current module.
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
This is just a wrapper for enabling pester tests.
|
||||||
|
|
||||||
|
|
||||||
|
.OUTPUTS
|
||||||
|
Returns the base path as string
|
||||||
|
|
||||||
|
.NOTES
|
||||||
|
File Name : Get-ModuleBase.ps1
|
||||||
|
Author : Marco Blessing - marco.blessing@googlemail.com
|
||||||
|
Requires :
|
||||||
|
|
||||||
|
.LINK
|
||||||
|
https://github.com/OCram85/PSCredentialStore
|
||||||
|
#>
|
||||||
|
[CmdletBinding()]
|
||||||
|
[OutputType()]
|
||||||
|
param()
|
||||||
|
begin {}
|
||||||
|
process {
|
||||||
|
return $MyInvocation.MyCommand.Module.ModuleBase
|
||||||
|
}
|
||||||
|
end {}
|
||||||
|
}
|
@ -19,9 +19,11 @@ function Get-RandomKey {
|
|||||||
.\Get-RandomKey -Size 24
|
.\Get-RandomKey -Size 24
|
||||||
|
|
||||||
.NOTES
|
.NOTES
|
||||||
|
```
|
||||||
File Name : Get-RandomKey.ps1
|
File Name : Get-RandomKey.ps1
|
||||||
Author : Marco Blessing - marco.blessing@googlemail.com
|
Author : Marco Blessing - marco.blessing@googlemail.com
|
||||||
Requires :
|
Requires :
|
||||||
|
```
|
||||||
|
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/OCram85/PSCredentialStore
|
https://github.com/OCram85/PSCredentialStore
|
||||||
|
@ -40,9 +40,11 @@ function Resolve-Dependency {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.NOTES
|
.NOTES
|
||||||
|
```
|
||||||
File Name : ResolveDependency.ps1
|
File Name : ResolveDependency.ps1
|
||||||
Author : Marco Blessing - marco.blessing@googlemail.com
|
Author : Marco Blessing - marco.blessing@googlemail.com
|
||||||
Requires :
|
Requires :
|
||||||
|
```
|
||||||
|
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/OCram85/PSCredentialStore
|
https://github.com/OCram85/PSCredentialStore
|
||||||
@ -51,11 +53,12 @@ function Resolve-Dependency {
|
|||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param (
|
param (
|
||||||
[Parameter(Mandatory = $true)]
|
[Parameter(Mandatory = $true)]
|
||||||
|
[ValidateNotNullOrEmpty()]
|
||||||
[string]$Name
|
[string]$Name
|
||||||
)
|
)
|
||||||
|
|
||||||
begin {
|
begin {
|
||||||
$ModuleRootDir = $MyInvocation.MyCommand.Module.ModuleBase
|
$ModuleRootDir = Get-ModuleBase
|
||||||
$DepFilePath = Join-Path -Path $ModuleRootDir -ChildPath "Dependency.json"
|
$DepFilePath = Join-Path -Path $ModuleRootDir -ChildPath "Dependency.json"
|
||||||
if (Test-Path -Path $DepFilePath) {
|
if (Test-Path -Path $DepFilePath) {
|
||||||
$Dependency = Get-Content -Path $DepFilePath -Raw -Encoding UTF8 | ConvertFrom-Json
|
$Dependency = Get-Content -Path $DepFilePath -Raw -Encoding UTF8 | ConvertFrom-Json
|
||||||
@ -63,16 +66,16 @@ function Resolve-Dependency {
|
|||||||
else {
|
else {
|
||||||
Write-Warning ("Could not find the dependency file: {0}" -f $DepFilePath)
|
Write-Warning ("Could not find the dependency file: {0}" -f $DepFilePath)
|
||||||
}
|
}
|
||||||
$res = @()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
process {
|
process {
|
||||||
$SelectedDependency = $Dependency.Optional | Where-Object {$_.Name -match $Name}
|
$SelectedDependency = $Dependency.Optional | Where-Object {$_.Name -match $Name}
|
||||||
|
$res = @()
|
||||||
foreach ($Module in $SelectedDependency.Modules) {
|
foreach ($Module in $SelectedDependency.Modules) {
|
||||||
$res += Test-Module -Name $Module
|
$res += Test-Module -Name $Module
|
||||||
}
|
}
|
||||||
if ($res -contains $false) {
|
# return false if there was not module at all
|
||||||
|
if (($res -contains $false) -or ($res.Count -eq 0)) {
|
||||||
return $false
|
return $false
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -34,9 +34,11 @@ function Test-Module {
|
|||||||
.\Test-Dependency -Name 'VMware.PowerCLI' -Type 'Module' -StopIfFails
|
.\Test-Dependency -Name 'VMware.PowerCLI' -Type 'Module' -StopIfFails
|
||||||
|
|
||||||
.NOTES
|
.NOTES
|
||||||
|
```
|
||||||
File Name : Get-RandomKey.ps1
|
File Name : Get-RandomKey.ps1
|
||||||
Author : Marco Blessing - marco.blessing@googlemail.com
|
Author : Marco Blessing - marco.blessing@googlemail.com
|
||||||
Requires :
|
Requires :
|
||||||
|
```
|
||||||
|
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/OCram85/PSCredentialStore
|
https://github.com/OCram85/PSCredentialStore
|
||||||
|
@ -31,10 +31,11 @@ function Get-CredentialStoreItem {
|
|||||||
$myCreds = Get-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.local"
|
$myCreds = Get-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.local"
|
||||||
|
|
||||||
.NOTES
|
.NOTES
|
||||||
|
```
|
||||||
File Name : Get-CredentialStoreItem.ps1
|
File Name : Get-CredentialStoreItem.ps1
|
||||||
Author : Marco Blessing - marco.blessing@googlemail.com
|
Author : Marco Blessing - marco.blessing@googlemail.com
|
||||||
Requires :
|
Requires :
|
||||||
|
```
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/OCram85/PSCredentialStore
|
https://github.com/OCram85/PSCredentialStore
|
||||||
#>
|
#>
|
||||||
|
@ -31,10 +31,11 @@ function New-CredentialStoreItem {
|
|||||||
New-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.local"
|
New-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.local"
|
||||||
|
|
||||||
.NOTES
|
.NOTES
|
||||||
|
```
|
||||||
File Name : New-CredentialStoreItem.ps1
|
File Name : New-CredentialStoreItem.ps1
|
||||||
Author : Marco Blessing - marco.blessing@googlemail.com
|
Author : Marco Blessing - marco.blessing@googlemail.com
|
||||||
Requires :
|
Requires :
|
||||||
|
```
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/OCram85/PSCredentialStore
|
https://github.com/OCram85/PSCredentialStore
|
||||||
#>
|
#>
|
||||||
|
@ -31,9 +31,11 @@ function Remove-CredentialStoreItem {
|
|||||||
Remove-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.local" -Identifier svc
|
Remove-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.local" -Identifier svc
|
||||||
|
|
||||||
.NOTES
|
.NOTES
|
||||||
|
```
|
||||||
File Name : Remove-CredentialStoreItem.ps1
|
File Name : Remove-CredentialStoreItem.ps1
|
||||||
Author : Marco Blessing - marco.blessing@googlemail.com
|
Author : Marco Blessing - marco.blessing@googlemail.com
|
||||||
Requires :
|
Requires :
|
||||||
|
```
|
||||||
|
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/OCram85/PSCredentialStore
|
https://github.com/OCram85/PSCredentialStore
|
||||||
|
@ -30,9 +30,11 @@ function Set-CredentialStoreItem {
|
|||||||
Set-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.local" -Identifier svc
|
Set-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.local" -Identifier svc
|
||||||
|
|
||||||
.NOTES
|
.NOTES
|
||||||
|
```
|
||||||
File Name : Set-CredentialStoreItem.ps1
|
File Name : Set-CredentialStoreItem.ps1
|
||||||
Author : Marco Blessing - marco.blessing@googlemail.com
|
Author : Marco Blessing - marco.blessing@googlemail.com
|
||||||
Requires :
|
Requires :
|
||||||
|
```
|
||||||
|
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/OCram85/PSCredentialStore
|
https://github.com/OCram85/PSCredentialStore
|
||||||
|
@ -37,9 +37,11 @@ function Test-CredentialStoreItem() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.NOTES
|
.NOTES
|
||||||
|
```
|
||||||
File Name : Test-CredentialStoreItem.ps1
|
File Name : Test-CredentialStoreItem.ps1
|
||||||
Author : Marco Blessing - marco.blessing@googlemail.com
|
Author : Marco Blessing - marco.blessing@googlemail.com
|
||||||
Requires :
|
Requires :
|
||||||
|
```
|
||||||
|
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/OCram85/PSCredentialStore
|
https://github.com/OCram85/PSCredentialStore
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
Copyright = '(c) 2017 OCram85. All rights reserved.'
|
Copyright = '(c) 2017 OCram85. All rights reserved.'
|
||||||
|
|
||||||
# Description of the functionality provided by this module
|
# Description of the functionality provided by this module
|
||||||
Description = 'A simple credential manager to store and reuse multiple credential objecs'
|
Description = 'A simple credential manager to store and reuse multiple credential objects.'
|
||||||
|
|
||||||
# Minimum version of the Windows PowerShell engine required by this module
|
# Minimum version of the Windows PowerShell engine required by this module
|
||||||
PowerShellVersion = '4.0'
|
PowerShellVersion = '4.0'
|
||||||
@ -74,6 +74,7 @@
|
|||||||
# Connection Group
|
# Connection Group
|
||||||
'Connect-To',
|
'Connect-To',
|
||||||
'Disconnect-From',
|
'Disconnect-From',
|
||||||
|
'Test-CSConnection',
|
||||||
# Item Group
|
# Item Group
|
||||||
'Get-CredentialStoreItem',
|
'Get-CredentialStoreItem',
|
||||||
'Set-CredentialStoreItem',
|
'Set-CredentialStoreItem',
|
||||||
|
@ -25,10 +25,11 @@ function Get-CredentialStore {
|
|||||||
$CSContent = Get-CredentialStore -Path "C:\TMP\mystore.json"
|
$CSContent = Get-CredentialStore -Path "C:\TMP\mystore.json"
|
||||||
|
|
||||||
.NOTES
|
.NOTES
|
||||||
|
```
|
||||||
File Name : Get-CredentialStore.ps1
|
File Name : Get-CredentialStore.ps1
|
||||||
Author : Marco Blessing - marco.blessing@googlemail.com
|
Author : Marco Blessing - marco.blessing@googlemail.com
|
||||||
Requires :
|
Requires :
|
||||||
|
```
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/OCram85/PSCredentialStore
|
https://github.com/OCram85/PSCredentialStore
|
||||||
#>
|
#>
|
||||||
|
@ -41,10 +41,11 @@ function New-CredentialStore {
|
|||||||
# Creates a new shared CredentialStore in the given location.
|
# Creates a new shared CredentialStore in the given location.
|
||||||
|
|
||||||
.NOTES
|
.NOTES
|
||||||
|
```
|
||||||
File Name : New-CredentialStore.ps1
|
File Name : New-CredentialStore.ps1
|
||||||
Author : Marco Blessing - marco.blessing@googlemail.com
|
Author : Marco Blessing - marco.blessing@googlemail.com
|
||||||
Requires :
|
Requires :
|
||||||
|
```
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/OCram85/PSCredentialStore
|
https://github.com/OCram85/PSCredentialStore
|
||||||
#>
|
#>
|
||||||
|
@ -15,10 +15,11 @@ function Test-CredentialStore {
|
|||||||
can be decrypted across systems.
|
can be decrypted across systems.
|
||||||
|
|
||||||
.NOTES
|
.NOTES
|
||||||
|
```
|
||||||
File Name : Test-CredentialStore.ps1
|
File Name : Test-CredentialStore.ps1
|
||||||
Author : Marco Blessing - marco.blessing@googlemail.com
|
Author : Marco Blessing - marco.blessing@googlemail.com
|
||||||
Requires :
|
Requires :
|
||||||
|
```
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/OCram85/PSCredentialStore
|
https://github.com/OCram85/PSCredentialStore
|
||||||
#>
|
#>
|
||||||
|
15
tests/00_BasicModule.Tests.ps1
Normal file
15
tests/00_BasicModule.Tests.ps1
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
$RepoRoot = (Get-GitDirectory).replace('\.git', '')
|
||||||
|
|
||||||
|
Describe "Pre-Flight module tests" {
|
||||||
|
$ManifestFilePath = "{0}\src\PSCredentialstore.psd1" -f $RepoRoot
|
||||||
|
Context "Manifest file related" {
|
||||||
|
It "Test the parsed file itsef" {
|
||||||
|
{ Test-ModuleManifest -Path $ManifestFilePath } | Should -Not -Throw
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Context "Module consistency tests" {
|
||||||
|
IT "Importing should work" {
|
||||||
|
{ Import-Module -Name $ManifestFilePath -Global -Force }| Should -Not -Throw
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
53
tests/Helper/01_Resolve-Dependency.Tests.ps1
Normal file
53
tests/Helper/01_Resolve-Dependency.Tests.ps1
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
#region HEADER
|
||||||
|
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||||
|
# $RepoRoot = (Get-Item -Path $here).Parent.Parent.FullName
|
||||||
|
$RepoRoot = (Get-GitDirectory).replace('\.git', '')
|
||||||
|
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.'
|
||||||
|
$sut = $sut -replace "\d{2}`_", ''
|
||||||
|
$suthome = (Get-ChildItem -Path $RepoRoot -Exclude ".\tests\" -Filter $sut -Recurse).FullName
|
||||||
|
# Skip try loading the source file if it doesn't exists.
|
||||||
|
If ($suthome.Length -gt 0) {
|
||||||
|
. $suthome
|
||||||
|
}
|
||||||
|
Else {
|
||||||
|
Write-Warning ("Could not find source file {0}" -f $sut)
|
||||||
|
}
|
||||||
|
|
||||||
|
# load additional functions defined in the repository. Replace the expression <FunctionName>.
|
||||||
|
. (Get-ChildItem -Path $RepoRoot -Filter "Get-ModuleBase.ps1" -Recurse).FullName
|
||||||
|
. (Get-ChildItem -Path $RepoRoot -Filter "Test-Module.ps1" -Recurse).FullName
|
||||||
|
|
||||||
|
#endregion HEADER
|
||||||
|
|
||||||
|
Describe "Resolve-Dependency" {
|
||||||
|
Context "Basic syntax check" {
|
||||||
|
Mock Get-ModuleBase {return "{0}\resources" -f $PWD}
|
||||||
|
Mock Test-Module {return $true}
|
||||||
|
It "Test1: Should not throw" {
|
||||||
|
{ Resolve-Dependency -Name 'foobar2000' } | Should -Not -Throw
|
||||||
|
}
|
||||||
|
It "Test2: Output type should be bool" {
|
||||||
|
Resolve-Dependency -Name 'foobar2000' | Should -BeOfType bool
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Context "Enforce Error" {
|
||||||
|
# Return incorrect module base to enforce there is no config file.
|
||||||
|
Mock Get-ModuleBase {return "C:\"}
|
||||||
|
It "Missing dependency file should not cause an error" {
|
||||||
|
{ Resolve-Dependency -Name 'awesome'} | Should -Not -Throw
|
||||||
|
}
|
||||||
|
|
||||||
|
It "Missing dependency file should return false" {
|
||||||
|
Resolve-Dependency -Name 'awesome' | Should -Be $false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Context "Testing input variations" {
|
||||||
|
Mock Get-ModuleBase {return "{0}\resources" -f $PWD}
|
||||||
|
It "Should return true if all given dependencies exist" {
|
||||||
|
Resolve-Dependency -Name 'Existing' | Should -Be $true
|
||||||
|
}
|
||||||
|
It "Mixed results should return false" {
|
||||||
|
Resolve-Dependency -Name 'PSGetMixed' | Should -Be $false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -14,10 +14,10 @@ Else {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# load additional functions defined in the repository. Replace the expression <FunctionName>.
|
# load additional functions defined in the repository. Replace the expression <FunctionName>.
|
||||||
. (Get-ChildItem -Path $RepoRoot -Filter "Test-CredentialStore.ps1" -Recurse).FullName
|
#. (Get-ChildItem -Path $RepoRoot -Filter "Test-CredentialStore.ps1" -Recurse).FullName
|
||||||
. (Get-ChildItem -Path $RepoRoot -Filter "New-CredentialStore.ps1" -Recurse).FullName
|
#. (Get-ChildItem -Path $RepoRoot -Filter "New-CredentialStore.ps1" -Recurse).FullName
|
||||||
. (Get-ChildItem -Path $RepoRoot -Filter "Get-CredentialStore.ps1" -Recurse).FullName
|
#. (Get-ChildItem -Path $RepoRoot -Filter "Get-CredentialStore.ps1" -Recurse).FullName
|
||||||
. (Get-ChildItem -Path $RepoRoot -Filter "Get-CredentialStoreItem.ps1" -Recurse).FullName
|
#. (Get-ChildItem -Path $RepoRoot -Filter "Get-CredentialStoreItem.ps1" -Recurse).FullName
|
||||||
. (Get-ChildItem -Path $RepoRoot -Filter "Test-ChallengeFile.ps1" -Recurse).FullName
|
. (Get-ChildItem -Path $RepoRoot -Filter "Test-ChallengeFile.ps1" -Recurse).FullName
|
||||||
. (Get-ChildItem -Path $RepoRoot -Filter "Get-ChallengeFile.ps1" -Recurse).FullName
|
. (Get-ChildItem -Path $RepoRoot -Filter "Get-ChallengeFile.ps1" -Recurse).FullName
|
||||||
. (Get-ChildItem -Path $RepoRoot -Filter "Set-ChallengeFile.ps1" -Recurse).FullName
|
. (Get-ChildItem -Path $RepoRoot -Filter "Set-ChallengeFile.ps1" -Recurse).FullName
|
@ -14,7 +14,7 @@ Else {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# load additional functions defined in the repository. Replace the expression <FunctionName>.
|
# load additional functions defined in the repository. Replace the expression <FunctionName>.
|
||||||
. (Get-ChildItem -Path $RepoRoot -Filter "Test-CredentialStore.ps1" -Recurse).FullName
|
#. (Get-ChildItem -Path $RepoRoot -Filter "Test-CredentialStore.ps1" -Recurse).FullName
|
||||||
|
|
||||||
#endregion HEADER
|
#endregion HEADER
|
||||||
|
|
@ -14,7 +14,7 @@ Else {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# load additional functions defined in the repository. Replace the expression <FunctionName>.
|
# load additional functions defined in the repository. Replace the expression <FunctionName>.
|
||||||
. (Get-ChildItem -Path $RepoRoot -Filter "Test-CredentialStore.ps1" -Recurse).FullName
|
#. (Get-ChildItem -Path $RepoRoot -Filter "Test-CredentialStore.ps1" -Recurse).FullName
|
||||||
. (Get-ChildItem -Path $RepoRoot -Filter "Test-ChallengeFile.ps1" -Recurse).FullName
|
. (Get-ChildItem -Path $RepoRoot -Filter "Test-ChallengeFile.ps1" -Recurse).FullName
|
||||||
. (Get-ChildItem -Path $RepoRoot -Filter "Set-ChallengeFile.ps1" -Recurse).FullName
|
. (Get-ChildItem -Path $RepoRoot -Filter "Set-ChallengeFile.ps1" -Recurse).FullName
|
||||||
. (Get-ChildItem -Path $RepoRoot -Filter "Get-RandomKey.ps1" -Recurse).FullName
|
. (Get-ChildItem -Path $RepoRoot -Filter "Get-RandomKey.ps1" -Recurse).FullName
|
||||||
@ -49,7 +49,7 @@ Describe "New-CredentialStore" {
|
|||||||
It "Test1: Create new private CredentialStore" {
|
It "Test1: Create new private CredentialStore" {
|
||||||
New-CredentialStore
|
New-CredentialStore
|
||||||
$result = Test-Path -Path $pCS
|
$result = Test-Path -Path $pCS
|
||||||
$CS = Get-Content -Path $pCS -Raw | ConvertFrom-Json -ErrorAction SilentlyContinue
|
$CS = Get-Content -Path $pCS -Raw | ConvertFrom-Json
|
||||||
($result -eq $True) -and ($CS.Type -eq "Private") | Should Be $True
|
($result -eq $True) -and ($CS.Type -eq "Private") | Should Be $True
|
||||||
}
|
}
|
||||||
It "Test2: Try to override private Store" {
|
It "Test2: Try to override private Store" {
|
@ -9,6 +9,32 @@
|
|||||||
$CALLSIGN = 'PSCredentialStore'
|
$CALLSIGN = 'PSCredentialStore'
|
||||||
Write-Host ("Callsign is: {0}" -f $CALLSIGN) -ForegroundColor Yellow
|
Write-Host ("Callsign is: {0}" -f $CALLSIGN) -ForegroundColor Yellow
|
||||||
|
|
||||||
|
|
||||||
|
Function Invoke-InstallDependencies() {
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param()
|
||||||
|
|
||||||
|
Process {
|
||||||
|
Try {
|
||||||
|
Install-PackageProvider -Name NuGet -RequiredVersion '2.8.5.208' -Force -Verbose
|
||||||
|
Import-PackageProvider -Name NuGet -RequiredVersion '2.8.5.208' -Force
|
||||||
|
Install-Module -Name 'Pester' -Scope CurrentUser -RequiredVersion '4.0.8' -Force -SkipPublisherCheck -AllowClobber
|
||||||
|
Install-Module -Name 'posh-git' -Scope CurrentUser -RequiredVersion '0.7.1' -Force -SkipPublisherCheck -AllowClobber
|
||||||
|
Install-Module -Name 'PSCoverage' -Scope CurrentUser -Force -SkipPublisherCheck -AllowClobber
|
||||||
|
Import-Module -Name 'Pester', 'posh-git', 'PSCoverage'
|
||||||
|
}
|
||||||
|
Catch {
|
||||||
|
$MsgParams = @{
|
||||||
|
Message = 'Could not install the required dependencies!'
|
||||||
|
Category = 'Error'
|
||||||
|
Details = $_.Exception.Message
|
||||||
|
}
|
||||||
|
Add-AppveyorMessage @MsgParams
|
||||||
|
Throw $MsgParams.Message
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Function Invoke-AppVeyorBumpVersion() {
|
Function Invoke-AppVeyorBumpVersion() {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
Param()
|
Param()
|
||||||
@ -69,7 +95,7 @@ Function Invoke-AppVeyorTests() {
|
|||||||
Details = 'Now running all test found in .\tests\ dir.'
|
Details = 'Now running all test found in .\tests\ dir.'
|
||||||
}
|
}
|
||||||
Add-AppveyorMessage @MsgParams
|
Add-AppveyorMessage @MsgParams
|
||||||
$testresults = Invoke-Pester -Path ".\tests\*" -ExcludeTag 'Disabled' -PassThru
|
$testresults = Invoke-Pester -Path ( Get-ChildItem -Path ".\tests\*.Tests.ps1" -Recurse | Sort-Object -Property Name ) -ExcludeTag 'Disabled' -PassThru
|
||||||
ForEach ($Item in $testresults.TestResult) {
|
ForEach ($Item in $testresults.TestResult) {
|
||||||
Switch ($Item.Result) {
|
Switch ($Item.Result) {
|
||||||
"Passed" {
|
"Passed" {
|
||||||
@ -138,7 +164,11 @@ Function Invoke-CoverageReport() {
|
|||||||
|
|
||||||
Function Invoke-AppVeyorPSGallery() {
|
Function Invoke-AppVeyorPSGallery() {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
Param()
|
Param(
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
|
[ValidateNotNullOrEmpty()]
|
||||||
|
[String]$OnBranch
|
||||||
|
)
|
||||||
Expand-Archive -Path (".\bin\{0}.zip" -f $CALLSIGN) -DestinationPath ("C:\Users\appveyor\Documents\WindowsPowerShell\Modules\{0}\" -f $CALLSIGN) -Verbose
|
Expand-Archive -Path (".\bin\{0}.zip" -f $CALLSIGN) -DestinationPath ("C:\Users\appveyor\Documents\WindowsPowerShell\Modules\{0}\" -f $CALLSIGN) -Verbose
|
||||||
Import-Module -Name $CALLSIGN -Verbose -Force
|
Import-Module -Name $CALLSIGN -Verbose -Force
|
||||||
Write-Host "Available Package Provider:" -ForegroundColor Yellow
|
Write-Host "Available Package Provider:" -ForegroundColor Yellow
|
||||||
|
Reference in New Issue
Block a user