Skip to content

Commit

Permalink
Fixed optional parameter (#16)
Browse files Browse the repository at this point in the history
* Added logging and env variable

* One more error checking

* Updated reademe

* Changed to an optional parameter
  • Loading branch information
marranaga authored Sep 28, 2018
1 parent 9b4cb4f commit 7826fae
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions ePOwerShell/Public/Set-ePOwerShellServer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ function Set-ePOwerShellServer {
[String]
$Server,

[Parameter(Mandatory = $True, ParameterSetName = 'ManualEntry')]
[Int]
$Port,

[Parameter(Mandatory = $True, ParameterSetName = 'ManualEntry')]
[System.Management.Automation.PSCredential]
$Credentials,

[Parameter(Mandatory = $False, ParameterSetName = 'ManualEntry')]
[Int]
$Port,

[Parameter(ParameterSetName = 'Env')]
[String]
Expand Down Expand Up @@ -101,16 +101,22 @@ function Set-ePOwerShellServer {

$ePOwerShellVariables = @{
Server = $Settings.Server
Port = $Settings.Port
Credentials = $Credentials
}

if ($settings.Port) {
[void]$ePOwerShellVariables.Add("Port", $Settings.Port)
}
}
'ManualEntry' {
$ePOwerShellVariables = @{
Server = $Server
Port = $Port
Credentials = $Credentials
}

if ($Port) {
[void]$ePOwerShellVariables.Add("Port", $Port)
}
}
}

Expand Down

0 comments on commit 7826fae

Please sign in to comment.