Skip to Content

Solved: How to add name labels for each PowerShell entry?

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.

    Ads Blocker Image Powered by Code Help Pro

    Ads Blocker Detected!!!

    This site depends on revenue from ad impressions to survive. If you find this site valuable, please consider disabling your ad blocker.