Skip to content

nircmd_set_resolution.ps1

Corey Watson edited this page Dec 1, 2025 · 1 revision

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

  1. Creates destination directory if it doesn't exist
  2. Downloads NirCmd (x86 version for compatibility)
  3. Extracts NirCmd from zip archive
  4. Sets display resolution to specified values
  5. Cleans up temporary zip file

Security Notes

  • Downloads from official NirSoft website
  • No secrets in logs

Exit Codes

  • 0 = Success
  • 1 = 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

Clone this wiki locally