I am working on putting together a script that will generate an html report on disk space usage on our Windows servers. I am having troubles with the script giving me an error on a section of the script stating "Assignment expression is not valid. The left hand side of an assignment operator needs to be something that can be assigned..."
here is the section of the script:
foreach($disk in $disks)
$deviceID = $disk.DeviceID,
$volName = $disk.VolumeName,
$size = $disk.Size,
$freespace = $disk.FreeSpace,
$percentFree = [Math]::Round(($freespace / $size) * 100, 2),
$sizeGB = [Math]::Round($size / 1073741824, 2),
$freeSpaceGB = [Math]::Round($freespace / 1073741824, 2),
$usedSpaceGB = ($sizeGB - $freespaceGB), <-- This is the problem
$color = $whiteColor;
If I replace the commas with semi-colons at the end of each line, the script will run but it will only capture one server and only one of its drives. I am new to powershell scripting so I am a little stuck.