What is the format suppose to be for the strings which represent computer names and the partition?
The reason why I am asking is that my free space is always returning zero on the powershell session? This is not correct, because the real free space is 60 gigs.
This is the code used
$ip = “184.108.40.206”
$partition = “DeviceID =‘E’”
$description = “backup_server”
$ConvertToGB = (1024 * 1024 * 1024)
$disk = Get-WmiObject Win32_LogicalDisk -ComputerName $ip -Filter $partition | Select-Object Size,FreeSpace
$ip + $partition + $description + ([math]::round(($disk.Size / $ConvertToGB),2)) + “GB” + “,” + ([math]::round((($disk.FreeSpace / $ConvertToGB)),2)) + “GB”
Can someone please advise if the something is needed to be added to the strings for the computer name and partition name? Or perhaps special characters or extra commas or quotes etc???