I'm trying to create a powershell script that will show me how much available HD space is left on each VM
So far i have a text file call machines.txt that have a list off all the VM machines, The below is my command
$computers = Get-Content -Path "C:\dacto\machines.txt"
Invoke-Command -ComputerName $computers -ScriptBlock {
Get-WmiObject [decimal]::round((Get-WMIObject Win32_LogicalDisk | Where-Object {$_.DeviceID -eq "C:"}).freespace / 1gb)}
But i receive the below errors
Invalid query
+ CategoryInfo : InvalidOperation: (:) [Get-WmiObject], Managemen
tException
+ FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.C
ommands.GetWmiObjectCommand
Invalid query
+ CategoryInfo : InvalidOperation: (:) [Get-WmiObject], Managemen
tException
+ FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.C
ommands.GetWmiObjectCommand
can someone please help im also working on having this script automatically send me an email
Please and Thank you