Check if Enough Free Space in Remote Computer with PowerShell
I’m currently writing lots of building blocks of code to deploy Infrastructure as Code (IaC).
The following code can check if there enough space (in this case, 10 GB of space) on the C drive of the computer kopidc01:
$computer = "kopidc01"
$RequiredSpaceGB = 10
$FreeSpaceGB = [int]((Get-CimInstance -ComputerName $computer…