From b2a83e0072566ea2ff4405c2c0c51cbfcca21c70 Mon Sep 17 00:00:00 2001 From: Falco Date: Sat, 12 Nov 2016 02:54:46 +0100 Subject: [PATCH] check for free disk space upfront (#4647) * check for free disk space upfront * driveletter now derives from $InstallRoot * whitespace corrected * one space added --- scripts/obtain/dotnet-install.ps1 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/obtain/dotnet-install.ps1 b/scripts/obtain/dotnet-install.ps1 index 267e3a6ff..0168ad8e1 100644 --- a/scripts/obtain/dotnet-install.ps1 +++ b/scripts/obtain/dotnet-install.ps1 @@ -396,6 +396,12 @@ if ($DryRun) { $InstallRoot = Resolve-Installation-Path $InstallDir Say-Verbose "InstallRoot: $InstallRoot" +$free = Get-CimInstance -Class win32_logicaldisk | where Deviceid -eq "$((Get-Item $InstallRoot).PSDrive.Name):" +if ($free.Freespace / 1MB -le 250 ) { + Say "there is not enough disk space on drive c:" + exit 0 +} + $IsSdkInstalled = Is-Dotnet-Package-Installed -InstallRoot $InstallRoot -RelativePathToPackage "sdk" -SpecificVersion $SpecificVersion Say-Verbose ".NET SDK installed? $IsSdkInstalled" if ($IsSdkInstalled) {