Enables pipeline input for -Credential parameter #25

Merged
OCram85 merged 5 commits from i19 into master 2018-03-21 14:32:32 +01:00
2 changed files with 9 additions and 3 deletions
Showing only changes of commit 8219d4e475 - Show all commits

View File

@ -55,9 +55,9 @@ function New-CredentialStoreItem {
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string]$Identifier, [string]$Identifier,
[Parameter(Mandatory = $false)] [Parameter(Mandatory = $false, ValueFromPipeline = $true)]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[pscredential]$Credential, [PSCredential]$Credential,
[Parameter(Mandatory = $false, ParameterSetName = "Shared")] [Parameter(Mandatory = $false, ParameterSetName = "Shared")]
[switch]$Shared [switch]$Shared

View File

@ -53,6 +53,10 @@ function Set-CredentialStoreItem {
[Parameter(Mandatory = $false, ParameterSetName = "Shared")] [Parameter(Mandatory = $false, ParameterSetName = "Shared")]
[string]$Identifier, [string]$Identifier,
[Parameter(Mandatory = $false, ValueFromPipeline = $true)]
[ValidateNotNullOrEmpty()]
[PSCredential]$Credential,
[Parameter(Mandatory = $false, ParameterSetName = "Shared")] [Parameter(Mandatory = $false, ParameterSetName = "Shared")]
[switch]$Shared [switch]$Shared
) )
@ -83,7 +87,9 @@ function Set-CredentialStoreItem {
$CredentialName = $RemoteHost $CredentialName = $RemoteHost
} }
if (-not($Credential)) {
$Creds = Get-Credential -Message $CredentialName $Creds = Get-Credential -Message $CredentialName
}
if ($Creds.UserName) { if ($Creds.UserName) {
if ($CSContent.Type -eq "Shared") { if ($CSContent.Type -eq "Shared") {