Hello, I am trying to run a simple cmd command through action script but I am failing to do it properly, the fixlet debugger recognizes {content} in the middle of the script as relevance.
but i then proceed to put “waithidden” and then cmd.exe /C or direct place msiexec and it says “relevance clauses must be surrounded by guards”
How should I do to make this correct, in a way that it will not fail as it is happening? Sometimes I could get it to initiate the msiexec, but then somehow it never uninstalled the software we are trying.
If anyone knows how to do it properly, I kindly ask you to share.
In this particular case the ‘cmd.exe /C’ is not required. CMD is the Windows Command shell, required to run batch/cmd scripts. By habit and convention we often invoke CMD explicitly when we use the run/wait commands, but we can spawn any executable at all, it doesn’t have to be cmd.exe.
That said, the CMD shell does handle some things for us like expanding environment variables and handling stdout/stderr output redirection.
In fact I usually still wrap my PowerShell scripts in CMD shell commands for the output redirection handling.
Right, just did the above and it worked like charm. I really have a problem when it comes to relevance within an action script.
But I still have a question, If I wanted to personalize it, let’s say, I have different GUIDs for the same software, so I was thinking an approach where there is substitution, is it possible?
The script looks for “DisplayName” value “ABC Software” instead of looking for that particular GUID, and from there it grabs the "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall{abcdef12-3456-7890-abcd-efabcdef1234}, making the substitution on:
So the “found GUID” would correspond to the one it checked in the "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall", based on the DIsplayName value.
Yes that approach makes a lot of sense. I think there have been posts about this before, and if I’m not mistaken I think @jgstew has a dashboard on his GitHub page to automate building uninstall Fixlets this way.
Hmm, my mistake, it wasn’t a Dashboard but a reference to a REST API thing he made. There’s a reference to a repo of fixlets he created with it at Getting Uninstall Strings from Registry - #6 by jgstew but I’m not sure whether he has the script itself available
waithidden "{pathname of system folder & "\msiexec.exe"}"
As in…
waithidden "{pathname of system folder & "\msiexec.exe"}" /i "{pathname of client folder of current site & "\__Download\Agent-9.6.2-9141.msi"}" /qn /norestart
wait {(if value “UninstallString” of it as string as lowercase contains “msiexec.exe” then (“msiexec.exe /X " & name of it & " /QN /NORESTART”) else value “UninstallString” of it as string) of (keys of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of (x32 registries; x64 registries)) whose (value “DisplayName” of it as string contains “Mozilla Firefox (x64 en-US)”)}
And if you want to add MSI PROPERTIES to the command you can add them after /NORESTSRT