Skip to main content
A strong digital foundation for your business.

Knowledge Base

Practical guides that make your hosting, domain and virtual server services easier to understand.

Windows Server maintenance: updates, Defender and performance checks

This guide sets up a weekly and monthly maintenance routine for your Windows Server: applying updates on a schedule, checking Microsoft Defender and the firewall, and catching performance, disk and clock problems early with PowerShell commands, step by step.

The maintenance routine: weekly and monthly checks

Problems on Windows Server usually build up over time: a postponed restart, a C: drive that is slowly filling up, virus definitions that have not been updated for weeks. Hostimor virtual servers are an unmanaged service, so operating system maintenance is your responsibility (see the Service Scope and Support Terms). Add the table below to your calendar.

FrequencyCheckTool or command
WeeklyPending updates and whether a restart is neededWindows Update, the RebootRequired key with Test-Path
WeeklyDefender status, virus definition age and recent detectionsGet-MpComputerStatus, Get-MpThreatDetection
WeeklyCritical errors in the System and Application logsGet-WinEvent
WeeklyFree space on the C: driveGet-PSDrive C
MonthlyTaking a snapshot, installing the monthly updates and a planned restartSnapshots, Windows Update or sconfig
MonthlyComponent store and temporary file cleanupDism.exe, cleanmgr
MonthlyCPU, memory and disk latency trendsTask Manager, resmon, Get-Counter
MonthlyFirewall profiles, RDP rules and Defender exclusionsGet-NetFirewallProfile, Get-MpPreference
MonthlyTime synchronization and the VMware Tools servicew32tm, Get-Service VMTools
MonthlyA sample restore from your backupYour backup tool

Run the commands in a PowerShell window running as administrator. Microsoft releases security updates on the second Tuesday of every month; scheduling your monthly maintenance a few days later gives time for any problematic update to become known.

Windows Update: apply updates on a schedule

Settings, sconfig and update history

On servers with the Desktop Experience, manage updates from the Windows Update section of the Settings app; on Windows Server 2016–2022 it is under Update & Security, on 2025 it is in the main menu, and on 2012 R2 it is in Control Panel. On the command line, type sconfig: the Windows Update settings option chooses automatic, download-only or manual mode, and the install updates option installs pending updates. Menu numbers vary between versions, so find the option by its name (see Microsoft's sconfig documentation). To see recent updates and whether a restart is pending:

PowerShell
$wu  = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired'
$cbs = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending'
(Test-Path $wu) -or (Test-Path $cbs)
Get-HotFix | Sort-Object InstalledOn -Descending | Select-Object -First 5 HotFixID, Description, InstalledOn

If the third line returns True, there are updates waiting for a restart; do not leave it that way for long, because it can also block later updates from installing.

Active hours and planned restarts

Windows does not restart on its own for updates during its active hours. Set the active hours to cover your busy period, and plan restarts yourself. The task below restarts the server at 03:30 the next day with a one-minute warning:

PowerShell
# One-time restart task for 03:30 tomorrow
$when    = (Get-Date).Date.AddDays(1).AddHours(3).AddMinutes(30)
$trigger = New-ScheduledTaskTrigger -Once -At $when
$action  = New-ScheduledTaskAction -Execute 'shutdown.exe' -Argument '/r /t 60'
Register-ScheduledTask -TaskName 'Planli-Yeniden-Baslatma' -Trigger $trigger -Action $action -User 'SYSTEM' -RunLevel Highest -Force
Get-ScheduledTask -TaskName 'Planli-Yeniden-Baslatma' | Get-ScheduledTaskInfo

After the server is back up, delete the task with Unregister-ScheduledTask -TaskName 'Planli-Yeniden-Baslatma' -Confirm:$false. You can also use the Restart Server tool in the client area: when VMware Tools is running, it restarts Windows cleanly; when it is not, it performs a hard reset. So check first that the VMTools service is running (see the power actions guide).

Warning

During a restart, the "Working on updates" screen can take a long time. Do not use Force Stop or Hard Reset at this stage; an interrupted update can keep the system from booting. RDP does not connect during this phase, so follow the progress with the VNC Console.

Take a snapshot before major updates

Before the monthly cumulative update or a new server role, take a restore point with the Snapshots tool. You can keep at most 2 snapshots at a time; snapshots grow over time and the disk cannot be expanded while one exists, so delete it once you have verified the update. A snapshot is not a substitute for a backup (see the snapshot guide).

Microsoft Defender and the firewall

Microsoft Defender Antivirus is built into Windows Server 2016 and later. It is not built into Windows Server 2012 R2, and the cmdlets below are not available there.

Status, definition updates and scans

PowerShell
Get-MpComputerStatus | Select-Object AMServiceEnabled, AntivirusEnabled, RealTimeProtectionEnabled, AntivirusSignatureLastUpdated, AntivirusSignatureAge, QuickScanEndTime
Update-MpSignature
Start-MpScan -ScanType QuickScan
Get-MpThreatDetection | Select-Object -First 10 InitialDetectionTime, ThreatID, ActionSuccess, Resources
Get-MpThreat | Select-Object ThreatName, SeverityID, IsActive

AntivirusEnabled and RealTimeProtectionEnabled should be True. AntivirusSignatureAge shows how many days old the virus definitions are; if it is more than a few days, check outbound HTTPS connectivity and the Windows Update service. In the Get-MpThreatDetection output, ActionSuccess shows whether remediation succeeded, and Get-MpThreat shows each threat's name and severity.

Add exclusions only when you need them

Large files that change often, such as database files, can slow scanning down, and the software vendor may recommend excluding certain folders. Windows Server 2016 and later already apply some exclusions automatically based on the installed roles. Add manual exclusions only when needed and keep their scope narrow; every excluded folder is a blind spot for malware.

PowerShell
# Only for a narrowly scoped folder you have a reason to exclude
Add-MpPreference -ExclusionPath 'C:\SQLData'
# List the current exclusions
Get-MpPreference | Select-Object -ExpandProperty ExclusionPath
# Remove it once it is no longer needed
Remove-MpPreference -ExclusionPath 'C:\SQLData'
Note

Attackers who take over a server often add Defender exclusions so their own files are not scanned. Review the exclusion list during your monthly maintenance; if you see an entry you do not recognize, follow the steps for a compromised server.

Firewall profiles

All three Windows Defender Firewall profiles, Domain, Private and Public, should be on. Rules are applied according to the profile of the connection; the second command shows which profile you are in:

PowerShell
Get-NetFirewallProfile | Format-Table Name, Enabled
Get-NetConnectionProfile | Format-Table InterfaceAlias, NetworkCategory
Get-NetFirewallRule | Where-Object Name -like 'RemoteDesktop*' | Format-Table Name, Enabled, Profile
# If a profile is off (check the RDP rules first):
Set-NetFirewallProfile -Profile Domain,Private,Public -Enabled True

Before turning on a profile that is off, make sure the Remote Desktop rules are enabled in that profile; if you get locked out, sign in through the VNC Console and fix the rule. To restrict RDP access by IP address, see the RDP security guide.

Performance checks: CPU, memory and disk

When something is slow, start with Task Manager (taskmgr): the Performance tab shows CPU, memory, disk and network usage, and the Details tab shows the processes. Resource Monitor (resmon) also shows which process writes to which file and connects to which address. To record and compare measurements, read the counters with PowerShell:

PowerShell
Get-Counter -Counter '\Processor(_Total)\% Processor Time', '\Memory\Available MBytes', '\LogicalDisk(C:)\% Free Space', '\PhysicalDisk(_Total)\Avg. Disk sec/Read' -SampleInterval 2 -MaxSamples 5

As a rule of thumb, there is a bottleneck if processor time stays above 80–90 percent for a long time, if available memory drops below 10 percent of total RAM, or if disk read time constantly exceeds 0.020 seconds (20 ms); look at samples over several minutes, not a single reading.

Counter names on a Turkish-language Windows

Performance counter names are localized to the language of the operating system. On a Windows installation with a Turkish interface, the English counter paths above can fail with a "not found" error; in that case, take the local counter names from Performance Monitor (perfmon), or use the language-independent CIM queries below.

PowerShell
Get-CimInstance Win32_PerfFormattedData_PerfOS_Processor -Filter "Name='_Total'" | Select-Object PercentProcessorTime
Get-CimInstance Win32_OperatingSystem | Select-Object @{Name='FreeMB'; Expression={[math]::Round($_.FreePhysicalMemory / 1KB)}}, @{Name='TotalMB'; Expression={[math]::Round($_.TotalVisibleMemorySize / 1KB)}}
Get-Process | Sort-Object CPU -Descending | Select-Object -First 10 Name, Id, CPU, @{Name='RAM_MB'; Expression={[math]::Round($_.WorkingSet64 / 1MB)}}

The CPU column does not show the current percentage but the total processor seconds used since the process started, so it is normal for a long-running service to be at the top. If resources are regularly not enough, consider tuning your application or a resource upgrade.

System health: disk, clock, logs and VMware Tools

Disk space

Get-PSDrive C shows used and free space. One of the biggest consumers of space on Windows is the component store, which keeps older update components (C:\Windows\WinSxS). Do not delete this folder by hand; clean it up with DISM:

PowerShell
Get-PSDrive C
Dism.exe /Online /Cleanup-Image /AnalyzeComponentStore
Dism.exe /Online /Cleanup-Image /StartComponentCleanup
cleanmgr /sageset:1
cleanmgr /sagerun:1

/AnalyzeComponentStore reports how much space can be reclaimed. /ResetBase frees more space but makes installed updates impossible to uninstall, so use it only deliberately. In Disk Cleanup, /sageset:1 lets you choose items and /sagerun:1 applies the selection. If space is still short, after a disk upgrade the C: drive is extended automatically while the server is running and VMware Tools is working; the disk cannot be expanded while a snapshot exists, and a virtual disk cannot be shrunk (see the resource upgrade guide).

Clock and time zone

A wrong clock leads to TLS certificate errors, scheduled tasks running at the wrong time and logs that cannot be compared:

PowerShell
tzutil /g
Set-TimeZone -Id 'Turkey Standard Time'
w32tm /query /status
w32tm /query /source
# If the source is "Local CMOS Clock":
w32tm /config '/manualpeerlist:time.windows.com,0x8' /syncfromflags:manual /update
Restart-Service w32time
w32tm /resync

If w32tm /query /source shows Local CMOS Clock, the server is not synchronizing with a time source; the last three lines set one. Because outbound connections are allowed by default, no extra rule is needed for UDP 123. Set-TimeZone is not available in the default PowerShell version on Windows Server 2012 R2; set the time zone there with tzutil /s "Turkey Standard Time".

Event logs

The System and Application logs in Event Viewer (eventvwr.msc) hold the first trace of most problems. List the critical and error events of the last seven days and the unexpected shutdowns like this:

PowerShell
# Critical (1) and error (2) events from the last 7 days
Get-WinEvent -FilterHashtable @{LogName='System','Application'; Level=1,2; StartTime=(Get-Date).AddDays(-7)} -MaxEvents 30 -ErrorAction SilentlyContinue |
  Format-Table TimeCreated, LogName, Id, ProviderName, LevelDisplayName -AutoSize
# Unexpected shutdowns and who initiated a restart
Get-WinEvent -FilterHashtable @{LogName='System'; Id=41,1074,6008} -MaxEvents 10 -ErrorAction SilentlyContinue |
  Format-Table TimeCreated, Id, ProviderName, Message -Wrap

Events 41 (Kernel-Power) and 6008 show that the server restarted without a clean shutdown, and 1074 shows which user or process initiated a restart. Update failures appear in the System log with the WindowsUpdateClient source and ID 20.

VMware Tools and backups

Most panel tools (safe shutdown, password reset, hostname, network and additional IP settings, disk expansion) work through VMware Tools. The VMTools service should be Running and Automatic; do not stop, disable or uninstall it. The in-server log of panel actions is in C:\Windows\Temp\wisecp-task.log:

PowerShell
Get-Service VMTools | Select-Object Name, DisplayName, Status, StartType
Get-Content C:\Windows\Temp\wisecp-task.log -Tail 30

The last step of the routine is the backup. Unless your package explicitly includes one, backing up the server is your responsibility (see the Backup and Data Retention Policy). You can use the Windows Server Backup feature (Install-WindowsFeature Windows-Server-Backup) or the Windows version of restic; store the backup outside the server. For details, see the server backup strategy guide, and for your websites, the website backup plan.

Common problems

SymptomLikely causeFix
An update hangs at the same percentage or keeps failingCorrupted system files or update cacheApply the repair steps below; note the error code from the WindowsUpdateClient event
The update screen takes very long during a restartA large cumulative update is being configuredWatch it in the VNC Console and wait; do not use Force Stop or Hard Reset
The C: drive filled up after updatesThe component store and download cache have grown/StartComponentCleanup and Disk Cleanup; a disk upgrade if needed
TiWorker.exe uses high CPU for a long timeWindows Modules Installer is preparing updatesLet it finish; if it goes on for days, apply the repair steps
MsMpEng.exe uses high CPU or diskA Defender scan, or large files that change very oftenMove the scheduled scan to a quiet hour with Set-MpPreference; add a narrowly scoped exclusion if needed
The VMTools service is stoppedThe service was stopped manually or cannot startStart-Service VMTools; if it does not start, open a support ticket

If updates keep failing, repair the system files first, and if the problem persists, reset the update cache. We recommend taking a snapshot before these steps:

PowerShell
# 1) Repair system files
Dism.exe /Online /Cleanup-Image /RestoreHealth
sfc /scannow
# 2) If the problem persists, reset the update cache
Stop-Service wuauserv, bits -Force
Rename-Item C:\Windows\SoftwareDistribution SoftwareDistribution.old
Start-Service bits, wuauserv

Frequently asked questions

Does this guide also apply to the Windows 10 Pro or Windows 11 Pro templates?

The Windows 10 Pro and Windows 11 Pro templates are meant for desktop use. Most of the Defender, firewall, performance and event log commands work there too; sconfig, however, exists only on Windows Server. Check on Microsoft's product lifecycle page that your version receives security updates; support for Windows Server 2012 R2 and Windows 10 has ended. If you are unsure which system to choose, see Linux or Windows server.

Should I install updates automatically or manually?

On a production server, a good balance is to download updates automatically and install and restart during your own maintenance window: security holes do not stay open for long, and the server does not restart at an unexpected moment. Do not let updates pile up for more than a month.

Should I install a separate antivirus alongside Defender?

For most servers, Defender is a sound starting point. If you install another antivirus, do not run two real-time scanners together: on Windows Server, Defender does not always disable itself when another product is installed, so put it into passive mode or remove it as the product's guidance describes.

Was this helpful?

Thanks for your feedback!

Still Need Help?

Our support team is here around the clock for anything you can't find above.