Original Message:
Sent: Oct 08, 2024 02:48 AM
From: Bart van den Donk
Subject: Horizon View API (HV Helper Module) - Run CMDlets against multiple HVServers
This is the most reliable way to split an array into its single elements:
($global:DefaultHVServers).Foreach({Get-HVMachineSummary -HvServer $_})
You can use it for any CmdLet in pwsh.
If you use Foreach-Object (which works different from the foreach command) you get 3 parts that can be used.
BEGIN PROCESS END.
In the BEGIN part you do some starting command(s) like reading a file that contains servernames.
In the PROCESS part you getter all info in a loop of command(s) that have to repeat.
In the END part you work the magic of changing things in to 1 final object, like an output to another cmdlet or a file or the screen.
For a better understanding look at:
help foreach -Examples
If you realy want to learn Powershell search for "Don Jones".
Original Message:
Sent: Oct 07, 2024 05:03 PM
From: PalaniMahalinga
Subject: Horizon View API (HV Helper Module) - Run CMDlets against multiple HVServers
Hi LucD,
I'm new to this scripting, can you please give any sample script which uses the cmdlet in loop.
From that i can try to prepare my script.
Thank you.
Original Message:
Sent: Oct 04, 2024 03:13 AM
From: LucD
Subject: Horizon View API (HV Helper Module) - Run CMDlets against multiple HVServers
Same issue, the cmdlet doesn't accept an array, only a single String.
Run the cmdlet in a loop
------------------------------
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Original Message:
Sent: Oct 03, 2024 01:16 PM
From: PalaniMahalinga
Subject: Horizon View API (HV Helper Module) - Run CMDlets against multiple HVServers
Trying to connect multiple pod's connection servers to get the pools specific information of "reuse computer objects" script but unable to connect multiple connection servers.
using the below commands but received the error, please assist to Prepare the script.
$connserver = Get-Content "C:\temp\conservers.txt"
$credential = Get-Credential
Connect-HVServer -Server $connserver
Connect-HVServer -Server $connserver
cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
Connect-HVServer : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Server'. Specified method is not supported.
Original Message:
Sent: Sep 04, 2017 09:29 AM
From: LucD
Subject: Horizon View API (HV Helper Module) - Run CMDlets against multiple HVServers
The HVServer parameter doesn't accept an array, just a single HVServer.
Try like this
$global:DefaultHVServers | %{
Get-HVMachineSummary -HvServer $_
}