mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-02-23 21:20:51 +01:00
61 lines
2.9 KiB
Markdown
61 lines
2.9 KiB
Markdown
Collection of Useful PowerShell Scripts (CUPS)
|
|
==============================================
|
|
|
|
Useful cross-platform PowerShell scripts, to be used on the command-line (CLI) or by automation software like Jenkins.
|
|
|
|
Scripts Explained
|
|
-----------------
|
|
* **MD5.ps1** - prints the MD5 checksum of the given file
|
|
* **moon.ps1** - prints the current moon phase
|
|
* **password.ps1** - generates and prints a single new password
|
|
* **passwords.ps1** - generates and prints a list of new passwords
|
|
* **poweroff.ps1** - halts the local computer, administrator rights might be needed
|
|
* **news.ps1** - print the latest news
|
|
* **reboot.ps1** - reboots the local computer, administrator rights might be needed
|
|
* **SHA1.ps1** - prints the SHA1 checksum of the given file
|
|
* **SHA256.ps1** - prints the SHA256 checksum of the given file
|
|
* **speak.ps1** - speaks the given text
|
|
* **test.ps1** - simple test script
|
|
* **train_dns_cache.ps1** - trains the DNS cache with frequently used domain names
|
|
* **translate.ps1** - translates the given text
|
|
* **txt2wav.ps1** - converts text into a audio .WAV file
|
|
* **weather.ps1** - prints the current weather forecast
|
|
* **wakeup.ps1** - sends a magic packet to the given computer, waking him up
|
|
* **zipdir.ps1** - creates a zip archive of the given folder
|
|
|
|
Frequently Asked Questions (FAQ)
|
|
--------------------------------
|
|
**What is PowerShell?**
|
|
|
|
PowerShell is a task automation and configuration management framework from Microsoft, consisting of a command-line shell and associated scripting language.
|
|
* PowerShell is cross-platform: available for Windows, Linux and Mac OS
|
|
* PowerShell is powerful: fully control your computer
|
|
* PowerShell is open-source: see the Github repository at https://github.com/PowerShell/PowerShell
|
|
* PowerShell is easy to learn: see the tutorial at https://www.guru99.com/powershell-tutorial.html
|
|
* PowerShell is fully documented: see the official docs at https://docs.microsoft.com/en-us/powershell/
|
|
|
|
**How to configure PowerShell as default shell on Linux?**
|
|
|
|
Make sure PowerShell is installed, then use the `chsh` commmand as follows:
|
|
* `chsh -s /bin/powershell <username>`
|
|
|
|
**How to add the subfolder Scripts/ to the search path for command-line usage?**
|
|
|
|
* **Windows:** open the environment variables dialogue and add the full path to Scripts/ to the system environment variable "Path"
|
|
* **Bash or sh:** edit .profile in your home directory and add the line: PATH="$PATH:/path/to/PowerShell/Scripts"
|
|
|
|
Script Standards
|
|
----------------
|
|
Each script provides:
|
|
1. a comment header containing the syntax, description, author, source, and license
|
|
2. prefers command-line options but may ask the user in case no option is given
|
|
3. exits 0 for success, otherwise the error code (mostly 1)
|
|
|
|
Feedback
|
|
--------
|
|
Send your email feedback to: markus [at] fleschutz [dot] de
|
|
|
|
License & Copyright
|
|
-------------------
|
|
This open source release is licensed under the CC0 license. All trademarks are the property of their respective owners.
|