Remove old Write-Message2 function (#13)

This commit is contained in:
OCram85 2018-03-02 13:43:06 +01:00 committed by GitHub
parent cb11209702
commit 691255957c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -142,7 +142,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 {
@ -150,8 +154,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) {
@ -162,8 +169,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" {