Much simpler solution:
Get-PSDrive C | Select-Object Used,Free
and for remote computers (needs Powershell Remoting
)
Invoke-Command -ComputerName SRV2 {Get-PSDrive C} | Select-Object PSComputerName,Used,Free
More Related Contents:
- What’s the best way to determine the location of the current PowerShell script?
- PowerShell script not zipping correct files
- Is there a way to make a PowerShell script work by double clicking a .ps1 file?
- Save hash table in PowerShell object notation (PSON)
- How to redirect the output of a PowerShell to a file during its execution
- When should I use Write-Error vs. Throw? Terminating vs. non-terminating errors
- Watch file for changes and run command with powershell
- How do I write to standard error in PowerShell?
- Recursive file search using PowerShell
- Get remote registry value
- How to get an MD5 checksum in PowerShell
- Obtaining ExitCode using Start-Process and WaitForExit instead of -Wait
- Redirection of standard and error output appending to the same log file
- How do I get only directories using Get-ChildItem?
- Web.Config transforms outside of Microsoft MSBuild?
- copy-item With Alternate Credentials
- PowerShell – Decode System.Security.SecureString to readable password
- How do I concatenate two text files in PowerShell?
- How do I include a locally defined function when using PowerShell’s Invoke-Command for remoting?
- Extract the filename from a path
- Comparing array variables in PowerShell
- Copy file remotely with PowerShell
- How can I run a PowerShell script with white spaces in the path from the command line?
- How to speed up Powershell Get-Childitem over UNC
- Gracefully stopping in Powershell
- Using Powershell environmental variables as strings when outputting files
- PowerShell is missing the terminator: “
- Using PowerShell to remove lines from a text file if it contains a string
- List hidden sub-directories and sizes
- List of all colors available for PowerShell?