ClamWin Free Antivirus Forum Index
ClamWin Free Antivirus
Support and Discussion Forums
Reply to topic
How to apply update in silent mode
jimsmi101


Joined: 30 Nov 2017
Posts: 2
Reply with quote
I got a notification of a new version and it is an update file. I need to push this out to about 150 machines and I need to do this in silent mode. The normal "/sp- /silent /norestart" does not work. What commands do I need to use to push out the update in silent mode? Confused
View user's profileSend private message
coldscientist


Joined: 24 Jan 2018
Posts: 18
Location: Brazil
Reply with quote
Hello jimsmi101,

It's a lot of machines!

I use the following C# snippets into Ketarin to uninstall ClamWin and install it unattended:

<xml>
<CustomSetupInstruction>
<Code>/*
Enter a custom C# script here. C# is case sensitive.
"app" references the current application.
Example:
MessageBox.Show(app.Name);

= Notable methods =
app.PreviousLocation
Corresponds to the variable {file}

app.Variables.ReplaceAllInString("Any {text} with variables.")
Replaces all known variables in a given string.
Example: string new = app.Variables.ReplaceAllInString("{file}")

return;
Exits the script.

Abort("Error text");
Exits the script with a given error.
*/
try {
using (Microsoft.Win32.RegistryKey localKey = Microsoft.Win32.RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine,
Microsoft.Win32.RegistryView.Registry32).OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ClamWin Free Antivirus_is1"))
{
if (localKey != null)
{
Object o = localKey.GetValue("UninstallString");
if (o != null)
{
Ketarin.Forms.LogDialog.Log((o as String) + " /SILENT");
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo((o as String), "/SILENT");
var process = System.Diagnostics.Process.Start (startInfo);
process.WaitForExit();
}
}
else
{
Abort("Key not found.");
}
}
}
catch (Exception ex) //just for demonstration...it's always best to handle specific exceptions
{

}
</Code>
<Type>CS</Type>
</CustomSetupInstruction>

----------------------------------

<xml>
<StartProcessInstruction>
<EnvironmentVariables>
<FileName>{file}</FileName>
<Parameters>/silent /norestart /supressmsgboxes /forcecloseapplications /forceinstall /tasks=desktopicon</Parameters>
<WaitForExit>true</WaitForExit>
</StartProcessInstruction>

----------------------------------

The first snippet will uninstall ClamWin unattended. It queries Uninstall key from registry to find the uninstaller path of ClamWin, then it runs it silently if the key is found.

After the uninstallation, I call the ClamWin installer file with the attributes /silent /norestart /supressmsgboxes /forcecloseapplications /forceinstall /tasks=desktopicon

You can adapt it to any programming language you want (like BAT, VBS, etc). It's up to you. I recommend more extensive tests to see if works into your environment. Maybe you should need to kill ClamTray.exe and ClamScan.exe process (using something like "taskkill /f /im ClamTray.exe" into BAT, or calling the Win Process API from VBS/C#) before uninstalling.
View user's profileSend private message
How to apply update in silent mode
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic