Jump to content

Checking to see if software is installed?


Recommended Posts

Hello, I am trying to do a silent installation of handbrake, but I want to check if -Microsoft .Net SDK- is installed on the computer and if so, go to the next installation of the program and if not, install it first. 

is it ok to do it this way?

$InstallPath = @ScriptDir & "\dotnet-sdk-5.0.403-win-x64.exe" 
$InstallPath1 = @ScriptDir & "\HandBrake-1.5.1-x86_64-Win_GUI.exe"
FileInstall('dotnet-sdk-5.0.403-win-x64.exe', $InstallPath,1)
FileInstall('HandBrake-1.5.1-x86_64-Win_GUI.exe', $InstallPath1,1)

$RegPath = RegEnumKey("HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\", "81aba691-7919-4e81-9d4a-e5df954b0b1d")
If Not FileExists($RegPath) Then
  ShellExecuteWait($InstallPath, "/install /norestart /quiet")
EndIf

ShellExecuteWait($InstallPath1, "/S")

 

 

 

Link to comment
Share on other sites

Wouldn't add the source executables to the script, just use something like this (untested):

InstallPath = @ScriptDir & "\dotnet-sdk-5.0.403-win-x64.exe" 
$InstallPath1 = @ScriptDir & "\HandBrake-1.5.1-x86_64-Win_GUI.exe"

$RegPath = RegRead("HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{81aba691-7919-4e81-9d4a-e5df954b0b1d}", "DisplayName")
If @error Then ;~ Unable to detect DotNet registry key item
    RunWait($InstallPath & " /install /norestart /quiet", "", @SW_HIDE)
EndIf

RunWait($InstallPath1 & " /S", "", @SW_HIDE)

 

Edited by Subz
Link to comment
Share on other sites

 

Hace 35 minutos, Subz dijo:

No agregaría los ejecutables de origen al script, solo usaría algo como esto (no probado):

InstallPath = @ScriptDir & "\dotnet-sdk-5.0.403-win-x64.exe" 
$InstallPath1 = @ScriptDir & "\HandBrake-1.5.1-x86_64-Win_GUI.exe"

$RegPath = RegRead("HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{81aba691-7919-4e81-9d4a-e5df954b0b1d}", "DisplayName")
If @error Then ;~ Unable to DotNet registry key item
    RunWait($InstallPath & " /install /norestart /quiet", "", @SW_HIDE)
EndIf

RunWait($InstallPath1 & " /S", "", @SW_HIDE)

 

¿Cómo sabe "regread" lo que estoy buscando en "displayname"?

Link to comment
Share on other sites

GUIDs "{81aba691-7919-4e81-9d4a-e5df954b0b1d}, should be unique, so we don't really need to worry about the display name value, you could also use "", however I prefer to select a value that I know exists, i.e. DisplayName, DisplayVersion etc..., otherwise you could check to see if the DisplayName/Version equals a particular name/version to be 100% sure, the above is just an example to get you started.

Link to comment
Share on other sites

2 hours ago, Subz said:

GUIDs "{81aba691-7919-4e81-9d4a-e5df954b0b1d}, should be unique, so we don't really need to worry about the display name value, you could also use "", however I prefer to select a value that I know exists, i.e. DisplayName, DisplayVersion etc..., otherwise you could check to see if the DisplayName/Version equals a particular name/version to be 100% sure, the above is just an example to get you started.

I understand now, I will study more thoroughly everything related to "reg", but why is it not convenient to use fileinstall? I wanted to pack everything to be able to use it with vbdeploy or with the same "voltran project" xD

Link to comment
Share on other sites

(I hope I don't bother you with my questions), I have this other code to install handbrake, since the "S" parameter doesn't create a direct access to the desktop, is it ok to do it this way?

#RequireAdmin

Run($InstallPath1)
Opt("WinWaitDelay",0)
$ctrlClck = ControlClick
$hWnd = WinWait("HandBrake 1.5.1 Setup", "Welcome to HandBrake 1.5.1 Setup")
$ctrlClck($hWnd, "", "Button2")
$hWnd1 = WinWait("HandBrake 1.5.1 Setup", "License Agreement")
$ctrlClck($hWnd1, "", "Button2")
$hWnd2 = WinWait("HandBrake 1.5.1 Setup", "Choose Install Location")
$ctrlClck($hWnd2, "", "Button2")
$hWnd3 = WinWait("HandBrake 1.5.1 Setup", "HandBrake 1.5.1 has been installed on your computer.")
$ctrlClck($hWnd3, "", "Button2")

Link to comment
Share on other sites

You could just use a progress bar to display while it's installing, Unsure about your environment that you want to use this in, but ControlClick function can be problematic when deploying to end users.  Normally when I deploy software I'll place a marquee type progress bar to show end users that the software is still installing.  With regards to why I don't recommend adding external files to the script, find that more often than not that I get false/positives from A/V.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...