In the query below, I'd like to add the $srv value under the ServerName for each row.
[string]$srv = 'someserver'
gwmi -query "select * from Win32_LogicalDisk
where DriveType = 2 OR DriveType = 3" -computername $srv | select ServerName, Name, FreeSpace,Size | export-csv -path .\$srv\BOX_LogicalDisk.csv -noType
I have tried adding $srv to the Select statement but no go.
Output should be like so:
ServerName Name FreeSpace Size
Someserver C: 82652930048 21340921856
Someserver D: 7727915008 21340921856
Thanks!