Just delving into PS and I’m finding a little bit of inconsistency with how the / 1GB is working:
Currently I have:
$disk = Get-WmiObject Win32_logicaldisk
$diskfreesize = $disk.FreeSpace / 1GB
On some machines this works very nicely, no errors, but on others I get the
Method invocation failed because [System.Object] doesn’t contain a method named ‘op_Division’.
- $diskfreesize = $diskfreesize_raw / 1GB
+ CategoryInfo : InvalidOperation: (op_Division:String) , RuntimeException + FullyQualifiedErrorId : MethodNotFound
Can anyone help me understand why this is happening? Is it different PS versions?