Executing the following code , I am getting the error.Please let me where I doing mistake
Code
$diskDetails = Get-WMIObject -Namespace root/cimv2 -Class Win32_LogicalDisk | Where-Object {$_.DeviceID -match “$($Arguments)” } | Select-Object -Property Size, FreeSpace, VolumeName, DeviceID
$DriveLetter = $diskDetails.DeviceID
$DriveName = $diskDetails.VolumeName
$SizeInGB = “{0:0}” -f ($diskDetails.Size/1GB)
Error
Method invocation failed because [System.Object[]] does not contain a method
named ‘op_Division’.
At line:4 char:1
+ $SizeInGB = “{0:0}” -f ($diskDetails.Size/1GB)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (op_Division:String) [], Runtim
eException
+ FullyQualifiedErrorId : MethodNotFound