nircmd_set_resolution.ps1 - limehawk/rmm-scripts GitHub Wiki
nircmd_set_resolution.ps1
Set Display Resolution using NirCmd.
Overview
Changes the display resolution using NirSoft's NirCmd utility. Downloads NirCmd if not already present, then sets the specified resolution.
Purpose
This script automates display resolution changes on Windows systems using the NirCmd utility. It's useful for standardizing display settings across multiple machines or troubleshooting display configuration issues remotely.
Prerequisites
- Windows 10/11 or Windows Server
- Internet access for NirCmd download
- Display must support the requested resolution
Configuration
Required Inputs
$resolutionWidth: Desired screen width in pixels (e.g., 1920)$resolutionHeight: Desired screen height in pixels (e.g., 1080)$colorDepth: Color depth in bits (e.g., 32)$destinationFolder: Folder to store NirCmd utility (default:C:\limehawk\nircmd)
Behavior
- Creates destination directory if it doesn't exist
- Downloads NirCmd (x86 version for compatibility)
- Extracts NirCmd from zip archive
- Sets display resolution to specified values
- Cleans up temporary zip file
Security Notes
- Downloads from official NirSoft website
- No secrets in logs
Exit Codes
0= Success1= Failure
Example Output
[ INPUT VALIDATION ]
--------------------------------------------------------------
Resolution : 1920 x 1080
Color Depth : 32-bit
Destination : C:\limehawk\nircmd
[ DOWNLOADING NIRCMD ]
--------------------------------------------------------------
Download URL : https://www.nirsoft.net/utils/nircmd.zip
Download complete
[ CHANGING RESOLUTION ]
--------------------------------------------------------------
Executing : nircmd.exe setdisplay 1920 1080 32
Resolution changed successfully
[ FINAL STATUS ]
--------------------------------------------------------------
Result : SUCCESS
[ SCRIPT COMPLETED ]
--------------------------------------------------------------
Version History
- v1.0.0 (2024-12-01) - Initial release - migrated from SuperOps
Links
- View Script Source
- Scripts - Back to script index