Open fvanroie opened 6 years ago
Greetings - your project is an excellent idea and could be very useful for Powershell users,
I'm experiencing the following issue when attempting to create an object for New-OPNsenseHAProxyServer
Example from documentation: $webservers = 1..3 | foreach-Object { [OPNsense.HAProxy.Servers.Server]@{ 'name' = ("web" + $.tostring("000")) 'address' = "192.168.0.$" 'port' = '80' 'description' = "Created {0}" -f [DateTime]::now 'mode' = 'active' } } $webservers = $webservers | New-OPNsenseHAProxyServer -Verbose:$beVerbose
I have an array $realServers containing two example servers with additional items for ssl, sslCA, sslVerify:
$realServers
name : server1.example address : 192.168.0.1 port : 443 mode : active ssl : TRUE sslCA : MyCA sslVerify : TRUE
name : server2.example address : 192.168.0.2 port : 443 mode : active ssl : TRUE sslCA : MyCA sslVerify : TRUE
I pipe my array to a modified version of the example:
$webservers = $realServers | foreach-Object { $sslEnabled = $false $sslVerify = $false if ($.ssl -eq "TRUE") {$sslEnabled = $true} if ($.sslVerify -eq "TRUE") {$sslVerify = $true} [OPNsense.HAProxy.Servers.Server]@{ 'name' = $.name 'address' = $.address 'port' = $.port 'description' = $.name+" ("+$.address+")" 'mode' = $.mode 'ssl' = $sslEnabled 'sslCA' = $_.sslCA 'sslVerify' = $sslVerify } }
But the output does not include the additional items requested (mode, ssl, sslCA, sslVerify are missing):
$webservers
Address Description Name Port Uuid
192.168.0.1 server1.example (192.168.0.1) server1.example 443 192.168.0.2 server2.example (192.168.0.2) server2.example 443
Regards
Passing multiple packagenames to Install/Remove package cmdlet doesn't work correctly. Arrays need to be tested/verified to work correctly.