![]() |
![]() | How to apply update in silent mode | ![]() |
![]() |
![]() | ![]() |
coldscientist
![]() |
![]() |
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. |
|||||||||||
|
![]() |
![]() | How to apply update in silent mode | ![]() |
|
||
![]() |
![]() |
Powered by phpBB © phpBB Group
Design by phpBBStyles.com | Styles Database.
Content © ClamWin Free Antivirus GNU GPL Free Software Open Source Virus Scanner. Free Windows Antivirus. Stay Virus Free with Free Software.
Design by phpBBStyles.com | Styles Database.
Content © ClamWin Free Antivirus GNU GPL Free Software Open Source Virus Scanner. Free Windows Antivirus. Stay Virus Free with Free Software.