Install dotnet core issue

373 Views Asked by At

I try to install dotnet core 2.1.4 on powershell using command like

Invoke-WebRequest -Uri "https://download.microsoft.com/download/A/7/8/A78F1D25-8D5C-4411-B544-C7D527296D5E/dotnet-hosting-2.1.4-win.exe" -OutFile "dotnet-hosting-2.1.4-win.exe"
Start-Process "dotnet-hosting-2.1.4-win.exe" -Wait -ArgumentList '/S', '/v', '/qn' -passthru
Invoke-Expression "net stop was /y"
Invoke-Expression "net start w3svc"

After that, I try to use dotnet command, but it is not recognised. Then I try to install it again as below.

Start-Process "dotnet-hosting-2.1.4-win.exe"

It pops up a dialog with three options. "Repair", "Uninstall" and "Close". I choose "Repair" and every thing works.

So is there any method that I can use to choose repair option with powershell process and don't need to click the button? Because we have so many servers, it's a disaster to login these servers and click manually.

0

There are 0 best solutions below