Programming + Scripting Powershell Updated August 16 2024
To run a powershell script automatically using Task Scheduler, set the program to [ powershell.exe ] and the Add Arguments field to [ -File "PathToScript.ps1" ].
Link to more info on setting it.


If you have errors running powershell scripts, you need to run this command in an Admin Powershell window:
Set-ExecutionPolicy RemoteSigne

To run a powershell script and hide the powershell window, use this:
PowerShell.exe -windowstyle hidden -File "C:\Path\To\Script.ps1"

Below are some powershell scripts I created which may be useful for you.


AD-CheckComputers - Query Active Directory for a list of all computers, check each computer to see it's OS, if it is online, IP, last login time, and current users.
Download AD-CheckComputers.ps1


FastPing - Ping multiple devices quickly - Use this to watch devices ping times, calculate ping losses, see when devices go offline. Double click a line to see more details.
Download FastPing.ps1


FlashTest - Test flash storage - This creates random data on a drive which can be validated by hashing. This will detect any corruption that is located within the files. Fill a drive up and if any file does not read exactly the same, you can tell which files have corruption.
Download FlashTest.ps1


Scan Network / Check for open TCP Ports - Use this tool I wrote to scan all devices on the LAN, find names/MAC's, and open ports.
Download Test-TCP_Probe.ps1


ScreenCapture - Take periodic screenshots of a computer screen. I use this to monitor my sons computer (he knows I do this), I save the files to a network share and I periodically review them. You can specify the folder to save them in, the file format, and the interval between captures (I use 5 minutes). It detects if the computer is idle (no mouse movements) and doesn't continue until the mouse moves.
Download ScreenCapture.ps1

Active Directory - Get Users last login time
Add full size logo to images
CPU Stress Test in Powershell
Create daily exports of Hyper-V Virtual Machines
Create files with random data in them of a specific size
Debug another powershell process. I recommend using this in PSISE.
Delete duplicate files found with a suffix like (Copy)
Detect Keystrokes in console PowerShell scripts
Determine if Powershell is running in GUI or not
Exchange Commands
Hotkeys Test
List all installed programs on a computer
Misc Snippets
NSA shares tips on securing Windows devices with PowerShell
Performance and Tips
Powershell Script Assistance - GUI Editor
Quick script to show all Hosts file from all online machines in Active Directory
Regex Powershell Examples and Testing
Set up SSH server for Powershell remote access
Show all files created/modified in the last 5 days
Simple script to select the right backup drive where the drive letter may change
Swap default printers using Powershell Script
Swap default printers using Powershell Script
Sysmon
Tray Icon Sample
Uninstall Software matching name
VSS - Shadows




©2024 - Some portions of this website are Copyrighted.
Your IP: 3.143.203.190     Referring URL:
Browser: Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Terms and Conditions, Privacy Policy, and Security Policy