nircmd_screenshot.ps1 - limehawk/rmm-scripts GitHub Wiki
nircmd_screenshot.ps1
Screenshot Capture using NirCmd.
Overview
Captures a screenshot of the current display using NirSoft's NirCmd utility. Downloads NirCmd if not already present, then saves a timestamped screenshot.
Purpose
This script automates the process of capturing screenshots on Windows systems using the NirCmd utility. It handles the download and setup of NirCmd automatically, making it ideal for remote screenshot capture via RMM platforms.
Prerequisites
- Windows 10/11 or Windows Server
- Internet access for NirCmd download
- Write permissions to destination folder
Configuration
Required Inputs
$destinationFolder: Folder to store NirCmd and screenshots (default:C:\limehawk\nirsoft)$screenshotFolder: Subfolder for screenshot files (default:C:\limehawk\nirsoft\screenshots)
Behavior
- Creates destination directories if they don't exist
- Downloads NirCmd (x64 or x86 based on OS architecture)
- Extracts NirCmd from zip archive
- Captures screenshot with timestamped filename
- Cleans up temporary zip file
Security Notes
- Downloads from official NirSoft website
- No secrets in logs
- Screenshots saved locally only
Exit Codes
0= Success1= Failure
Example Output
[ INPUT VALIDATION ]
--------------------------------------------------------------
Destination : C:\limehawk\nirsoft
Screenshot Dir : C:\limehawk\nirsoft\screenshots
[ DOWNLOADING NIRCMD ]
--------------------------------------------------------------
Architecture : x64
Download URL : https://www.nirsoft.net/utils/nircmd-x64.zip
Download complete
[ CAPTURING SCREENSHOT ]
--------------------------------------------------------------
Filename : screenshot_20241201-143022.png
Saved to : C:\limehawk\nirsoft\screenshots\screenshot_20241201-143022.png
[ 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