Generate summary with AI

Scripts are a gentle reminder of the early days of automation. Scrips are everywhere; computers have been using them forever. And it eventually extended to the web as technology became more powerful.

Like an actor to the script at hand, computers execute scripts when they are invoked. The actual code may be hidden and invoked using a simple one-liner command, but scripts are a useful way to automate mundane tasks.

What is a script?

In simple terms, a script is a set of instructions that executes when it is invoked. It is similar to an object in computer programming that doesn’t have to be explicitly defined every time it’s needed. However, while it is related to programming, scripting is different. For instance, a script is not compiled at runtime and is executed by an interpreter.

While scripts are not as complex, they are useful for taking away manual control from small tasks, such as executing a program at a particular condition or running a disk cleanup after a specified number of days.

Useful scripts for every IT professional

As an IT professional or an individual with a computer, scripts can save you a lot of time.

Atera’s Remote Monitoring and Management platform allows you to create and schedule scripts. So, as a technician working offsite or an IT administrator in an office, you simply need to schedule a task and let Atera’s software do its magic.

We have compiled a list of scripts to hopefully make you’re work-life a little easier.

Disable USB storage

Are you worried that employees working on a super confidential project may copy files? This script allows you to disable USB access on the computer. It will not break the function with input devices like a keyboard and mouse but only prevent a user from plugging in a USB storage device like a USB thumb drive or an external HDD/SSD.

The script:

Atera does not guarantee the integrity, availability, security, virus-free, safety, lawfulness, non-infringement, rights’ status, or functionality of the scripts. The use of the shared scripts is at your own risk. Scripts are provided “AS IS”. *

reg add HKLM\SYSTEM\CurrentControlSet\Services\UsbStor /v "Start" /t REG_DWORD /d "4" /f
Script copied to clipboard

Clear DNS

DNS is an address book for the internet that allows websites to be translated into IP addresses. What seems like a quick process actually involves multiple steps. Operating systems speed this much by building a cache of the most visited websites.

Clearing the DNS cache helps when the cache has outdated information. For example, if a website moves to a different server, the older IP address will no longer return the web page.

It is important to clear DNS cache frequently to avoid running into issues, especially in a web development environment.

The script:

Atera does not guarantee the integrity, availability, security, virus-free, safety, lawfulness, non-infringement, rights’ status, or functionality of the scripts. The use of the shared scripts is at your own risk. Scripts are provided “AS IS”. *

ipconfig /flushdns
Script copied to clipboard

Renew IP address

Renewing the IP address could resolve “no internet connectivity” issues. You will first have to release the current IP address and request a new one from the DCHP server.

The script:

Atera does not guarantee the integrity, availability, security, virus-free, safety, lawfulness, non-infringement, rights’ status, or functionality of the scripts. The use of the shared scripts is at your own risk. Scripts are provided “AS IS”. *

ipconfig /renew
Script copied to clipboard

Upgrade Microsoft office

Microsoft Office is one of the leading productivity software for creating text documents, spreadsheets, presentation slides, and more. Although cloud-based versions exist, having Microsoft Office locally on the machine continues to be the de-facto way to create documents.

As an IT professional, you can use this script to automatically upgrade a PC to the latest version of Microsoft Office.

The script:

Atera does not guarantee the integrity, availability, security, virus-free, safety, lawfulness, non-infringement, rights’ status, or functionality of the scripts. The use of the shared scripts is at your own risk. Scripts are provided “AS IS”. *

setlocal reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\ClickToRun\Configuration\ /v CDNBaseUrlif %errorlevel%==0 (goto SwitchChannel) else (goto End)

:SwitchChannel

reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\ClickToRun\Configuration /v CDNBaseUrl /t REG_SZ /d "http://officecdn.microsoft.com/pr/492350f6-3a01-4f97-b9c0-c7c6ddf67d60" /f

reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\ClickToRun\Configuration /v UpdateUrl /f

reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\ClickToRun\Configuration /v UpdateToVersion /f

reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\ClickToRun\Updates /v UpdateToVersion /f

reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Office\16.0\Common\OfficeUpdate\ /f

:End

Endlocal
Script copied to clipboard

Weekly system maintenance

Certain actions like creating a restore point can save you from the problems of reinstalling the operating system entirely. A restore point is like a checkpoint in a video game that can be reloaded if the operating system becomes unstable. The restore point will revert the operating system to the last known stable state.

This Power Shell script will also remove the temporary junk from Windows folders.

The script:

Atera does not guarantee the integrity, availability, security, virus-free, safety, lawfulness, non-infringement, rights’ status, or functionality of the scripts. The use of the shared scripts is at your own risk. Scripts are provided “AS IS”. *

Checkpoint-Computer -Description "Weekly Maintanence" -RestorePointType "MODIFY_SETTINGS"

Write-Host "System Restore Point created successfully"

$objShell = New-Object -ComObject Shell.Application

$objFolder = $objShell.Namespace(0xA)

$temp = get-ChildItem "env:\TEMP"

$temp2 = $temp.Value

$WinTemp = "c:\Windows\Temp\*"

write-Host "Removing Junk files in $temp2." -ForegroundColor Magenta Remove-Item -Recurse "$temp2\*" -Force -Verbose

write-Host "Removing Junk files in $WinTemp." -ForegroundColor Green Remove-Item -Recurse $WinTemp -Force
Script copied to clipboard

Clear event logs

This PowerShell script is an easy way to clear out all event logs. The event logger is a component of the Windows operating system that records errors, such as when a program or the operating system suffers a crash.

System administrators can view the event logs to see what caused the behaviour. If you want to clear out the event logs, here’s a simple script for that.

The script:

Atera does not guarantee the integrity, availability, security, virus-free, safety, lawfulness, non-infringement, rights’ status, or functionality of the scripts. The use of the shared scripts is at your own risk. Scripts are provided “AS IS”. *

@echo off

for /F %%a IN (?wevtutil el?) DO (wevtutil.exe cl %%a >nul 2>&1)

IF (%adminTest%)==(Access) goto noAdmin

for /F "tokens=*" %%G in ('wevtutil.exe el') DO (call :do_clear "%%G")

echo.

echo Event Logs have been cleared!

goto theEnd

:do_clear

echo clearing %1

wevtutil.exe cl %1

goto :eof

:noAdmin

echo You must run this script as an Administrator!

echo.

:theEnd
Script copied to clipboard

Utilize Atera’s shared script library to supercharge your IT automation

The shared script library gives you access to hundreds of scripts created and shared by the growing community of Atera. Access these powerful scripts from within your RMM dashboard to clone them into your personal library or schedule a script execution for remote management.

Was this helpful?

* Scripts are provided for your benefit. You understand and acknowledge that when downloading and/or copying and/or using the Scripts: (i) you may be exposed to Scripts from a variety of sources, (ii) Atera is not responsible and takes no liability for the accuracy, usefulness, integrity, lawfulness, title or infringement, security, functionality or Intellectual Property Rights of, or relating to, such Scripts; and (iii) the Scripts are provided “AS IS” and “AS AVAILABLE”, and may have errors, and may not be malware-free, and that your interactions with, and use of, the Scripts is at your sole risk and free will. You hereby agree to waive, and hereby do waive, any legal or equitable rights or remedies you may have against Atera with respect to the Scripts.

Related Articles

The 4 stages to achieving IT automation maturity

Read now

Top 9 Active Directory monitoring tools for 2025

Read now

How to automate tasks with PowerShell scripts

Read now

How to run .exe files in PowerShell

Read now

Endless IT possibilities

Boost your productivity with Atera’s intuitive, centralized all-in-one platform