Forums
New posts
Search forums
News
Security News
Technology News
Giveaways
Giveaways, Promotions and Contests
Discounts & Deals
Reviews
Users Reviews
Video Reviews
Support
Windows Malware Removal Help & Support
Inactive Support Threads
Mac Malware Removal Help & Support
Mobile Malware Removal Help & Support
Blog
Log in
Register
What's new
Search
Search titles only
By:
Search titles only
By:
Reply to thread
Menu
Install the app
Install
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Forums
Software
Security Apps
Kaspersky
[Tutorial] Update Kaspersky when starting the system automatically
Message
<blockquote data-quote="Guilhermesene" data-source="post: 1070926" data-attributes="member: 106646"><p>Hello everybody!</p><p></p><p>We all know that Kaspersky is a great and powerful security software. By default, Kaspersky is set to automatically update itself every 1 hour, however, we often wish that when we start the system it is already updated with the latest malware definitions and their fundamental modules (like other AVs on the market, such as ESET), ensuring that we are safe and up to date, mainly, after an extended period of system shutdown/sleep or hibernation.</p><p></p><p>In this tutorial, I will demonstrate how we can make it update as soon as the system starts.</p><p></p><p><strong><img class="smilie smilie--emoji" loading="lazy" alt="⚠️" title="Warning :warning:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/26a0.png" data-shortname=":warning:" /> Note I: Before we start, I apologize for the images being in Portuguese (Brazil) as my default system is in that language, but I did put the steps described in text format and even though the images are in Portuguese, the location of the settings and options do not change of location.</strong></p><p><strong><strong><strong><img class="smilie smilie--emoji" loading="lazy" alt="⚠️" title="Warning :warning:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/26a0.png" data-shortname=":warning:" /> </strong>Note II: Make sure you have system administrative permissions (Administrator)</strong></strong></p><p><strong><strong><img class="smilie smilie--emoji" loading="lazy" alt="⚠️" title="Warning :warning:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/26a0.png" data-shortname=":warning:" /></strong> Note III: If you use Kaspersky, whether in automatic mode or with restricted permissions like [USER=36043]@harlan4096[/USER] </strong><a href="https://malwaretips.com/threads/hardened-system-with-kaspersky.113553/" target="_blank"><strong>tutorial</strong></a><strong>, make sure to place the scripts created in the Trusted group and within "Intrusion Prevention → Manage resources" give permission to the scripts at least of reading.</strong></p><p></p><p>Let's go!</p><p></p><hr /><p></p><p><span style="color: rgb(65, 168, 95)"><strong><span style="font-size: 15px"><img class="smilie smilie--emoji" loading="lazy" alt="⚙️" title="Gear :gear:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/2699.png" data-shortname=":gear:" /> INITIAL SETTINGS</span></strong></span></p><p></p><p><span style="color: rgb(0, 0, 0)">In this first step, we will prepare the necessary files to make Kaspersky update automatically.</span></p><p></p><p>1 - Access your system's start menu and search for "<em>notepad.exe</em>" or simply "<em>notepad</em>"</p><p>[ATTACH=full]280704[/ATTACH]</p><p></p><p>2 - Paste the code below, which will be responsible for executing the necessary commands to update Kaspersky automatically when starting the system</p><p>[CODE]# Function to check internet connectivity</p><p>function Test-InternetConnection {</p><p> try {</p><p> $ping = New-Object System.Net.NetworkInformation.Ping</p><p> $reply = $ping.Send("8.8.8.8") # Using Google DNS for testing</p><p> return $reply.Status -eq 'Success'</p><p> }</p><p> catch {</p><p> return $false</p><p> }</p><p>}</p><p></p><p># Antivirus executable path</p><p>$KasperskyPath = "C:\Program Files (x86)\Kaspersky Lab\Kaspersky 21.15\avp.exe"</p><p></p><p># Wait until the system is fully booted and the internet is available</p><p>while (-not (Test-InternetConnection)) {</p><p> Start-Sleep -Seconds 10</p><p>}</p><p></p><p># Execute the update command silently</p><p>Start-Process -FilePath $KasperskyPath -ArgumentList "UPDATE" -WindowStyle Hidden[/CODE]</p><p></p><p>[SPOILER="Explaining the code above"]</p><ul> <li data-xf-list-type="ul"><strong><strong>In the first part of the code, we define a function that will check if there is an active connection to the internet by performing a test (ping) for Google's DNS.</strong></strong></li> <li data-xf-list-type="ul"><strong><strong>In the second part of the code, we define a variable to store the path of the main file responsible for Kaspersky (change only if very necessary, as this is the normal path by default)</strong></strong></li> <li data-xf-list-type="ul"><strong><strong>In the third part, the code goes into a loop, checking whether the system has been fully loaded and whether there is an active internet connection. If there is no active internet connection, it waits 10 seconds and checks using the "Test-InternetConnection" function.</strong></strong></li> <li data-xf-list-type="ul"><strong><strong>In the last part of the code, the command to update Kaspersky is executed.</strong></strong></li> </ul><p>[/SPOILER]</p><p></p><p>3 - After pasting the code, save the file with whatever name you want and in a safe location with the extension <em>.ps1</em> (powershell)</p><p>[ATTACH=full]280705[/ATTACH]</p><p>4 - Now let's create a file to initialize the script with the <em>.ps1</em> extension silently without opening any powershell window. Open notepad.exe again and paste the following code:</p><p>[CODE]Set WshShell = CreateObject("WScript.Shell")</p><p>WshShell.Run "powershell.exe -ExecutionPolicy Bypass -File ""PATH OF YOUR .PS1 FILE HERE""", 0, True</p><p>Set WshShell = Nothing</p><p></p><p>Example:</p><p></p><p>Set WshShell = CreateObject("WScript.Shell")</p><p>WshShell.Run "powershell.exe -ExecutionPolicy Bypass -File ""D:\Kaspersky\k-update.ps1""", 0, True</p><p>Set WshShell = Nothing[/CODE]</p><p></p><p>5 - Save the file in the same location where you saved the file with the <em>.ps1</em> extension, however, save this other file with the <em>.vbs</em> extension</p><p>[ATTACH=full]280706[/ATTACH]</p><hr /><p></p><p><strong><span style="font-size: 15px"><span style="color: rgb(65, 168, 95)"><img class="smilie smilie--emoji" loading="lazy" alt="⌛" title="Hourglass done :hourglass:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/231b.png" data-shortname=":hourglass:" />️ AUTOMATING THE UPDATE</span></span></strong></p><p></p><p>In this second step, we will configure Windows to update Kaspersky automatically when we start the system through the Windows Task Scheduler using our previously created files.</p><p></p><p>6 - Click on the start menu and type "<em>Windows Task Scheduler</em>"</p><p>[ATTACH=full]280707[/ATTACH]</p><p></p><p>7 - After opening the Windows task scheduler, on the right side of the window, click → "<em>Create Task...</em>"</p><p>[ATTACH=full]280708[/ATTACH]</p><p></p><p>8 - In the window that opens, within the "<em>General</em>" tab, define a desired name for the task, for example, <em>Kaspersky Start Update</em></p><p>Still within the same tab, select the following options → <em>Run only when the user is logged in</em> and <em>Run with higher privileges</em></p><p>Select from "<em>Configure for</em>" → "<em>Windows 10</em>" (also function in Windows 11)</p><p>[ATTACH=full]280709[/ATTACH]</p><p></p><p>9 - In the "<em>Triggers</em>" tab, click → "<em>New...</em>"</p><p>[ATTACH=full]280710[/ATTACH]</p><p></p><p>10 - In the window that opens, select "<em>Start task</em>" → "<em>On Initialization...</em>"</p><p>A little lower in the same window in "<em>Advanced settings</em>" select the option "<em>Delay task by</em>:" → "<em>20 seconds</em>"</p><p>Still in the same window, select "<em>Enabled</em>" and press "<em>Ok</em>"</p><p>[ATTACH=full]280711[/ATTACH]</p><p></p><p>11 - Click on the "<em>Actions</em>" tab</p><p>Click "<em>New...</em>"</p><p>[ATTACH=full]280712[/ATTACH]</p><p></p><p>12 - In Action select from the list → "<em>Start a program</em>"</p><p>In "<em>Program/Script</em>" fill in the box with "<em>wscript.exe</em>"</p><p>In "<em>Add arguments (optional)</em>" fill in the box with the path referring to the file with the <em>.vbs</em> extension, for example: "<em>D:\Kaspersky\k-start-hidden.vbs</em>" and click "<em>Ok</em>"</p><p>[ATTACH=full]280713[/ATTACH]</p><p></p><p>13 - Click on the "<em>Settings</em>" tab</p><p>Check the following boxes:</p><p> → <em>Allow the task to run on demand</em></p><p>→ <em>Run the task as soon as possible after a scheduled startup is missed</em></p><p>→ <em>Stop the task if it runs for more than (select 1 hour)</em></p><p>→ <em>If the running task does not stop when requested, force stop it</em></p><p>Click "<em>Ok</em>"</p><p>[ATTACH=full]280714[/ATTACH]</p><p></p><p>14 - Select the created task and click "<em>Run</em>" on the right side of the Windows Task Scheduler to test if the script is working. If everything goes well, Kaspersky will start the database update process.</p><p>[ATTACH=full]280715[/ATTACH]</p><p></p><p>15 - Restart your computer and watch the magic work as you start your system (without any powershell/cmd windows opening).</p><p></p><p>I hope I helped someone <img class="smilie smilie--emoji" loading="lazy" alt="😄" title="Grinning face with smiling eyes :smile:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/1f604.png" data-shortname=":smile:" /></p><p> </p><p>Feel free to modify my script to your best advantage.</p><p></p><p>Regards for all <img class="smilie smilie--emoji" loading="lazy" alt="🙋♂️" title="Man raising hand :man_raising_hand:" src="https://cdn.jsdelivr.net/joypixels/assets/6.6/png/unicode/64/1f64b-2642.png" data-shortname=":man_raising_hand:" /></p></blockquote><p></p>
[QUOTE="Guilhermesene, post: 1070926, member: 106646"] Hello everybody! We all know that Kaspersky is a great and powerful security software. By default, Kaspersky is set to automatically update itself every 1 hour, however, we often wish that when we start the system it is already updated with the latest malware definitions and their fundamental modules (like other AVs on the market, such as ESET), ensuring that we are safe and up to date, mainly, after an extended period of system shutdown/sleep or hibernation. In this tutorial, I will demonstrate how we can make it update as soon as the system starts. [B]⚠️ Note I: Before we start, I apologize for the images being in Portuguese (Brazil) as my default system is in that language, but I did put the steps described in text format and even though the images are in Portuguese, the location of the settings and options do not change of location. [B][B]⚠️ [/B]Note II: Make sure you have system administrative permissions (Administrator) ⚠️[/B] Note III: If you use Kaspersky, whether in automatic mode or with restricted permissions like [USER=36043]@harlan4096[/USER] [/B][URL='https://malwaretips.com/threads/hardened-system-with-kaspersky.113553/'][B]tutorial[/B][/URL][B], make sure to place the scripts created in the Trusted group and within "Intrusion Prevention → Manage resources" give permission to the scripts at least of reading.[/B] Let's go! [HR][/HR] [COLOR=rgb(65, 168, 95)][B][SIZE=4]⚙️ INITIAL SETTINGS[/SIZE][/B][/COLOR] [COLOR=rgb(0, 0, 0)]In this first step, we will prepare the necessary files to make Kaspersky update automatically.[/COLOR] 1 - Access your system's start menu and search for "[I]notepad.exe[/I]" or simply "[I]notepad[/I]" [ATTACH type="full" width="405px"]280704[/ATTACH] 2 - Paste the code below, which will be responsible for executing the necessary commands to update Kaspersky automatically when starting the system [CODE]# Function to check internet connectivity function Test-InternetConnection { try { $ping = New-Object System.Net.NetworkInformation.Ping $reply = $ping.Send("8.8.8.8") # Using Google DNS for testing return $reply.Status -eq 'Success' } catch { return $false } } # Antivirus executable path $KasperskyPath = "C:\Program Files (x86)\Kaspersky Lab\Kaspersky 21.15\avp.exe" # Wait until the system is fully booted and the internet is available while (-not (Test-InternetConnection)) { Start-Sleep -Seconds 10 } # Execute the update command silently Start-Process -FilePath $KasperskyPath -ArgumentList "UPDATE" -WindowStyle Hidden[/CODE] [SPOILER="Explaining the code above"] [LIST] [*][B][B]In the first part of the code, we define a function that will check if there is an active connection to the internet by performing a test (ping) for Google's DNS.[/B][/B] [*][B][B]In the second part of the code, we define a variable to store the path of the main file responsible for Kaspersky (change only if very necessary, as this is the normal path by default)[/B][/B] [*][B][B]In the third part, the code goes into a loop, checking whether the system has been fully loaded and whether there is an active internet connection. If there is no active internet connection, it waits 10 seconds and checks using the "Test-InternetConnection" function.[/B][/B] [*][B][B]In the last part of the code, the command to update Kaspersky is executed.[/B][/B] [/LIST] [/SPOILER] 3 - After pasting the code, save the file with whatever name you want and in a safe location with the extension [I].ps1[/I] (powershell) [ATTACH type="full"]280705[/ATTACH] 4 - Now let's create a file to initialize the script with the [I].ps1[/I] extension silently without opening any powershell window. Open notepad.exe again and paste the following code: [CODE]Set WshShell = CreateObject("WScript.Shell") WshShell.Run "powershell.exe -ExecutionPolicy Bypass -File ""PATH OF YOUR .PS1 FILE HERE""", 0, True Set WshShell = Nothing Example: Set WshShell = CreateObject("WScript.Shell") WshShell.Run "powershell.exe -ExecutionPolicy Bypass -File ""D:\Kaspersky\k-update.ps1""", 0, True Set WshShell = Nothing[/CODE] 5 - Save the file in the same location where you saved the file with the [I].ps1[/I] extension, however, save this other file with the [I].vbs[/I] extension [ATTACH type="full"]280706[/ATTACH] [HR][/HR] [B][SIZE=4][COLOR=rgb(65, 168, 95)]⌛️ AUTOMATING THE UPDATE[/COLOR][/SIZE][/B] In this second step, we will configure Windows to update Kaspersky automatically when we start the system through the Windows Task Scheduler using our previously created files. 6 - Click on the start menu and type "[I]Windows Task Scheduler[/I]" [ATTACH type="full" width="409px"]280707[/ATTACH] 7 - After opening the Windows task scheduler, on the right side of the window, click → "[I]Create Task...[/I]" [ATTACH type="full" width="903px"]280708[/ATTACH] 8 - In the window that opens, within the "[I]General[/I]" tab, define a desired name for the task, for example, [I]Kaspersky Start Update[/I] Still within the same tab, select the following options → [I]Run only when the user is logged in[/I] and [I]Run with higher privileges[/I] Select from "[I]Configure for[/I]" → "[I]Windows 10[/I]" (also function in Windows 11) [ATTACH type="full" width="437px"]280709[/ATTACH] 9 - In the "[I]Triggers[/I]" tab, click → "[I]New...[/I]" [ATTACH type="full" width="396px"]280710[/ATTACH] 10 - In the window that opens, select "[I]Start task[/I]" → "[I]On Initialization...[/I]" A little lower in the same window in "[I]Advanced settings[/I]" select the option "[I]Delay task by[/I]:" → "[I]20 seconds[/I]" Still in the same window, select "[I]Enabled[/I]" and press "[I]Ok[/I]" [ATTACH type="full" width="463px"]280711[/ATTACH] 11 - Click on the "[I]Actions[/I]" tab Click "[I]New...[/I]" [ATTACH type="full" width="463px"]280712[/ATTACH] 12 - In Action select from the list → "[I]Start a program[/I]" In "[I]Program/Script[/I]" fill in the box with "[I]wscript.exe[/I]" In "[I]Add arguments (optional)[/I]" fill in the box with the path referring to the file with the [I].vbs[/I] extension, for example: "[I]D:\Kaspersky\k-start-hidden.vbs[/I]" and click "[I]Ok[/I]" [ATTACH type="full" width="396px"]280713[/ATTACH] 13 - Click on the "[I]Settings[/I]" tab Check the following boxes: → [I]Allow the task to run on demand[/I] → [I]Run the task as soon as possible after a scheduled startup is missed[/I] → [I]Stop the task if it runs for more than (select 1 hour)[/I] → [I]If the running task does not stop when requested, force stop it[/I] Click "[I]Ok[/I]" [ATTACH type="full" width="474px"]280714[/ATTACH] 14 - Select the created task and click "[I]Run[/I]" on the right side of the Windows Task Scheduler to test if the script is working. If everything goes well, Kaspersky will start the database update process. [ATTACH type="full" width="264px"]280715[/ATTACH] 15 - Restart your computer and watch the magic work as you start your system (without any powershell/cmd windows opening). I hope I helped someone 😄 Feel free to modify my script to your best advantage. Regards for all 🙋♂️ [/QUOTE]
Insert quotes…
Verification
Post reply
Top