From 48c0980b5f5a76414fa3415675c134e0debfef74 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Mon, 8 Apr 2019 13:06:41 +0200 Subject: [PATCH] update cbh blocks --- src/Connection/Connect-To.ps1 | 6 ++--- src/Connection/Disconnect-From.ps1 | 24 +++++++++---------- src/Connection/Test-CSConnection.ps1 | 20 ++++++++-------- src/Item/Get-CredentialStoreItem.ps1 | 8 +++---- src/Item/New-CredentialStoreItem.ps1 | 18 ++++---------- src/Item/Remove-CredentialStoreItem.ps1 | 8 +++---- src/Item/Set-CredentialStoreItem.ps1 | 8 +++---- src/Item/Test-CredentialStoreItem.ps1 | 8 +++---- .../Get-DefaultCredentialStorePath.ps1 | 10 ++++---- src/Private/Get-ModuleBase.ps1 | 10 ++++---- src/Private/Get-RandomAESKey.ps1 | 10 ++++---- src/Private/Get-TempDir.ps1 | 6 ++--- src/Private/Resolve-Dependency.ps1 | 10 ++++---- src/Private/Test-Module.ps1 | 12 ++++------ src/Store/Get-CredentialStore.ps1 | 12 ++++------ src/Store/New-CredentialStore.ps1 | 9 ++++--- src/Store/Test-CredentialStore.ps1 | 11 ++++----- 17 files changed, 83 insertions(+), 107 deletions(-) diff --git a/src/Connection/Connect-To.ps1 b/src/Connection/Connect-To.ps1 index c39123d..74b1eaa 100644 --- a/src/Connection/Connect-To.ps1 +++ b/src/Connection/Connect-To.ps1 @@ -57,9 +57,9 @@ function Connect-To { Connect-To -RemoteHost "exchange01.myside.local" -Type ExchangeHTTPS .NOTES - File Name : Connect-To.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : + - File Name : Connect-To.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore diff --git a/src/Connection/Disconnect-From.ps1 b/src/Connection/Disconnect-From.ps1 index 1ccaa70..57139b9 100644 --- a/src/Connection/Disconnect-From.ps1 +++ b/src/Connection/Disconnect-From.ps1 @@ -51,9 +51,9 @@ function Disconnect-From { Disconnect-From -RemoteHost "exchange01.myside.local" -Type ExchangeHTTPS .NOTES - File Name : Disconnect-From.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : + - File Name : Disconnect-From.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore @@ -95,7 +95,7 @@ function Disconnect-From { catch { # Write a error message to the log. $MessageParams = @{ - Message = "Unable to disconnect from {0} using Type {1}." -f $RemoteHost, $Type + Message = "Unable to disconnect from {0} using Type {1}." -f $RemoteHost, $Type ErrorAction = "Stop" } Write-Error @MessageParams @@ -114,7 +114,7 @@ function Disconnect-From { catch { # Write a error message to the log. $MessageParams = @{ - Message = "Unable to disconnect from {0} using Type {1}." -f $RemoteHost, $Type + Message = "Unable to disconnect from {0} using Type {1}." -f $RemoteHost, $Type ErrorAction = "Stop" } Write-Error @MessageParams @@ -127,7 +127,7 @@ function Disconnect-From { } else { $MessageParams = @{ - Message = "There is no open WinSCP Session" + Message = "There is no open WinSCP Session" ErrorAction = "Stop" } Write-Error @MessageParams @@ -138,7 +138,7 @@ function Disconnect-From { "NetAppFAS" { try { $MessageParams = @{ - Message = "Setting {0} to `$null, which will disconnect NetAppFAS" -f $Global:CurrentNcController + Message = "Setting {0} to `$null, which will disconnect NetAppFAS" -f $Global:CurrentNcController ErrorAction = "Continue" } Write-Verbose @MessageParams @@ -148,7 +148,7 @@ function Disconnect-From { catch { # Write a error message to the log. $MessageParams = @{ - Message = "Unable to disconnect from {0} using Type {1}." -f $RemoteHost, $Type + Message = "Unable to disconnect from {0} using Type {1}." -f $RemoteHost, $Type ErrorAction = "Stop" } Write-Error @MessageParams @@ -163,7 +163,7 @@ function Disconnect-From { catch { # Write a error message to the log. $MessageParams = @{ - Message = "Unable to disconnect from {0} using Type {1}." -f $RemoteHost, $Type + Message = "Unable to disconnect from {0} using Type {1}." -f $RemoteHost, $Type ErrorAction = "Stop" } Write-Error @MessageParams @@ -176,7 +176,7 @@ function Disconnect-From { } catch { $MessageParams = @{ - Message = "Unable to disconnect from {0} using Type {1}." -f $RemoteHost, $Type + Message = "Unable to disconnect from {0} using Type {1}." -f $RemoteHost, $Type ErrorAction = "Stop" } Write-Error @MessageParams @@ -188,7 +188,7 @@ function Disconnect-From { } else { $MessageParams = @{ - Message = "There is no open WinSCP Session" + Message = "There is no open WinSCP Session" ErrorAction = "Stop" } Write-Error @MessageParams @@ -197,7 +197,7 @@ function Disconnect-From { default { # Write a error message to the log. $MessageParams = @{ - Message = "Unable to disconnect from {0} using Type {1}." -f $RemoteHost, $Type + Message = "Unable to disconnect from {0} using Type {1}." -f $RemoteHost, $Type ErrorAction = "Stop" } Write-Error @MessageParams diff --git a/src/Connection/Test-CSConnection.ps1 b/src/Connection/Test-CSConnection.ps1 index 63f7271..08b483e 100644 --- a/src/Connection/Test-CSConnection.ps1 +++ b/src/Connection/Test-CSConnection.ps1 @@ -17,22 +17,22 @@ function Test-CSConnection { [None] .OUTPUTS - [Boolean] + [bool] .EXAMPLE - .\Test-CMConnection -RemoteHost "r0-i01-vcr01.p0r.kivbf-cloud.net" -Type VMware + Test-CMConnection -RemoteHost "vcr01.internal.net" -Type VMware .NOTES - File Name : Test-CSConnection.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : + - File Name : Test-CSConnection.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore #> [CmdletBinding()] - [OutputType([boolean])] + [OutputType([bool])] param( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] @@ -77,7 +77,7 @@ function Test-CSConnection { 'CiscoUcs' { $MsgParams = @{ ErrorAction = "Stop" - Message = "CiscoUCS connection test is not implemented yet!" + Message = "CiscoUCS connection test is not implemented yet!" } Write-Error @MsgParams return $false @@ -86,7 +86,7 @@ function Test-CSConnection { 'FTP' { $MsgParams = @{ ErrorAction = "Stop" - Message = "FTP connection test is not implemented yet!" + Message = "FTP connection test is not implemented yet!" } Write-Error @MsgParams return $false @@ -95,7 +95,7 @@ function Test-CSConnection { 'NetAppFAS' { $MsgParams = @{ ErrorAction = "Stop" - Message = "NetAppFAS connection test is not implemented yet!" + Message = "NetAppFAS connection test is not implemented yet!" } Write-Error @MsgParams return $false @@ -105,7 +105,7 @@ function Test-CSConnection { Default { $MsgParams = @{ ErrorAction = "Stop" - Message = "Panic: There is an invalid type value! This error should never be thrown." + Message = "Panic: There is an invalid type value! This error should never be thrown." } Write-Error @MsgParams return $false diff --git a/src/Item/Get-CredentialStoreItem.ps1 b/src/Item/Get-CredentialStoreItem.ps1 index b33dbad..bf32e1a 100644 --- a/src/Item/Get-CredentialStoreItem.ps1 +++ b/src/Item/Get-CredentialStoreItem.ps1 @@ -11,8 +11,8 @@ function Get-CredentialStoreItem { Specify the host, for which you would like to change the credentials. .PARAMETER Identifier - Provide a custom identifier to the given remote host key. This enables you to store multiple credentials - for a single remote host entry. For example ad/sys1, ftp/sys1, mssql/sys1 + Provide a custom identifier to the given remote host key. This enables you to store multiple credentials + for a single remote host entry. For example ad/sys1, ftp/sys1, mssql/sys1 .PARAMETER Path Define a custom path to a shared CredentialStore. @@ -32,8 +32,8 @@ function Get-CredentialStoreItem { .NOTES - File Name : Get-CredentialStoreItem.ps1 - - Author : Marco Blessing - marco.blessing@googlemail.com - - Requires : dfgdfg + - Author : Messing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore diff --git a/src/Item/New-CredentialStoreItem.ps1 b/src/Item/New-CredentialStoreItem.ps1 index 6659302..2cd5947 100644 --- a/src/Item/New-CredentialStoreItem.ps1 +++ b/src/Item/New-CredentialStoreItem.ps1 @@ -31,11 +31,10 @@ function New-CredentialStoreItem { New-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.local" .NOTES - ``` - File Name : New-CredentialStoreItem.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : - ``` + - File Name : New-CredentialStoreItem.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : + .LINK https://github.com/OCram85/PSCredentialStore #> @@ -91,15 +90,6 @@ function New-CredentialStoreItem { Write-Error @MessageParams } - # Read the file content based on the given ParameterSetName - <# - if ($PSCmdlet.ParameterSetName -eq 'Private') { - $CSContent = Get-CredentialStore - } - elseif ($PSCmdlet.ParameterSetName -eq 'Shared') { - $CSContent = Get-CredentialStore -Shared -Path $Path - } - #> $CSContent = Get-CredentialStore -Shared -Path $Path $CurrentDate = Get-Date -UFormat "%Y-%m-%d %H:%M:%S" diff --git a/src/Item/Remove-CredentialStoreItem.ps1 b/src/Item/Remove-CredentialStoreItem.ps1 index 0ea0b45..f3296b7 100644 --- a/src/Item/Remove-CredentialStoreItem.ps1 +++ b/src/Item/Remove-CredentialStoreItem.ps1 @@ -39,11 +39,9 @@ function Remove-CredentialStoreItem { Remove-CredentialStoreItem -RemoteHost "esx01.myside.local" -Identifier svc .NOTES - ``` - File Name : Remove-CredentialStoreItem.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : - ``` + - File Name : Remove-CredentialStoreItem.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore diff --git a/src/Item/Set-CredentialStoreItem.ps1 b/src/Item/Set-CredentialStoreItem.ps1 index 738b9fb..5c125c1 100644 --- a/src/Item/Set-CredentialStoreItem.ps1 +++ b/src/Item/Set-CredentialStoreItem.ps1 @@ -30,11 +30,9 @@ function Set-CredentialStoreItem { Set-CredentialStoreItem -Path "C:\TMP\mystore.json" -RemoteHost "esx01.myside.local" -Identifier svc .NOTES - ``` - File Name : Set-CredentialStoreItem.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : - ``` + - File Name : Set-CredentialStoreItem.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore diff --git a/src/Item/Test-CredentialStoreItem.ps1 b/src/Item/Test-CredentialStoreItem.ps1 index 5f125e7..a248f0e 100644 --- a/src/Item/Test-CredentialStoreItem.ps1 +++ b/src/Item/Test-CredentialStoreItem.ps1 @@ -37,11 +37,9 @@ function Test-CredentialStoreItem { } .NOTES - ``` - File Name : Test-CredentialStoreItem.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : - ``` + - File Name : Test-CredentialStoreItem.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore diff --git a/src/Private/Get-DefaultCredentialStorePath.ps1 b/src/Private/Get-DefaultCredentialStorePath.ps1 index 4d9d162..2ee5dc5 100644 --- a/src/Private/Get-DefaultCredentialStorePath.ps1 +++ b/src/Private/Get-DefaultCredentialStorePath.ps1 @@ -16,9 +16,9 @@ function Get-DefaultCredentialStorePath { $Path = Get-DefaultCredentialStorePath .NOTES - File Name : Get-DefaultCredentialStorePath.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : + - File Name : Get-DefaultCredentialStorePath.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore @@ -30,7 +30,7 @@ function Get-DefaultCredentialStorePath { [switch]$Shared ) - begin {} + begin { } process { if ($Shared.IsPresent) { @@ -57,5 +57,5 @@ function Get-DefaultCredentialStorePath { } } - end {} + end { } } diff --git a/src/Private/Get-ModuleBase.ps1 b/src/Private/Get-ModuleBase.ps1 index 118dfeb..acb2451 100644 --- a/src/Private/Get-ModuleBase.ps1 +++ b/src/Private/Get-ModuleBase.ps1 @@ -11,9 +11,9 @@ function Get-ModuleBase { Returns the base path as string .NOTES - File Name : Get-ModuleBase.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : + - File Name : Get-ModuleBase.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore @@ -21,9 +21,9 @@ function Get-ModuleBase { [CmdletBinding()] [OutputType()] param() - begin {} + begin { } process { return $MyInvocation.MyCommand.Module.ModuleBase } - end {} + end { } } diff --git a/src/Private/Get-RandomAESKey.ps1 b/src/Private/Get-RandomAESKey.ps1 index 27baae5..aff07b5 100644 --- a/src/Private/Get-RandomAESKey.ps1 +++ b/src/Private/Get-RandomAESKey.ps1 @@ -16,9 +16,9 @@ function Get-RandomAESKey { .\Get-RandomAESKey .NOTES - File Name : Get-RandomAESKey.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : + - File Name : Get-RandomAESKey.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore @@ -28,7 +28,7 @@ function Get-RandomAESKey { [OutputType([byte[]])] param() - begin {} + begin { } process { $key = [byte[]]::new(32) @@ -40,5 +40,5 @@ function Get-RandomAESKey { } } - end {} + end { } } diff --git a/src/Private/Get-TempDir.ps1 b/src/Private/Get-TempDir.ps1 index c0b1580..b3db4d9 100644 --- a/src/Private/Get-TempDir.ps1 +++ b/src/Private/Get-TempDir.ps1 @@ -15,9 +15,9 @@ function Get-TempDir { Get-TempDir .NOTES - File Name : Get-TempDir.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : + - File Name : Get-TempDir.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore diff --git a/src/Private/Resolve-Dependency.ps1 b/src/Private/Resolve-Dependency.ps1 index c0f6a0a..4b82922 100644 --- a/src/Private/Resolve-Dependency.ps1 +++ b/src/Private/Resolve-Dependency.ps1 @@ -40,11 +40,9 @@ function Resolve-Dependency { } .NOTES - ``` - File Name : ResolveDependency.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : - ``` + - File Name : ResolveDependency.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore @@ -69,7 +67,7 @@ function Resolve-Dependency { } process { - $SelectedDependency = $Dependency.Optional | Where-Object {$_.Name -match $Name} + $SelectedDependency = $Dependency.Optional | Where-Object { $_.Name -match $Name } # return true if there is no dependency defined if ($null -eq $SelectedDependency) { return $true diff --git a/src/Private/Test-Module.ps1 b/src/Private/Test-Module.ps1 index 2872db3..ab68198 100644 --- a/src/Private/Test-Module.ps1 +++ b/src/Private/Test-Module.ps1 @@ -34,11 +34,9 @@ function Test-Module { .\Test-Dependency -Name 'VMware.PowerCLI' -Type 'Module' -StopIfFails .NOTES - ``` - File Name : Test-Module.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : - ``` + - File Name : Test-Module.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore @@ -58,7 +56,7 @@ Could not find the required {0} called {1}. Please install the required {0} to r [Parameter(Mandatory = $false)] [switch]$StopIfFails ) - begin {} + begin { } process { $Message = $MessagePattern -f $Type, $Name @@ -75,5 +73,5 @@ Could not find the required {0} called {1}. Please install the required {0} to r } } - end {} + end { } } diff --git a/src/Store/Get-CredentialStore.ps1 b/src/Store/Get-CredentialStore.ps1 index 20191ff..a30de5f 100644 --- a/src/Store/Get-CredentialStore.ps1 +++ b/src/Store/Get-CredentialStore.ps1 @@ -25,11 +25,9 @@ function Get-CredentialStore { $CSContent = Get-CredentialStore -Path "C:\TMP\mystore.json" .NOTES - ``` - File Name : Get-CredentialStore.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : - ``` + - File Name : Get-CredentialStore.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : .LINK https://github.com/OCram85/PSCredentialStore #> @@ -45,7 +43,7 @@ function Get-CredentialStore { [switch]$Shared ) - begin {} + begin { } process { # Set the CredentialStore for private, shared or custom mode. @@ -83,6 +81,6 @@ function Get-CredentialStore { } } - end {} + end { } } diff --git a/src/Store/New-CredentialStore.ps1 b/src/Store/New-CredentialStore.ps1 index d3b462e..9502060 100644 --- a/src/Store/New-CredentialStore.ps1 +++ b/src/Store/New-CredentialStore.ps1 @@ -42,11 +42,10 @@ function New-CredentialStore { # Creates a new shared CredentialStore in the given location. .NOTES - ``` - File Name : New-CredentialStore.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : - ``` + - File Name : New-CredentialStore.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : + .LINK https://github.com/OCram85/PSCredentialStore #> diff --git a/src/Store/Test-CredentialStore.ps1 b/src/Store/Test-CredentialStore.ps1 index 3b62aca..2746264 100644 --- a/src/Store/Test-CredentialStore.ps1 +++ b/src/Store/Test-CredentialStore.ps1 @@ -15,11 +15,10 @@ function Test-CredentialStore { can be decrypted across systems. .NOTES - ``` - File Name : Test-CredentialStore.ps1 - Author : Marco Blessing - marco.blessing@googlemail.com - Requires : - ``` + - File Name : Test-CredentialStore.ps1 + - Author : Marco Blessing - marco.blessing@googlemail.com + - Requires : + .LINK https://github.com/OCram85/PSCredentialStore #> @@ -60,6 +59,6 @@ function Test-CredentialStore { } } - end {} + end { } }