This page lists some sample scripts I wrote in PowerShell.
Unless stated otherwise, these scripts run in Windows as well as in PowerShell on Linux (tested in Windows 7 SP1 and Ubuntu Linux 16.04)
Many of these scripts return their results or status as errorlevel.
Help is available for some of the scripts (the most recent ones) with the -h
switch.
PowerShell itself provides "help" for a script with the -?
switch, but this help will only list the allowed parameters without explaining them.
In that case you can check the source code for help on command line arguments (parameters and switches) and to check the meaning of return codes/errorlevels.
Click a download icon to download the script. | |
Click a check mark icon to view the ZIP file's MD5 and SHA1 checksums. | |
Click the script name to view its source code. |
PowerShell Examples | ||||||
---|---|---|---|---|---|---|
Name | Version | Description | Last modified | Remarks | ||
2ASCII | 1.00 | Convert any text file to ASCII | 2006-09-26 | |||
2Unicode | 1.00 | Convert any text file to Unicode | 2006-09-26 | |||
2UTF8 | 1.00 | Convert any text file to UTF-8 | 2006-09-26 | |||
AirReg | 1.01 | Demo script using Airport-data.com's API to lookup airplane data by its registration number | 2016-11-11 | |||
AirRegCCmd | 1.00 | Search downloaded Canadian aircraft database (C-***) for specific aircraft(s) | 2020-05-10 | This program requires a downloaded Canadian aircraft registration file, located in the subdirectory "C" | ||
AirRegEICmd | 1.00 | Search downloaded Irish aircraft database (EI-***) for specific aircraft(s) | 2020-05-10 | This program requires a downloaded Irish aircraft registration file in Excel format, located in the subdirectory "EI", and Excel | ||
AirRegFCmd | 1.00 | Search downloaded French aircraft database (F-***) for specific aircraft(s) | 2020-05-16 | This program requires a downloaded French aircraft registration file, located in the subdirectory "F" | ||
AirRegGUI | 2.16 | Demo GUI script using Airport-data.com's API to lookup airplane data by its registration number | 2023-05-24 | |||
AirRegHBCmd | 1.00 | Search downloaded Swiss aircraft database (HB-***) for specific aircraft(s) | 2021-08-17 | This program requires a downloaded Swiss aircraft registration file in CSV format, located in the subdirectory "HB" | ||
AirRegLYCmd | 1.00 | Search downloaded Lithuanian aircraft database (LY-***) for specific aircraft(s) | 2021-01-05 | This program requires a downloaded copy of the Lithuanian aircraft registry database, located in the subdirectory "LY", and GhostScript to convert the downloaded PDF to plain text | ||
AirRegNCmd | 1.00 | Search downloaded FAA aircraft database (N***) for specific aircraft(s) | 2020-05-09 | This program requires a downloaded copy of the FAA Aircraft Registry's Releasable Aircraft Database, located in the subdirectory "N" | ||
AirRegOECmd | 1.01 | Search downloaded Austrian aircraft database (OE-***) for specific aircraft(s) | 2021-01-05 | This program requires a downloaded copy of the Austrian aircraft registry database, located in the subdirectory "OE", and GhostScript to convert the downloaded PDF to plain text | ||
AirRegOOCmd | 1.00 | Search Pascal Brugier's online Belgian aircraft registration database (O-*** or OO-***) for specific aircraft(s) | 2021-01-07 | This program uses Pascal Brugier's online Belgian aircraft registration database | ||
AirRegOpenSkyCmd | 1.02 | Search downloaded OpenSky Network aircraft database for specific aircraft(s) | 2023-05-27 | This program requires a downloaded OpenSky Network aircraft registration file, located in the subdirectory "OpenSky" | ||
AirRegPHCmd | 1.03 | Search downloaded Dutch aircraft database (PH-***) for specific aircraft(s) | 2021-01-06 | This program requires a downloaded Dutch aircraft registration file in Excel format, located in the subdirectory "PH", and Excel | ||
AirRegPPCmd | 1.01 | Search Brasilian aircraft online database (PP*** .. PU***) for specific aircraft(s) | 2020-07-24 | This program uses the Consultas ao Registro Aeronáutico Brasileiro online aircraft registry | ||
AirRegPRCmd | 1.01 | Search Brasilian aircraft online database (PR***) for specific aircraft(s) | 2020-07-24 | This program requires AirRegPPCmd.ps1 | ||
AirRegPSCmd | 1.01 | Search Brasilian aircraft online database (PS***) for specific aircraft(s) | 2020-07-24 | This program requires AirRegPPCmd.ps1 | ||
AirRegPTCmd | 1.01 | Search Brasilian aircraft online database (PT***) for specific aircraft(s) | 2020-07-24 | This program requires AirRegPPCmd.ps1 | ||
AirRegPUCmd | 1.01 | Search Brasilian aircraft online database (PU***) for specific aircraft(s) | 2020-07-24 | This program requires AirRegPPCmd.ps1 | ||
AirRegTFCmd | 1.00 | Search online Icelandic aircraft database (TF-***) for specific aircraft(s) | 2020-05-09 | This program uses the Icelandic Transport Authority online aircraft registry | ||
AirRegVHCmd | 1.00 | Search downloaded Australian aircraft database (VH-***) for specific aircraft(s) | 2020-05-19 | This program requires a downloaded copy of the Australian aircraft registry database, located in the subdirectory "VH" | ||
AirRegZKCmd | 1.00 | Search downloaded New Zealand aircraft database (ZK-***) for specific aircraft(s) | 2020-05-19 | This program requires a downloaded copy of the New Zealand aircraft registry database, located in the subdirectory "ZK" | ||
APIPA | 1.00 | Get or set the IP AutoConfiguration status (a.k.a. APIPA) for all network adapters | 2016-11-14 | Make sure you understand what this script will do before using it! This is a Windows-only script. |
||
Asc | 1.00 | Get the numeric ASCII value for the specified character | 2016-10-25 | |||
BIOS | 1.01 | Display BIOS properties | 2020-08-27 | Generated by WMIGen. Updated to PowerShell 7 by Thierry Montané. |
||
BootState | 1.00 | Show Windows' boot state, e.g. Normal, Safe mode, Windows PE | 2017-10-19 | Windows only | ||
CapsLockIcon | 1.01 | CapsLock key indicator in the System Tray | 2020-04-14 | Windows only | ||
CDEject | 1.01 | Eject all CDROMs | 2016-11-12 | Requires Windows Media Player in Windows, native "eject" command is used in Linux. Windows code based on VBScript code posted by Christoph Fricke in the microsoft.public.de.german.scripting.wsh newsgroup |
||
ChineseYear | 1.00 | Get the Chinese name for the year, e.g. 2016 is the year of the Monkey | 2016-11-02 | |||
Chr | 1.01 | Get the ASCII character for the specified numeric value | 2016-10-30 | |||
DHCPBackup | 1.00 | Backup daily DHCP logs | 2007-08-30 | "Third party" Windows-only script by Jason Carter, Marshall University Computing Services. | ||
Disks | 1.00 | List physical harddisks and their manufacturer, model, size, bus type, physical location and more | 2020-04-10 | Windows only. | ||
Drives | 1.01 | List available and/or used drive letters | 2016-11-04 | Useless on Linux, which doesn't work with drive letters. | ||
GetDotNETVersion | 1.00 | List the .NET Framework versions installed in Windows | 2016-11-13 | Windows-only. | ||
GetHDDStatus | 2.03 | Get the S.M.A.R.T. status for all local harddisks | 2019-03-20 | Uses WMI in Windows, or lshw, smartctl, df and notify-send in Linux. | ||
GetHDDStatusGUI | 1.04 | Get the S.M.A.R.T. status for all local harddisks | 2020-06-09 | Windows-only GUI version of GetHDDStatus.ps1 | ||
GetRes | 2.00 | Show screen resolution | 2016-11-01 | Uses WMI in Windows, or XRANDR in Linux. | ||
GetTitle | 1.00 | Read the console window title | 2011-05-10 | |||
IsCDWriter | 1.00 | Check whether the specified drive is a CD/DVD writer or not | 2017-08-15 | Windows-only | ||
LeapYear | 1.00 | Check if the specified year is a leap year | 2006-10-25 | |||
LoginDialog | 1.01 | Present a login dialog and return username and password | 2016-11-04 | In Windows a GUI style dialog box is used, in Linux the prompt for (user name and) password is in the console. | ||
LoginDialogWinForm | 1.00 | Demo login dialog script using Windows Forms | 2019-03-19 | Windows only. Built with PoshGUI Editor. For demonstration purposes only, LoginDialog.ps1 provides a much better login dialog. |
||
Memory | 2.01 | Display total and free amounts of physical memory | 2016-11-01 | Uses WMI in Windows, or /proc/meminfo in Linux. | ||
MonitorPing | 1.00 | Ping a device at a fixed interval and show the connection status in the Notification Area (a.k.a. System Tray) | 2020-05-14 | |||
NumLockIcon | 1.00 | NumLock key indicator in the System Tray | 2020-04-25 | Windows only | ||
Ping | 2.00 | Ping multiple computers and return the combined results | 2016-11-11 | |||
PowerShellComputerClass | 1.00 | Class that holds "all" hardware information for the local computer | 2021-12-20 | See the PowerShell Computer Class product page. | ||
PrintWord | 1.00 | Print a Word document | 2020-04-21 | Requires Word. | ||
PSVer | 2.00 | Display PowerShell version | 2016-10-24 | |||
ReadExcel | 1.00 | Read an Excel file and show all cells and content for every sheet | 2020-04-16 | Requires Excel. | ||
Reboot | 1.00 | Reboot the computer immediately | 2016-11-02 | Uses shutdown -r in Linux, or WMI in Windows. |
||
Restart_Ethernet | 1.01 | Restart Ethernet network adapter | 2020-08-30 | Requires elevated privileges to restart the network adapter. | ||
Restart_PhysicalNetworkAdapters | 1.01 | Restart all physical network adapters | 2020-09-02 | Requires elevated privileges to restart the network adapter. | ||
Show-Console | 1.00 | Cmdlet to manipulate the console window state, i.e. hide the console, minimize it, activate it, etc. | 2021-12-17 | Based on code by Hansson0728 on StackOverflow.com. | ||
ShowCpuH | 1.00 | Display CPU details in an HTML page | 2006-09-01 | Generated by WMIGen. Since the script uses WMI it is Windows-only. |
||
ShowPRN | 1.10 | Display all printers | 2006-09-10 | Generated by WMIGen. Since the script uses WMI it is Windows-only. |
||
ShowPrnH | 1.01 | Display all printers in an HTML page | 2006-08-31 | Generated by WMIGen. Since the script uses WMI it is Windows-only. |
||
ShutDown | 1.00 | Shutdown and power-off the computer | 2016-11-02 | Uses shutdown -P in Linux, or WMI in Windows. |
||
Today | 1.00 | Display today's yesterday's and tomorrow's date in 2 formats | 2006-07-05 | This script combines the functions of my SortDate, Yesterday and Tomorrow scripts as available in other scripting languages. | ||
TxtComp | 1.01 | Compare two text files and display the differences | 2016-11-01 | |||
Week | 1.00 | Display current week number | 2006-06-26 | |||
WeerLive | 1.00 | Demo script using WeerLive.nl's API to get live Dutch weather data from the Dutch KNMI weather agancy. | 2020-08-21 | The author of this script is in no way associated with WeerLive.nl. A basic understanding of the Dutch language is required to requist your personal WeerLive API key. |
||
Which | 1.00 | Locate the specified program file | 2006-07-27 | See my UNIX ports page. | ||
WMIGen | 10.0.15.6 | Generate Batch, C, C++, C#, Delphi, F#, Java, JScript, KiXtart, Lua, Object Pascal, Object Rexx, Perl, PHP, PowerShell, Python, Ruby, Tcl, VB .NET and VBScript code for WMI queries | 2023-02-25 | WMIGen is a compiled Windows GUI program which generates WMI code to be used in PowerShell or other languages. |
page last modified: 2023-05-27; loaded in 0.0306 seconds