Problem
Does anyone have experience with this PowerShell script? We are close to completion, however, we are encountering an issue where the PowerShell script does not include the server name for each entry. Any assistance would be greatly appreciated.
$servers = @("server 1", "server2", "server3")
{
Get-Volume
}
Solution
It appears that the current command is not functioning as intended. The same (local) volumes are being queried three times. To ensure the command is executed correctly, it is necessary to include the server names:
$servers = @("server 1", "server2", "server3")
Get-Volume -CimSession $servers
Note: It is not necessary for this small snippet, but if you wish to store the server names in an array, it can be done.