A full disk can significantly slow down device operations, leading to a diminished user experience and increased likelihood of end-users reaching out to service desks for support. This situation not only affects productivity but also places additional strain on IT resources.
Moreover, a critical repercussion of insufficient disk space is its impact on the device's overall security. Without adequate space to download and install the latest operating system patches and software updates, a device becomes vulnerable to security threats. Neglecting to remediate the issue in time can leave the device exposed to exploits and malware, putting not only the device but also the entire network at risk.
Additionally, full disk space can lead to other adverse effects such as the inability to save new files, create backups, or perform essential tasks that require temporary storage space. It can also cause system crashes and data loss, further exacerbating the challenges faced by users and IT administrators. Applications may fail to launch or operate correctly, and the overall stability of the operating system could be compromised, leading to unexpected shutdowns or system errors.
Clean unwanted files
Windows creates temporary files during operation, such as system restore points, update files, and temporary internet files. Additionally, users may soft delete files to Recycle Bin and forget to clear it. Over time, these can accumulate and consume significant disk space if not managed.
Command-line
To clear the temporary files, we will need to run two sets of commands. The first set will have to be executed as an administrator and the second as the primary user of the device.
Copy the commands below into Notepad and save the file as ClearSystemTemp.bat batch file.
@ECHO OFF
del /s /f /q %windir%\Prefetch\*.*
FOR /D %%p IN ("%windir%\Prefetch\*.*") DO rmdir "%%p" /s /q
del /s /f /q %windir%\Temp\*.*
FOR /D %%p IN ("%windir%\Temp\*.*") DO rmdir "%%p" /s /q
del /s /f /q %systemdrive%\$Recycle.bin\*.*
FOR /D %%p IN ("%systemdrive%\$Recycle.bin\*.*") DO rmdir "%%p" /s /q
net stop wuauserv
rd /s /q %windir%\SoftwareDistribution
rd /s /q %windir%\SoftwareDistribution.old
net start wuauservNext copy the commands below into Notepad and save the file as ClearUserTemp.bat batch file.
Run the file using the logged-on user’s credentials by double clicking it, otherwise the %USERPROFILE% variable will point to the user whose credentials are used to run the batch file.
@ECHO OFF
del /s /f /q %USERPROFILE%\appdata\local\temp\*.*
del /s /f /q %USERPROFILE%\Recent\*.*PowerShell
If you wish to deploy the clean-up centrally, using a modern endpoint management tool, it’s advisable to use PowerShell.
Note: Be sure to set the PowerShell script to run with the logged-on user’s credentials, otherwise the user variables will point to the system account.
# Set error action preference to silently continue on errors
$ErrorActionPreference = 'SilentlyContinue'
# Delete files from Windows Prefetch directory
Remove-Item -Path "$env:SystemRoot\Prefetch\*" -Force -Recurse
# Delete files from Windows Temp directory
Remove-Item -Path "$env:SystemRoot\Temp\*" -Force -Recurse
# Empty the Recycle Bin
Clear-RecycleBin -Force
# Delete files from the user's local temp directory
Remove-Item -Path "$env:USERPROFILE\AppData\Local\Temp\*" -Force -Recurse
# Delete files from the user's Recent items directory
Remove-Item -Path "$env:USERPROFILE\Recent\*" -Force -Recurse
# Stop the Windows Update service before deleting SoftwareDistribution folders
Stop-Service -Name wuauserv -Force
# Remove SoftwareDistribution directory
Remove-Item -Path "$env:SystemRoot\SoftwareDistribution" -Force -Recurse
# Remove SoftwareDistribution.old folder if it exists
Remove-Item -Path "$env:SystemRoot\SoftwareDistribution.old" -Force -Recurse
# Start the Windows Update service again
Start-Service -Name wuauservSetup automatic user profile deletion for shared devices
If your shared Windows devices are having disk space issues, the most likely explanation is the accumulation of user profiles on the device. To prevent this from happening, you can set automatic user profile deletion based on the last time it was accessed.
If you are using Group Policies to manage your settings, you can set the following group policy: https://admx.help/?Category=Windows_10_2016&Policy=Microsoft.Policies.UserProfiles::CleanupProfiles.
If you are using Microsoft Intune, you may use the Delete user profiles older than a specified number of days on system restart setting in the Settings Catalog to achieve the same result.
For most third-party solutions you may have to resort to using PowerShell to achieve the same result. Below is an example command for profile deletion.
IMPORTANT NOTE: Be sure to test and pilot everything before deploying to production.
Get-WMIObject -class Win32_UserProfile | Where {(!$_.Special) -and ($_.ConvertToDateTime($_.LastUseTime) -lt (Get-Date).AddDays(-30))} | Remove-WmiObjectImplement OneDrive for Business
If you have the required license for OneDrive for Business and have not implemented it yet, it’s strongly recommended to do so. The Known Folder Move, or KFM feature automatically relocates the Documents, Desktop and Pictures folders to cloud.
For more information and instructions on how to implement OneDrive for Business KFM, visit Microsoft Learn - Redirect and move Windows known folders to OneDrive.
To further save disk space, consider using the OneDrive Files On-Demand: Microsoft Support - Save disk space with OneDrive Files On-Demand for Windows.
Avoid personal user files
Another culprit for disk space filling can be personal user files, such as videos and images. Consider training your personnel to not store such files on the company devices.
Applixure Analytics warnings and alerts
This issue is associated with the following Analytics alerts and warnings:
0 Comments