Silent install
Posted: July 17th, 2021, 2:01 pm
I just saw a commit was made about installer supporting silent install. So does that mean Rainmeter will be available through Win-Get?
No cheating...death.crafter wrote: ↑July 17th, 2021, 2:01 pm I just saw a commit was made about installer supporting silent install. So does that mean Rainmeter will be available through Win-Get?
Hmm.. Like literallyjsmorley wrote: ↑July 17th, 2021, 2:14 pm Not sure it's going to be a lot less work using WinGet. You will need to open a cmd or Powershell window "As Administrator" and then execute whatever command to WinGet is required. That might be just WinGet -Upgrade Rainmeter or some such, but if you need to add parameters to the install, it might be a bit more complicated. Still, it's an interesting concept, and we hope to get it implemented pretty soon.
Code: Select all
Write-Host Getting Rainmeter from WinGet
Start-Process -FilePath WinGet -ArgumentList "-upgrade Rainmeter" -wait -verb runas
Write-Host Starting Rainmeter...
Start-Process -FilePath "C:\Program Files\Rainmeter\Rainmeter.exe" -WorkingDirectory "C:\Program Files\Rainmeter"
Start-Sleep -s 1
stop-process -Id $PID
I don't think the Start-Process part is necessary. WinGet works directly from powershell, as you saw in the gif I made. Justjsmorley wrote: ↑July 17th, 2021, 2:43 pm The silent install will exit Rainmeter, and will NOT restart Rainmeter automatically when it is done, so I expect that some kind of .ps1 script will be desirable for this, so it can start Rainmeter at the end of the process.
Something like this maybe:
I think this could be run by just right-clicking the .ps1 file, and selecting "Run with Powershell". The WinGet will elevate itself with a UAC prompt when executed. We do NOT want you running Rainmeter itself "As Administrator". That is why the silent install, WinGet or manually, doesn't start it up. In order to be "silent", the installer must be run "As Administrator" in order to be allowed to write to C:\Program Files without a UAC prompt. It will just fail entirely if it is not run elevated.Code: Select all
Write-Host Getting Rainmeter from WinGet Start-Process -FilePath WinGet -ArgumentList "-upgrade Rainmeter" -wait -verb runas Write-Host Starting Rainmeter... Start-Process -FilePath "C:\Program Files\Rainmeter\Rainmeter.exe" -WorkingDirectory "C:\Program Files\Rainmeter" Start-Sleep -s 1 stop-process -Id $PID
Code: Select all
winget upgrade rainmeter
I'm looking at Start-Processs in order to pass the -verb runas. My hope is that you don't need to elevate the entire .ps1 script to run it, so Rainmeter is not started "As Administrator".death.crafter wrote: ↑July 17th, 2021, 3:07 pm I don't think the Start-Process part is necessary. WinGet works directly from powershell, as you saw in the gif I made. Justwould be enough.Code: Select all
winget upgrade rainmeter
And why do you need to set the working directory? Wouldn't it automatically start there?
Code: Select all
$installerARG=$args[0]
Write-Host Installing Rainmeter...
Start-Process -FilePath $installerARG -ArgumentList "/S /LANGUAGE=1033 /PORTABLE=0 /VERSION=64 /AUTOSTARTUP=1 /D=`"C:\Program Files\Rainmeter`"" -verb runas
Write-Host Waiting 2 seconds...
Start-Sleep -s 2
Write-Host Starting Rainmeter...
Start-Process -FilePath "C:\Program Files\Rainmeter\Rainmeter.exe" -WorkingDirectory "C:\Program Files\Rainmeter"
Start-Sleep -s 1
stop-process -Id $PID
If you just do
Code: Select all
explorer.exe "$($env:SYSTEMDRIVE)\Program Files\Rainmeter\Rainmeter.exe"