143 Commits
v0.5 ... v0.6

Author SHA1 Message Date
d0fe73ce11 Update README.md 2022-11-02 15:14:16 +01:00
5600a90d36 Update README.md 2022-11-02 15:04:13 +01:00
3d4147eb81 Update README.md 2022-11-02 14:55:31 +01:00
0a4fa61c75 Update README.md 2022-11-02 14:50:21 +01:00
150cfeb3d1 Update README.md 2022-11-01 22:12:46 +01:00
9adb09385a Update pull-repos.ps1 2022-11-01 17:03:51 +01:00
8bea6e12d1 Update configure-git.ps1 2022-11-01 16:55:36 +01:00
5706f6a91a Update configure-git.ps1 2022-11-01 16:48:06 +01:00
cea14316e6 Update check-smart-devices.ps1 2022-11-01 16:43:00 +01:00
cb53701a0a Merge pull request #12 from Luc-Wshr/master
Fixed "EnryptFile" typo on line 122
2022-10-31 12:31:28 +01:00
6ad42b3355 Update configure-git.ps1 2022-10-31 11:50:33 +01:00
4ad99b0a91 Fixed "EnryptFile" typo on line 122 2022-10-31 11:41:59 +01:00
824a70d9c9 Update pull-repo.ps1 2022-10-31 11:14:53 +01:00
844996442b Updaate check-operating-system.ps1 2022-10-31 08:49:11 +01:00
9f396620df Update check-operating-system.ps1 2022-10-31 08:39:14 +01:00
c5e2f92a4c Merge branch 'master' of github.com:fleschutz/PowerShell 2022-10-29 18:38:20 +02:00
b5d19fdde2 Update start-ipfs-server.ps1 and publish-to-ipfs.ps1 2022-10-29 18:37:41 +02:00
6e972bb5d3 Update check-smart-devices.ps1 2022-10-29 18:25:55 +02:00
2de3ecc59c Update check-gpu.ps1 2022-10-29 17:46:41 +02:00
a2d2aaa932 Update check-pending-reboot.ps1 2022-10-29 17:34:15 +02:00
63860c3d8d Add check-gpu.ps1 2022-10-28 13:07:39 +02:00
8022c28fc7 Update check-ping.ps1 2022-10-28 12:39:58 +02:00
551ea988e4 Update check-smart-devices.ps1 2022-10-28 09:45:24 +02:00
bbd7a6c36c Merge branch 'master' of github.com:fleschutz/PowerShell 2022-10-28 09:25:49 +02:00
1d0754ff57 Update switch-branch.ps1 2022-10-28 09:25:16 +02:00
0b0d2498ca Update FAQ.md 2022-10-28 08:23:44 +02:00
85e05a5a70 Update FAQ.md 2022-10-28 08:19:45 +02:00
d95cbbb4c4 Update FAQ.md 2022-10-28 08:17:28 +02:00
289983d888 Update check-smart-devices.ps1 2022-10-27 16:55:32 +02:00
32df71fd8d Update switch-branch.ps1 2022-10-26 14:56:25 +02:00
d494d50d91 Update clean-repo.ps1 2022-10-26 12:15:16 +02:00
0d739f8a1a Update check-ram.ps1 2022-10-26 10:34:07 +02:00
d5e97a1d85 Update check-repo.ps1 2022-10-26 10:30:12 +02:00
a880bd71c5 Update check-smart-devices.ps1 2022-10-25 20:34:03 +02:00
c72dfb2c23 Add write-sine-curves.ps1 2022-10-25 20:26:18 +02:00
5a712d7240 Update check-operating-system.ps1 2022-10-25 20:11:09 +02:00
4ef2127623 Update check-smart-devices.ps1 2022-10-25 19:45:02 +02:00
a70c24b8c7 Update check-smart-devices.ps1 2022-10-25 19:23:15 +02:00
22f4dcab52 Update check-cpu.ps1 2022-10-25 19:15:01 +02:00
38f5b268a2 Update check-smart-devices.ps1 2022-10-25 19:06:35 +02:00
a835ad6473 Add list-network-routes.ps1 2022-10-25 16:21:16 +02:00
face3aa462 Update list-cli-tools.ps1 2022-10-25 16:13:07 +02:00
1384acd564 Update list-cli-tools.ps1 2022-10-25 16:05:51 +02:00
3aefcfd2a0 Add list-user-accounts.ps1 2022-10-25 15:58:33 +02:00
1a83a3032d Update check-drives.ps1 2022-10-25 15:15:43 +02:00
e192342523 Update check-swap-space.ps1 2022-10-25 15:08:56 +02:00
7b6f2b7cc2 Update check-vpn.ps1 2022-10-25 14:58:55 +02:00
767634fba0 Update clean-repo.ps1 2022-10-25 09:44:19 +02:00
b380bbc862 Add list-suggestions.ps1 2022-10-24 16:05:25 +02:00
7cfcff426e Add list-wifi.ps1 2022-10-24 15:51:54 +02:00
500e987190 Update check-repo.ps1 2022-10-24 13:59:41 +02:00
444331ebc2 Update check-repo.ps1 2022-10-24 13:38:14 +02:00
45f96fa3a2 Update cd-repos.ps1 2022-10-24 12:24:35 +02:00
88f2492f99 Update check-pending-reboot.ps1 2022-10-24 11:43:54 +02:00
3feaace049 Update check-uptime.ps1 2022-10-21 18:05:08 +02:00
45c1b1e235 Update check-smart-devices.ps1 2022-10-21 16:55:41 +02:00
4730d84c84 Update list-news.ps1 2022-10-18 13:20:19 +02:00
a084275235 Update check-smart-devices.ps1 2022-10-17 20:00:56 +02:00
9060f0099a Update check-cpu.ps1 2022-10-17 19:59:35 +02:00
be18af2e28 Update check-time-zone.ps1 2022-10-17 19:58:19 +02:00
7754be7995 Update list-nic.ps1 2022-10-17 19:55:53 +02:00
d261f1efdd Update check-cpu.ps1 2022-10-17 19:24:48 +02:00
f76872ca9e Update list-commit-statistics.ps1 2022-10-17 19:05:49 +02:00
deec73527f Update check-health.ps1, list-news.ps1, and write-typewriter.ps1 2022-10-17 09:49:23 +02:00
59d1220f36 Update check-time-zone.ps1 2022-10-17 09:35:57 +02:00
650e9b5d85 Update check-smart-devices.ps1 2022-10-17 09:15:12 +02:00
3458087efc Update check-health.ps1 and check-time-zone.ps1 2022-10-16 11:32:21 +02:00
dcd833acef Update check-time-zone.ps1 2022-10-16 11:26:08 +02:00
b4111a6784 Update check-dns.ps1 2022-10-16 11:22:26 +02:00
1eccb184d8 Update check-swap-space.ps1 2022-10-16 11:14:41 +02:00
ebd663e34e Update check-drives.ps1 and check-swap-space.ps1 2022-10-16 11:06:11 +02:00
fbdddbabe8 Update check-smart-devices.ps1 2022-10-16 10:39:31 +02:00
4e93ed99bd Update check-ram.ps1 2022-10-16 09:16:43 +02:00
e29b6db89a Update check-time-zone.ps1 and list-timezone.ps1 2022-10-15 10:42:44 +02:00
742c44d8aa Update check-ram.ps1 2022-10-14 17:04:44 +02:00
8f38eb3192 Update check-ram.ps1 2022-10-14 16:52:27 +02:00
ce16c33272 Update check-ram.ps1 2022-10-13 19:51:02 +02:00
83d205e717 Update check-ram.ps1 2022-10-13 19:42:55 +02:00
2f942d173e Update check-ram.ps1 2022-10-12 16:33:08 +02:00
c15f94928b Add check-ram.ps1 2022-10-12 16:22:05 +02:00
3f9ee0d023 Update check-outlook.ps1 2022-10-12 15:12:38 +02:00
e0b603f1b6 Update check-cpu.ps1 2022-10-12 14:58:26 +02:00
bffb7d6a11 Update check-repo.ps1 2022-10-12 13:24:19 +02:00
b6a4db1c1f Update check-swap-space.ps1 2022-10-11 20:38:23 +02:00
fd451e1ead Update check-time-zone.ps1 and check-health.ps1 2022-10-11 20:34:20 +02:00
e4830a86b6 Update check-pending-reboot.ps1 2022-10-11 20:20:42 +02:00
fa9223b24e Update check-pending-reboot.ps1 2022-10-11 20:13:04 +02:00
3ac262573a Update check-vpn.ps1 2022-10-11 20:00:39 +02:00
d23eebc023 Update check-ping.ps1 2022-10-11 19:51:04 +02:00
0bf94c16fb Update check-pending-reboot.ps1 2022-10-11 19:44:34 +02:00
a9604fbd79 Fix wrong '$DevInfo++' - many thanks to OlegBoul 2022-10-11 19:20:23 +02:00
78232dacf7 Update check-ping.ps1 and check-vpn.ps1 2022-10-10 08:37:10 +02:00
3375e6db6e Update check-dns.ps1, check-drives.ps1, and check-smart-devices.ps1 2022-10-09 19:40:51 +02:00
357a6f2fbb Update check-swap-space.ps1 2022-10-09 19:27:14 +02:00
107b807e22 Update check-swap-swap.ps1 2022-10-09 19:21:41 +02:00
945914a326 Update some check-*.ps1 scripts 2022-10-09 19:16:32 +02:00
888e0a5408 Update some check-*.ps1 scripts 2022-10-09 12:34:06 +02:00
b6baa94e3b Update check-pending-reboot.ps1 2022-10-08 17:36:05 +02:00
4dce0d282a Update list-cli-tools.ps1 2022-10-08 17:29:48 +02:00
3c91a3ea42 Update check-pending-reboot.ps1 2022-10-06 22:52:49 +02:00
0853b92f5e Add check-pending-reboot.ps1 2022-10-04 16:09:27 +02:00
f8e73d32a8 Add list-nic.ps1 2022-10-04 15:25:06 +02:00
b12f9c9f45 Add list-cpu.ps1, list-motherboard.ps1, and list-ram.ps1 2022-10-04 15:19:00 +02:00
da9c58db56 Add list-bios.ps1 2022-10-04 14:55:09 +02:00
5ce4f60d45 Update install-updates.ps1 2022-10-03 23:00:59 +02:00
7688491d55 Update check-repo.ps1 2022-10-03 19:02:48 +02:00
46e582913c Add check-repo.ps1 2022-10-03 18:48:12 +02:00
482b5b86ac Update write-typewriter.ps1 2022-10-03 12:23:34 +02:00
ce70b5e32b Update write-marquee.ps1 2022-10-03 11:43:42 +02:00
7489b8501d Add convert-image2ascii.ps1 2022-10-01 22:16:07 +02:00
50f80e57c1 Update list-crypto-rates.ps1 2022-09-29 14:42:49 +02:00
ea92d28485 Update the speak-*.ps1 scripts 2022-09-28 10:03:04 +02:00
4f31313923 Update list-cli-tools.ps1 2022-09-27 14:06:00 +02:00
74e108a1c6 Update list-cli-tools.ps1 2022-09-27 14:02:28 +02:00
198c45a448 Rename to list-apps.ps1 2022-09-25 19:24:57 +02:00
eb51263d84 Add list-os.ps1 2022-09-25 18:04:16 +02:00
3a23ab483f Rename to list-calendar.ps1 2022-09-25 11:13:23 +02:00
8876c5c003 Update list-special-folders.ps1 2022-09-25 10:58:46 +02:00
b1798e378b Add cd-users.ps1 2022-09-25 10:13:38 +02:00
34fbaec4b7 Update list-commit-statistics.ps1 2022-09-19 20:33:05 +02:00
28a33e074c Update fetch-repos.ps1 and pull-repos.ps1 2022-09-19 19:43:17 +02:00
c35c7b2786 Update FAQ.md 2022-09-19 15:29:35 +02:00
1b63bb91b9 Update FAQ.md 2022-09-19 15:27:27 +02:00
08cedf6696 Update README.md 2022-09-19 15:25:14 +02:00
80c8863f99 Update README.md 2022-09-19 15:24:18 +02:00
5cfa13f102 Update list-news.ps1 2022-09-19 14:35:10 +02:00
6bc3e59a0d Add list-special-folders.ps1 2022-09-19 14:15:58 +02:00
3cd545cbbb Update install-updates.ps1 2022-09-17 13:12:39 +02:00
9e9f8a5534 Update check-dns.ps1 2022-09-17 10:22:00 +02:00
bb2d431ce9 Update FAQ.md 2022-09-16 09:21:37 +02:00
a2817bcba1 Update FAQ.md 2022-09-16 09:20:34 +02:00
934e05e27f Update FAQ.md 2022-09-16 09:20:08 +02:00
d1ef3fe8e6 Update FAQ.md 2022-09-16 09:17:19 +02:00
769074fa51 Update FAQ.md 2022-09-16 09:12:31 +02:00
66bccad7e1 Update pull-repo.ps1 2022-09-14 09:21:14 +02:00
daf4684c5c Change to UTF-8 BOM encoding 2022-09-11 11:57:15 +02:00
a75cb369f1 Update show-notification.ps1 2022-09-10 22:45:56 +02:00
a0a9a6230f Update install-basic-apps.ps1 2022-09-10 15:23:15 +02:00
18a1b55580 Update install-basic-apps.ps1 2022-09-10 15:13:10 +02:00
2d130e5f71 Add Mp3tag 2022-09-10 14:45:16 +02:00
47c2254882 Rename to write-time.ps1 2022-09-10 14:16:14 +02:00
f14196edf8 Rename to write-date.ps1 2022-09-10 14:11:46 +02:00
64b95af3e0 Update list-dir-tree.ps1 2022-09-10 13:46:57 +02:00
134 changed files with 1858 additions and 633 deletions

View File

@ -5,13 +5,14 @@ AppName,Category,AppID
"Google Chrome", "desktop browser", Google.Chrome "Google Chrome", "desktop browser", Google.Chrome
"Dopamine", "audio player", Digimezzo.Dopamine.2 "Dopamine", "audio player", Digimezzo.Dopamine.2
"Dropbox", "file sync", Dropbox.Dropbox "Dropbox", "file sync", Dropbox.Dropbox
"Git", "code management", Git.Git "Git for Windows", "code management", Git.Git
"IrfanView", "image viewer", 9PJZ3BTL5PV6 "IrfanView", "image viewer", 9PJZ3BTL5PV6
"inSSIDer", "Wifi tool", MetaGeek.inSSIDer "inSSIDer", "Wifi tool", MetaGeek.inSSIDer
"LibreOffice", "office suite", TheDocumentFoundation.LibreOffice "LibreOffice", "office suite", TheDocumentFoundation.LibreOffice
"Microsoft Teams", "messenger", XP8BT8DW290MPQ "Microsoft Teams", "messenger", XP8BT8DW290MPQ
"Mozilla Firefox", "desktop browser", 9NZVDKPMR9RD "Mozilla Firefox", "desktop browser", 9NZVDKPMR9RD
"Mozilla Thunderbird", "email client", Mozilla.Thunderbird "Mozilla Thunderbird", "email client", Mozilla.Thunderbird
"Mp3tag", "mp3 tag editor", 9NN77TCQ1NC8
"Netflix", "video player", 9WZDNCRFJ3TJ "Netflix", "video player", 9WZDNCRFJ3TJ
"Notepad++", "text editor", Notepad++.Notepad++ "Notepad++", "text editor", Notepad++.Notepad++
"One Calendar", "desktop calendar", 9WZDNCRDR0SF "One Calendar", "desktop calendar", 9WZDNCRDR0SF

1 AppName Category AppID
5 Google Chrome desktop browser Google.Chrome
6 Dopamine audio player Digimezzo.Dopamine.2
7 Dropbox file sync Dropbox.Dropbox
8 Git Git for Windows code management Git.Git
9 IrfanView image viewer 9PJZ3BTL5PV6
10 inSSIDer Wifi tool MetaGeek.inSSIDer
11 LibreOffice office suite TheDocumentFoundation.LibreOffice
12 Microsoft Teams messenger XP8BT8DW290MPQ
13 Mozilla Firefox desktop browser 9NZVDKPMR9RD
14 Mozilla Thunderbird email client Mozilla.Thunderbird
15 Mp3tag mp3 tag editor 9NN77TCQ1NC8
16 Netflix video player 9WZDNCRFJ3TJ
17 Notepad++ text editor Notepad++.Notepad++
18 One Calendar desktop calendar 9WZDNCRDR0SF

View File

@ -12,16 +12,16 @@ Why use PowerShell?
✔️ it's **cross-platform** - available for Linux, Mac OS and Windows ✔️ it's **cross-platform** - available for Linux, Mac OS and Windows
✔️ it's **open-source and free** - see the Github repository at https://github.com/PowerShell/PowerShell ✔️ it's **open-source and free** - see the Github repository at: https://github.com/PowerShell/PowerShell
✔️ it's **easy to learn** - see the tutorial for beginners at https://www.guru99.com/powershell-tutorial.html ✔️ it's **easy to learn** - see the tutorial for beginners at: https://www.guru99.com/powershell-tutorial.html
✔️ it's **fully documented** - see the PowerShell documentation at https://docs.microsoft.com/en-us/powershell/ ✔️ it's **fully documented** - see the PowerShell documentation at: https://docs.microsoft.com/en-us/powershell/
How to get PowerShell? How to get PowerShell?
---------------------- ----------------------
* **On Windows** PowerShell is preinstalled. **However,** the default execution policy is "restricted", meaning script execution is disallowed! To change this, open the *Windows PowerShell (Administrator)* console and enter: * **On Windows** PowerShell is preinstalled. **However,** the execution policy is 'restricted' by default! To allow script execution: open the *Windows PowerShell (Administrator)* console and enter:
``` ```
PS> Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser PS> Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser
``` ```
@ -39,6 +39,16 @@ How to get the PowerShell Scripts?
* **Otherwise,** download and unzip it from: https://github.com/fleschutz/PowerShell/archive/master.zip * **Otherwise,** download and unzip it from: https://github.com/fleschutz/PowerShell/archive/master.zip
How to execute PowerShell Scripts?
----------------------------------
1. In the Windows desktop: right-click the script and select: *Execute with PowerShell*
2. In a command-line interface (CLI, e.g. *Windows Terminal*, either local or remote via SSH) by typing: `./<FILENAME_OF_SCRIPT>`.
3. By connecting a context menu item with a script.
4. By voice control, e.g. see repo [talk2windows](https://github.com/fleschutz/talk2windows) for more information.
5. By using automation software, e.g. [Jenkins](https://www.jenkins.io).
6. Automatically on login (see AutoStart folder)/logoff/daily/etc.
What about Security? What about Security?
-------------------- --------------------
* Execute scripts only that you trust (and/or where you have checked the code before)! * Execute scripts only that you trust (and/or where you have checked the code before)!
@ -48,7 +58,7 @@ What about Security?
Why do some scripts show gibberish characters? Why do some scripts show gibberish characters?
---------------------------------------------- ----------------------------------------------
Those PowerShell scripts are using Unicode characters. Use a modern console supporting UTF-8 such as Windows Terminal, please. Those PowerShell scripts are using Unicode characters. Use a modern console supporting UTF-8 such as *Windows Terminal*, please.
How to set PowerShell as default shell on Linux? How to set PowerShell as default shell on Linux?

105
README.md
View File

@ -1,9 +1,9 @@
Mega Collection of PowerShell Scripts Mega Collection of PowerShell Scripts
------------------------------------- -------------------------------------
**This repository provides more than 400 useful and cross-platform PowerShell scripts in the [📂Scripts](Scripts/) subfolder - to be used by command-line interface (CLI), for remote control (via SSH), by context menu, by voice control (see repo [talk2windows](https://github.com/fleschutz/talk2windows)), by automation software (e.g. [Jenkins](https://www.jenkins.io/)), automatically on login/logoff/daily/etc., or simply to learn PowerShell.** **This repository provides more than 500 useful and cross-platform PowerShell scripts in the [📂Scripts](Scripts/) subfolder - to be used by command-line interface (CLI), for remote control (via SSH), by context menu, by voice control (see repo [talk2windows](https://github.com/fleschutz/talk2windows)), by automation software (e.g. [Jenkins](https://www.jenkins.io/)), automatically on login/logoff/daily/etc., or simply to learn PowerShell.**
**[Download](https://github.com/fleschutz/PowerShell/releases) | [FAQ](Docs/FAQ.md)** | **Note:** the scripts support Unicode characters, so use a modern console (e.g. *Windows Terminal*). **[Download](https://github.com/fleschutz/PowerShell/releases) | [FAQ](Docs/FAQ.md)** | **Note:** the scripts support Unicode - a modern console is recommended (e.g. *Windows Terminal*)
🔊 Scripts for Audio & Voice 🔊 Scripts for Audio & Voice
----------------------------- -----------------------------
@ -65,10 +65,10 @@ Mega Collection of PowerShell Scripts
| [install-signal-cli.ps1](Scripts/install-signal-cli.ps1) | Installs signal-cli from github.com/AsamK/signal-cli | [Help](Docs/install-signal-cli.md) | | [install-signal-cli.ps1](Scripts/install-signal-cli.ps1) | Installs signal-cli from github.com/AsamK/signal-cli | [Help](Docs/install-signal-cli.md) |
| [install-updates.ps1](Scripts/install-updates.ps1) | Installs updates (need admin rights) | [Help](Docs/install-updates.md) | | [install-updates.ps1](Scripts/install-updates.ps1) | Installs updates (need admin rights) | [Help](Docs/install-updates.md) |
| [install-wsl.ps1](Scripts/install-wsl.ps1) | Installs Windows Subsystem for Linux (WSL), needs admin rights | [Help](Docs/install-wsl.md) | | [install-wsl.ps1](Scripts/install-wsl.ps1) | Installs Windows Subsystem for Linux (WSL), needs admin rights | [Help](Docs/install-wsl.md) |
| [list-cli-tools.ps1](Scripts/list-cli-tools.ps1) | Lists available command-line interface (CLI) tools | [Help](Docs/list-cli-tools.md) | | [list-apps.ps1](Scripts/list-apps.ps1) | Lists the installed applications | [Help](Docs/list-installed-apps.md) |
| [list-cli-tools.ps1](Scripts/list-cli-tools.ps1) | Lists installed command-line interface (CLI) tools | [Help](Docs/list-cli-tools.md) |
| [list-drives.ps1](Scripts/list-drives.ps1) | Lists all drives | [Help](Docs/list-drives.md) | | [list-drives.ps1](Scripts/list-drives.ps1) | Lists all drives | [Help](Docs/list-drives.md) |
| [list-network-shares.ps1](Scripts/list-network-shares.ps1) | Lists all network shares of the local computer | [Help](Docs/list-network-shares.md) | | [list-network-shares.ps1](Scripts/list-network-shares.ps1) | Lists all network shares of the local computer | [Help](Docs/list-network-shares.md) |
| [list-installed-apps.ps1](Scripts/list-installed-apps.ps1) | Lists the installed Windows Store apps | [Help](Docs/list-installed-apps.md) |
| [list-installed-software.ps1](Scripts/list-installed-software.ps1) | Lists the installed software (except Windows Store apps) | [Help](Docs/list-installed-software.md)| | [list-installed-software.ps1](Scripts/list-installed-software.ps1) | Lists the installed software (except Windows Store apps) | [Help](Docs/list-installed-software.md)|
| [list-printers.ps1](Scripts/list-printers.ps1) | Lists all printer known to the computer | [Help](Docs/list-printers.md) | | [list-printers.ps1](Scripts/list-printers.ps1) | Lists all printer known to the computer | [Help](Docs/list-printers.md) |
| [list-print-jobs.ps1](Scripts/list-print-jobs.ps1) | Lists all jobs of all printers | [Help](Docs/list-print-jobs.md) | | [list-print-jobs.ps1](Scripts/list-print-jobs.ps1) | Lists all jobs of all printers | [Help](Docs/list-print-jobs.md) |
@ -216,63 +216,64 @@ Mega Collection of PowerShell Scripts
♻️ Scripts to Convert Files ♻️ Scripts to Convert Files
--------------------------- ---------------------------
| Script | Description | Help | | Script | Description |
| ------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------- | | ------------------------------------------------------ | --------------------------------------------------------------------------------------------------- |
| [convert-csv2txt.ps1](Scripts/convert-csv2txt.ps1) | Converts a .CSV file to a text file | [Help](Docs/convert-csv2txt.md) | | [convert-csv2txt.ps1](Scripts/convert-csv2txt.ps1) | Converts a .CSV file to a text file. [Read more...](Docs/convert-csv2txt.md) |
| [convert-mysql2csv.ps1](Scripts/convert-mysql2csv.ps1) | Converts a MySQL database table to a .CSV file | [Help](Docs/convert-mysql2csv.md) | | [convert-mysql2csv.ps1](Scripts/convert-mysql2csv.ps1) | Converts a MySQL database table to a .CSV file. [Read more...](Docs/convert-mysql2csv.md) |
| [convert-ps2bat.ps1](Scripts/convert-ps2bat.ps1) | Converts a PowerShell script to a Batch script | [Help](Docs/convert-ps2bat.md) | | [convert-ps2bat.ps1](Scripts/convert-ps2bat.ps1) | Converts a PowerShell script to a Batch script. [Read more...](Docs/convert-ps2bat.md) |
| [convert-ps2md.ps1](Scripts/convert-ps2md.ps1) | Converts the comment-based help of a PowerShell script to Markdown | [Help](Docs/convert-ps2md.md) | | [convert-ps2md.ps1](Scripts/convert-ps2md.ps1) | Converts the comment-based help of a PowerShell script to Markdown. [Read more...](Docs/convert-ps2md.md) |
| [convert-sql2csv.ps1](Scripts/convert-sql2csv.ps1) | Converts a SQL database table to a .CSV file | [Help](Docs/convert-sql2csv.md) | | [convert-sql2csv.ps1](Scripts/convert-sql2csv.ps1) | Converts a SQL database table to a .CSV file. [Read more...](Docs/convert-sql2csv.md) |
| [convert-txt2wav.ps1](Scripts/convert-txt2wav.ps1) | Converts text to a .WAV audio file | [Help](Docs/convert-txt2wav.md) | | [convert-txt2wav.ps1](Scripts/convert-txt2wav.ps1) | Converts text to a .WAV audio file. [Read more...](Docs/convert-txt2wav.md) |
| [export-to-manuals.ps1](Scripts/export-to-manuals.ps1) | Exports all scripts as manuals | [Help](Docs/export-to-manuals.md) | | [export-to-manuals.ps1](Scripts/export-to-manuals.ps1) | Exports all scripts as manuals. [Read more...](Docs/export-to-manuals.md) |
📝 Scripts for Git 📝 Scripts for Git
------------------- -------------------
| Script | Description | Help | | Script | Description |
| ---------------------------------------------------- | ------------------------------------------------------------------ | --------------------------------------- | | ---------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| [build-repo.ps1](Scripts/build-repo.ps1) | Builds a Git repository | [Help](Docs/build-repo.md) | | [build-repo.ps1](Scripts/build-repo.ps1) | Builds a Git repository. [Read more...](Docs/build-repo.md) |
| [build-repos.ps1](Scripts/build-repos.ps1) | Builds all Git repositories in a folder | [Help](Docs/build-repos.md) | | [build-repos.ps1](Scripts/build-repos.ps1) | Builds all Git repositories in a folder. [Read more...](Docs/build-repos.md) |
| [clean-repo.ps1](Scripts/clean-repo.ps1) | Cleans a Git repository from untracked files | [Help](Docs/clean-repo.md) | | [check-repo.ps1](Scripts/check-repo.ps1) | Checks a Git repository. [Read more...](Docs/check-repo.md) |
| [clean-repos.ps1](Scripts/clean-repos.ps1) | Cleans all Git repositories in a folder from untracked files | [Help](Docs/clean-repos.md) | | [clean-repo.ps1](Scripts/clean-repo.ps1) | Cleans a Git repository from untracked files. [Read more...](Docs/clean-repo.md) |
| [clone-repos.ps1](Scripts/clone-repos.ps1) | Clones well-known Git repositories | [Help](Docs/clone-repos.md) | | [clean-repos.ps1](Scripts/clean-repos.ps1) | Cleans all Git repositories in a folder from untracked files. [Read more...](Docs/clean-repos.md) |
| [configure-git.ps1](Scripts/configure-git.ps1) | Sets up the Git user configuration | [Help](Docs/configure-git.md) | | [clone-repos.ps1](Scripts/clone-repos.ps1) | Clones well-known Git repositories. [Read more...](Docs/clone-repos.md) |
| [fetch-repo.ps1](Scripts/fetch-repo.ps1) | Fetches updates for a Git repository | [Help](Docs/fetch-repo.md) | | [configure-git.ps1](Scripts/configure-git.ps1) | Sets up the Git user configuration. [Read more...](Docs/configure-git.md) |
| [fetch-repos.ps1](Scripts/fetch-repos.ps1) | Fetches updates for all Git repositories in a folder | [Help](Docs/fetch-repos.md) | | [fetch-repo.ps1](Scripts/fetch-repo.ps1) | Fetches updates for a Git repository. [Read more...](Docs/fetch-repo.md) |
| [list-branches.ps1](Scripts/list-branches.ps1) | Lists all branches in a Git repository | [Help](Docs/list-branches.md) | | [fetch-repos.ps1](Scripts/fetch-repos.ps1) | Fetches updates for all Git repositories in a folder. [Read more...](Docs/fetch-repos.md) |
| [list-commits.ps1](Scripts/list-commits.ps1) | Lists all commits in a Git repository | [Help](Docs/list-commits.md) | | [list-branches.ps1](Scripts/list-branches.ps1) | Lists all branches in a Git repository. [Read more...](Docs/list-branches.md) |
| [list-latest-tag.ps1](Scripts/list-latest-tag.ps1) | Lists the latest tag on the current branch in a Git repository | [Help](Docs/list-latest-tag.md) | | [list-commits.ps1](Scripts/list-commits.ps1) | Lists all commits in a Git repository. [Read more...](Docs/list-commits.md) |
| [list-latest-tags.ps1](Scripts/list-latest-tags.ps1) | Lists the latests tags in all Git repositories under a directory | [Help](Docs/list-latest-tags.md) | | [list-latest-tag.ps1](Scripts/list-latest-tag.ps1) | Lists the latest tag on the current branch in a Git repository. [Read more...](Docs/list-latest-tag.md) |
| [list-repos.ps1](Scripts/list-repos.ps1) | Lists Git repositories | [Help](Docs/list-repos.md) | | [list-latest-tags.ps1](Scripts/list-latest-tags.ps1) | Lists the latests tags in all Git repositories under a directory. [Read more...](Docs/list-latest-tags.md) |
| [list-submodules.ps1](Scripts/list-submodules.ps1) | Lists the submodules in a Git repository | [Help](Docs/list-submodules.md) | | [list-repos.ps1](Scripts/list-repos.ps1) | Lists the Git repositories in a folder. [Read more...](Docs/list-repos.md) |
| [list-tags.ps1](Scripts/list-tags.ps1) | Lists all tags in a Git repository | [Help](Docs/list-tags.md) | | [list-submodules.ps1](Scripts/list-submodules.ps1) | Lists the submodules in a Git repository. [Read more...](Docs/list-submodules.md) |
| [new-branch.ps1](Scripts/new-branch.ps1) | Creates a new branch in a Git repository | [Help](Docs/new-branch.md) | | [list-tags.ps1](Scripts/list-tags.ps1) | Lists all tags in a Git repository. [Read more...](Docs/list-tags.md) |
| [new-tag.ps1](Scripts/new-tag.ps1) | Creates a new tag in a Git repository | [Help](Docs/new-tag.md) | | [new-branch.ps1](Scripts/new-branch.ps1) | Creates a new branch in a Git repository. [Read more...](Docs/new-branch.md) |
| [pick-commit.ps1](Scripts/pick-commit.ps1) | Cherry-picks a Git commit into multiple branches | [Help](Docs/pick-commit.md) | | [new-tag.ps1](Scripts/new-tag.ps1) | Creates a new tag in a Git repository. [Read more...](Docs/new-tag.md) |
| [pull-repo.ps1](Scripts/pull-repo.ps1) | Pulls updates for a Git repository | [Help](Docs/pull-repo.md) | | [pick-commit.ps1](Scripts/pick-commit.ps1) | Cherry-picks a Git commit into multiple branches. [Read more...](Docs/pick-commit.md) |
| [pull-repos.ps1](Scripts/pull-repos.ps1) | Pulls updates for all Git repositories in a folder | [Help](Docs/pull-repos.md) | | [pull-repo.ps1](Scripts/pull-repo.ps1) | Pulls updates for a Git repository. [Read more...](Docs/pull-repo.md) |
| [remove-tag.ps1](Scripts/remove-tag.ps1) | Removes a tag in a Git repository | [Help](Docs/remove-tag.md) | | [pull-repos.ps1](Scripts/pull-repos.ps1) | Pulls updates for all Git repositories in a folder. [Read more...](Docs/pull-repos.md) |
| [switch-branch.ps1](Scripts/switch-branch.ps1) | Switches the branch in a Git repository | [Help](Docs/switch-branch.md) | | [remove-tag.ps1](Scripts/remove-tag.ps1) | Removes a tag in a Git repository. [Read more...](Docs/remove-tag.md) |
| [sync-repo.ps1](Scripts/sync-repo.ps1) | Synchronizes a Git repository by push & pull | [Help](Docs/sync-repo.md) | | [switch-branch.ps1](Scripts/switch-branch.ps1) | Switches the branch in a Git repository. [Read more...](Docs/switch-branch.md) |
| [sync-repo.ps1](Scripts/sync-repo.ps1) | Synchronizes a Git repository by push & pull. [Read more...](Docs/sync-repo.md) |
🔎 Scripts for PowerShell 🔎 Scripts for PowerShell
------------------------ ------------------------
| Script | Description | Help | | Script | Description |
| ------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------- | | ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ |
| [daily-tasks.sh](Scripts/daily-tasks.sh) | Execute PowerShell scripts automatically as daily tasks (Linux only) | [Help](Docs/daily-tasks.sh.md) | | [daily-tasks.sh](Scripts/daily-tasks.sh) | Execute PowerShell scripts automatically as daily tasks (Linux only). [Read more...](Docs/daily-tasks.sh.md) |
| [introduce-powershell.ps1](Scripts/introduce-powershell.ps1) | Introduces PowerShell to new users | [Help](Docs/introduce-powershell.md) | | [introduce-powershell.ps1](Scripts/introduce-powershell.ps1) | Introduces PowerShell to new users. [Read more...](Docs/introduce-powershell.md) |
| [list-aliases.ps1](Scripts/list-aliases.ps1) | Lists all PowerShell aliases | [Help](Docs/list-aliases.md) | | [list-aliases.ps1](Scripts/list-aliases.ps1) | Lists all PowerShell aliases. [Read more...](Docs/list-aliases.md) |
| [list-automatic-variables.ps1](Scripts/list-automatic-variables.ps1) | Lists the automatic variables of PowerShell | [Help](Docs/list-automatic-variables.md)| | [list-automatic-variables.ps1](Scripts/list-automatic-variables.ps1) | Lists the automatic variables of PowerShell. [Read more...](Docs/list-automatic-variables.md)|
| [list-cheat-sheet.ps1](Scripts/list-cheat-sheet.ps1) | Lists the PowerShell cheat sheet | [Help](Docs/list-cheat-sheet.md) | | [list-cheat-sheet.ps1](Scripts/list-cheat-sheet.ps1) | Lists the PowerShell cheat sheet. [Read more...](Docs/list-cheat-sheet.md) |
| [list-cmdlets.ps1](Scripts/list-cmdlets.ps1) | Lists the PowerShell cmdlets | [Help](Docs/list-cmdlets.md) | | [list-cmdlets.ps1](Scripts/list-cmdlets.ps1) | Lists the PowerShell cmdlets. [Read more...](Docs/list-cmdlets.md) |
| [list-console-colors.ps1](Scripts/list-console-colors.ps1) | Lists all console colors | [Help](Docs/list-console-colors.md) | | [list-console-colors.ps1](Scripts/list-console-colors.ps1) | Lists all console colors. [Read more...](Docs/list-console-colors.md) |
| [list-modules.ps1](Scripts/list-modules.ps1) | Lists the PowerShell modules | [Help](Docs/list-modules.md) | | [list-modules.ps1](Scripts/list-modules.ps1) | Lists the PowerShell modules. [Read more...](Docs/list-modules.md) |
| [list-profiles.ps1](Scripts/list-profiles.ps1) | Lists your PowerShell profiles | [Help](Docs/list-profiles.md) | | [list-profiles.ps1](Scripts/list-profiles.ps1) | Lists your PowerShell profiles. [Read more...](Docs/list-profiles.md) |
| [list-scripts.ps1](Scripts/list-scripts.ps1) | Lists all PowerShell scripts in this repository | [Help](Docs/list-scripts.md) | | [list-scripts.ps1](Scripts/list-scripts.ps1) | Lists all PowerShell scripts in this repository. [Read more...](Docs/list-scripts.md) |
| [new-script.ps1](Scripts/new-script.ps1) | Creates a new PowerShell script | [Help](Docs/new-script.md) | | [new-script.ps1](Scripts/new-script.ps1) | Creates a new PowerShell script. [Read more...](Docs/new-script.md) |
| [set-profile.ps1](Scripts/set-profile.ps1) | Updates your PowerShell user profile | [Help](Docs/set-profile.md) | | [set-profile.ps1](Scripts/set-profile.ps1) | Updates your PowerShell user profile. [Read more...](Docs/set-profile.md) |
🛒 Various PowerShell Scripts 🛒 Various PowerShell Scripts
------------------------------ ------------------------------

View File

@ -1,11 +1,11 @@
<# <#
.SYNOPSIS .SYNOPSIS
Sets the working directory to the user's Git repositories folder Sets the working directory to the user's repos folder
.DESCRIPTION .DESCRIPTION
This PowerShell script changes the working directory to the user's Git repositories folder. This PowerShell script changes the working directory to the user's Git repositories folder.
.EXAMPLE .EXAMPLE
PS> ./cd-repos PS> ./cd-repos
📂/home/Markus/Repos 📂C:\Users\Markus\Repos
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -15,7 +15,11 @@
try { try {
$Path = Resolve-Path "$HOME/Repos" $Path = Resolve-Path "$HOME/Repos"
if (-not(Test-Path "$Path" -pathType container)) { if (-not(Test-Path "$Path" -pathType container)) {
throw "Git repositories folder at 📂$Path doesn't exist (yet)" $Path = Resolve-Path "$HOME/source/repos"
if (-not(Test-Path "$Path" -pathType container)) {
$Path = Resolve-Path "$HOME/Repos"
throw "Folder for Git repositories at 📂$Path doesn't exist (yet)"
}
} }
Set-Location "$Path" Set-Location "$Path"
"📂$Path" "📂$Path"

26
Scripts/cd-users.ps1 Normal file
View File

@ -0,0 +1,26 @@
<#
.SYNOPSIS
Sets the working directory to the users directory
.DESCRIPTION
This PowerShell script changes the working directory to the users directory.
.EXAMPLE
PS> ./cd-users
📂C:\Users
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
$Path = Resolve-Path "$HOME/.."
if (-not(Test-Path "$Path" -pathType container)) {
throw "Users directory at 📂$Path doesn't exist (yet)"
}
Set-Location "$Path"
"📂$Path"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}

View File

@ -12,27 +12,42 @@
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
function GetCPUTemperatureInCelsius {
$Temp = 99999.9 # unsupported
if ($IsLinux) {
if (Test-Path "/sys/class/thermal/thermal_zone0/temp" -pathType leaf) {
[int]$IntTemp = Get-Content "/sys/class/thermal/thermal_zone0/temp"
$Temp = [math]::round($IntTemp / 1000.0, 1)
}
} else {
$Objects = Get-WmiObject -Query "SELECT * FROM Win32_PerfFormattedData_Counters_ThermalZoneInformation" -Namespace "root/CIMV2"
foreach ($Obj in $Objects) {
$HiPrec = $Obj.HighPrecisionTemperature
$Temp = [math]::round($HiPrec / 100.0, 1)
}
}
return $Temp;
}
try { try {
if (test-path "/sys/class/thermal/thermal_zone0/temp" -pathType leaf) { $Celsius = GetCPUTemperatureInCelsius
[int]$IntTemp = get-content "/sys/class/thermal/thermal_zone0/temp" if ($Celsius -eq 99999.9) {
$Temp = [math]::round($IntTemp / 1000.0, 1) $Temp = "no temp"
} elseif ($Celsius -gt 50) {
$Temp = "$($Celsius)°C hot"
} elseif ($Celsius -gt 0) {
$Temp = "$($Celsius)°C warm"
} else { } else {
$data = Get-WMIObject -Query "SELECT * FROM Win32_PerfFormattedData_Counters_ThermalZoneInformation" -Namespace "root/CIMV2" $Temp = "$($Celsius)°C cold"
$Temp = @($data)[0].HighPrecisionTemperature
$Temp = [math]::round($Temp / 100.0, 1)
} }
if ($Temp -gt 80) {
$Reply = "CPU is $($Temp)°C extremely hot!" if ($IsLinux) {
} elseif ($Temp -gt 50) { "✅ CPU is $Temp."
$Reply = "CPU is $($Temp)°C hot."
} elseif ($Temp -gt 0) {
$Reply = "CPU is $($Temp)°C warm."
} elseif ($Temp -gt -20) {
$Reply = "CPU is $($Temp)°C cold."
} else { } else {
$Reply = "CPU is $($Temp)°C extremely cold!" $Details = Get-WmiObject -Class Win32_Processor
$DeviceName = $Details.Name.trim()
"$DeviceName ($($Details.DeviceID), $($Details.MaxClockSpeed)MHz, $Temp)."
} }
& "$PSScriptRoot/give-reply.ps1" $Reply
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -1,25 +0,0 @@
<#
.SYNOPSIS
Determines the current date
.DESCRIPTION
This PowerShell script determines and speaks the current date by text-to-speech (TTS).
.EXAMPLE
PS> ./check-date
✔️ It's Sunday, October 17, 2021
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
[system.threading.thread]::currentthread.currentculture=[system.globalization.cultureinfo]"en-US"
$Weekday = (Get-Date -format "dddd")
$CurrentDate = (Get-Date).ToShortDateString()
& "$PSScriptRoot/give-reply.ps1" "It's $Weekday, $CurrentDate"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}

View File

@ -2,7 +2,7 @@
.SYNOPSIS .SYNOPSIS
Checks the DNS resolution Checks the DNS resolution
.DESCRIPTION .DESCRIPTION
This PowerShell script checks the DNS resolution using frequently used domain names. This PowerShell script measures and prints the DNS resolution speed by using 200 frequently used domain names.
.EXAMPLE .EXAMPLE
PS> ./check-dns PS> ./check-dns
.LINK .LINK
@ -12,26 +12,26 @@
#> #>
try { try {
"⏳ Step 1/2 - Reading table from Data/domains.csv..." Write-Progress "⏳ Step 1/2 - Reading from Data/frequent-domains.csv..."
$Table = Import-CSV "$PSScriptRoot/../Data/domains.csv" $Table = Import-CSV "$PSScriptRoot/../Data/frequent-domains.csv"
$NumRows = $Table.Length $NumRows = $Table.Length
"⏳ Step 2/2 - Resolving $NumRows domains..." Write-Progress "⏳ Step 2/2 - Resolving $NumRows domains..."
$StopWatch = [system.diagnostics.stopwatch]::startNew() $StopWatch = [system.diagnostics.stopwatch]::startNew()
if ($IsLinux) { if ($IsLinux) {
foreach($Row in $Table) { $null = dig $Row.Domain +short } foreach($Row in $Table){$nop=dig $Row.Domain +short}
} else { } else {
foreach($Row in $Table) { $null = Resolve-DNSName $Row.Domain } foreach($Row in $Table){$nop=Resolve-DNSName $Row.Domain}
} }
[float]$Elapsed = $StopWatch.Elapsed.TotalSeconds [float]$Elapsed = $StopWatch.Elapsed.TotalSeconds
$Average = [math]::round($NumRows / $Elapsed, 1) $Average = [math]::round($NumRows / $Elapsed, 1)
if ($Average -gt 200.0) { $Rating = "excellent"
} elseif ($Average -gt 100.0) { $Rating = "quite good" if ($Average -gt 10.0) {
} elseif ($Average -gt 10.0) { $Rating = "good" "✅ DNS resolves $Average domains per second."
} else { $Rating = "poor" } else {
"⚠️ DNS resolves only $Average domains per second!"
} }
"✔️ $Average DNS domain lookups per second - $Rating"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -1,8 +1,10 @@
<# <#
.SYNOPSIS .SYNOPSIS
Checks the free space of all drives Checks the drive space
.DESCRIPTION .DESCRIPTION
This PowerShell script checks all drives for free space left (20 GB by default). This PowerShell script checks all drives for free space left.
.PARAMETER MinLevel
Specifies the minimum warning level (10 GB by default)
.EXAMPLE .EXAMPLE
PS> ./check-drives PS> ./check-drives
.LINK .LINK
@ -11,22 +13,26 @@
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
param([int]$MinLevel = 10) # 10 GB minimum
try { try {
$Drives = Get-PSDrive -PSProvider FileSystem $Drives = Get-PSDrive -PSProvider FileSystem
foreach($Drive in $Drives) { foreach($Drive in $Drives) {
$DriveDetails = (Get-PSDrive $Drive.Name) $ID = $Drive.Name
[int]$Free = (($DriveDetails.Free / 1024) / 1024) / 1024 $Details = (Get-PSDrive $ID)
[int]$Used = (($DriveDetails.Used / 1024) / 1024) / 1024 [int]$Free = $Details.Free / 1GB
[int]$Used = $Details.Used / 1GB
[int]$Total = ($Used + $Free) [int]$Total = ($Used + $Free)
if ($Total -eq "0") { if ($Total -eq 0) {
$Reply = "Drive $($Drive.Name) is empty." "Drive $ID is empty."
} elseif ($Free -lt $MinLevel) { } elseif ($Free -lt $MinLevel) {
$Reply = "Drive $($Drive.Name) has only $Free GB left to use! $Used of $Total GB is in use." "⚠️ Drive $ID has only $Free GB of $Total GB left to use!"
} elseif ($Used -lt $Free) {
"✅ Drive $ID uses $Used GB of $Total GB."
} else { } else {
$Reply = "Drive $($Drive.Name) has $($Free) GB left, $($Total) GB total." "Drive $ID has $Free GB of $Total GB left."
} }
"* $Reply"
} }
exit 0 # success exit 0 # success
} catch { } catch {

44
Scripts/check-gpu.ps1 Normal file
View File

@ -0,0 +1,44 @@
<#
.SYNOPSIS
Checks the GPU
.DESCRIPTION
This PowerShell script queries GPU details and prints it.
.EXAMPLE
PS> ./check-gpu
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
function Bytes2String { param([int64]$Bytes)
if ($Bytes -lt 1000) { return "$Bytes bytes" }
$Bytes /= 1000
if ($Bytes -lt 1000) { return "$($Bytes)KB" }
$Bytes /= 1000
if ($Bytes -lt 1000) { return "$($Bytes)MB" }
$Bytes /= 1000
if ($Bytes -lt 1000) { return "$($Bytes)GB" }
$Bytes /= 1000
return "$($Bytes)TB"
}
try {
if ($IsLinux) {
# TODO
} else {
$Details = Get-WmiObject Win32_VideoController
$Model = $Details.Caption
$RAMSize = $Details.AdapterRAM
$ResWidth = $Details.CurrentHorizontalResolution
$ResHeight = $Details.CurrentVerticalResolution
$BitsPerPixel = $Details.CurrentBitsPerPixel
$RefreshRate = $Details.CurrentRefreshRate
$DriverVersion = $Details.DriverVersion
$Status = $Details.Status
"$Model ($(Bytes2String $RAMSize), $ResWidth x $ResHeight pixels, $BitsPerPixel bit, $RefreshRate Hz, driver $DriverVersion, status $Status)."
}
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}

View File

@ -1,15 +1,10 @@
<# <#
.SYNOPSIS .SYNOPSIS
Checks the computer health Checks the system health
.DESCRIPTION .DESCRIPTION
This PowerShell script checks the health of the local computer. This PowerShell script checks some health parameter of the local computer.
.EXAMPLE .EXAMPLE
PS> ./check-health PS> ./check-health
✔️ 1213 GB left for swap space (67 of 1280 GB used)
✔️ 172 GB left on drive C (61 of 233 GB used)
✔️ 30.3 °C CPU temperature - good
✔️ DNS resolution is 19.7 domains per second
✔️ 29 ms ping average (13 ms min, 110 ms max, 10 hosts)
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -18,13 +13,15 @@
& "$PSScriptRoot/check-uptime.ps1" & "$PSScriptRoot/check-uptime.ps1"
& "$PSScriptRoot/check-operating-system.ps1" & "$PSScriptRoot/check-operating-system.ps1"
& "$PSScriptRoot/check-time-zone.ps1"
& "$PSScriptRoot/check-cpu.ps1"
& "$PSScriptRoot/check-ram.ps1"
& "$PSScriptRoot/check-gpu.ps1"
& "$PSScriptRoot/check-smart-devices.ps1"
& "$PSScriptRoot/check-swap-space.ps1" & "$PSScriptRoot/check-swap-space.ps1"
& "$PSScriptRoot/check-drives.ps1" & "$PSScriptRoot/check-drives.ps1"
& "$PSScriptRoot/check-cpu.ps1"
& "$PSScriptRoot/check-dns.ps1" & "$PSScriptRoot/check-dns.ps1"
& "$PSScriptRoot/check-ping.ps1" & "$PSScriptRoot/check-ping.ps1"
& "$PSScriptRoot/check-vpn.ps1" & "$PSScriptRoot/check-vpn.ps1"
if ($IsLinux) { & "$PSScriptRoot/check-pending-reboot.ps1"
& "$PSScriptRoot/check-smart-devices.ps1"
}
exit 0 # success exit 0 # success

View File

@ -1,8 +1,8 @@
<# <#
.SYNOPSIS .SYNOPSIS
Determines the exact OS version Query OS details
.DESCRIPTION .DESCRIPTION
This PowerShell script determines and says the exact operating system version by text-to-speech (TTS). This PowerShell script queries and lists operating system details.
.EXAMPLE .EXAMPLE
PS> ./check-operating-system PS> ./check-operating-system
.LINK .LINK
@ -13,15 +13,20 @@
try { try {
if ($IsLinux) { if ($IsLinux) {
$Reply = (uname -sr) "$(uname -sr)."
} else { } else {
$OS = Get-WmiObject -class Win32_OperatingSystem $OS = Get-WmiObject -class Win32_OperatingSystem
$OSname = $OS.Caption $Name = $OS.Caption
$OSarchitecture = $OS.OSArchitecture $Arch = $OS.OSArchitecture
$OSversion = $OS.Version $Version = $OS.Version
$Reply = "$OSname for $OSarchitecture version $OSversion"
[system.threading.thread]::currentthread.currentculture = [system.globalization.cultureinfo]"en-US"
$OSDetails = Get-CimInstance Win32_OperatingSystem
$BuildNo = $OSDetails.BuildNumber
$Serial = $OSDetails.SerialNumber
$InstallDate = $OSDetails.InstallDate
"$Name ($Arch, v$Version, serial $Serial), installed $($InstallDate.ToShortDateString())."
} }
& "$PSScriptRoot/give-reply.ps1" "$Reply"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -1,8 +1,8 @@
<# <#
.SYNOPSIS .SYNOPSIS
Checks Outlook's Inbox Checks Outlook's inbox
.DESCRIPTION .DESCRIPTION
This PowerShell script checks the inbox of Outlook for new mails. This PowerShell script checks the inbox of Outlook for new/unread mails.
.EXAMPLE .EXAMPLE
PS> ./check-outlook PS> ./check-outlook
.LINK .LINK
@ -17,21 +17,12 @@ try {
$Namespace = $Outlook.GetNameSpace("MAPI") $Namespace = $Outlook.GetNameSpace("MAPI")
$Inbox = $Namespace.GetDefaultFolder(6) # 6 = olFolderInbox $Inbox = $Namespace.GetDefaultFolder(6) # 6 = olFolderInbox
[int]$Unread = 0 [int]$Unread = 0
$Sender = ""
[switch]$SameSender = $true
foreach($Mail in $Inbox.Items) { foreach($Mail in $Inbox.Items) {
if ($Mail.Unread -eq $false) { continue } if ($Mail.Unread -eq $false) { continue }
"⚠️ New mail '$($Mail.Subject)' from $($Mail.SenderName)."
$Unread++ $Unread++
if ("$Sender" -eq "") { $Sender = $Mail.SenderName
} elseif ("$Sender" -ne "$($Mail.SenderName)") { $SameSender = $false }
$Subject = $Mail.Subject
} }
if ($Unread -eq 0) { $Reply = "No new mails." if ($Unread -eq 0) { "No new mails." }
} elseif ($Unread -eq 1) { $Reply = "One new mail from $Sender regarding $Subject."
} elseif ($SameSender) { $Reply = "$Unread new mails from $Sender."
} else { $Reply = "$Unread new mails."
}
"$Reply"
exit 0 # success exit 0 # success
} catch { } catch {
"Sorry: $($Error[0])" "Sorry: $($Error[0])"

View File

@ -0,0 +1,63 @@
<#
.SYNOPSIS
Check for pending reboots
.DESCRIPTION
This PowerShell script checks different registry keys and values to determine if a reboot is pending.
.EXAMPLE
./check-pending-reboot.ps1
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
function Test-RegistryValue { param([parameter(Mandatory=$true)][ValidateNotNullOrEmpty()]$Path, [parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()]$Value)
try {
Get-ItemProperty -Path $Path -Name $Value -EA Stop
return $true
} catch {
return $false
}
}
$Reason = ""
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired") {
$Reason += ", found registry entry: '...\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired'"
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\PostRebootReporting") {
$Reason += ", found registry entry: '...\Windows\CurrentVersion\WindowsUpdate\Auto Update\PostRebootReporting'"
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending") {
$Reason += ", found registry entry: '...\Windows\CurrentVersion\Component Based Servicing\RebootPending'"
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\ServerManager\CurrentRebootAttempts") {
$Reason += ", found registry entry: '...\Microsoft\ServerManager\CurrentRebootAttempts'"
}
if (Test-RegistryValue -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing" -Value "RebootInProgress") {
$Reason += ", found registry entry: '...\Windows\CurrentVersion\Component Based Servicing' with 'RebootInProgress'"
}
if (Test-RegistryValue -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing" -Value "PackagesPending") {
$Reason += ", found registry entry: '...\Windows\CurrentVersion\Component Based Servicing' with 'PackagesPending'"
}
#if (Test-RegistryValue -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" -Value "PendingFileRenameOperations") {
# $Reason += ", found registry entry '...\CurrentControlSet\Control\Session Manager' with 'PendingFileRenameOperations'"
#}
if (Test-RegistryValue -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" -Value "PendingFileRenameOperations2") {
$Reason += ", found registry entry '...\CurrentControlSet\Control\Session Manager' with 'PendingFileRenameOperations2'"
}
if (Test-RegistryValue -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" -Value "DVDRebootSignal") {
$Reason += ", found registry entry '...\Windows\CurrentVersion\RunOnce' with 'DVDRebootSignal'"
}
if (Test-RegistryValue -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Netlogon" -Value "JoinDomain") {
$Reason += ", found registry entry '...\CurrentControlSet\Services\Netlogon' with 'JoinDomain'"
}
if (Test-RegistryValue -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Netlogon" -Value "AvoidSpnSet") {
$Reason += ", found registry entry '...\CurrentControlSet\Services\Netlogon' with 'AvoidSpnSet'"
}
if ($Reason -ne "") {
"⚠️ Pending reboot ($($Reason.substring(2)))."
} else {
"✅ No pending reboot."
}
exit 0 # success

View File

@ -1,14 +1,13 @@
<# <#
.SYNOPSIS .SYNOPSIS
Checks the ping latency to selected Internet hosts Checks the ping latency
.DESCRIPTION .DESCRIPTION
This PowerShell script checks the ping latency from the local computer to selected Internet hosts. This PowerShell script checks the ping latency from the local computer to some Internet hosts.
The hosts by default are: amazon.com,bing.com,cnn.com,dropbox.com,facebook.com,google.com,live.com,twitter.com,youtube.com
.PARAMETER hosts .PARAMETER hosts
Specifies the hosts to check (separated by comma) Specifies the hosts to check, seperated by comma (default is: amazon.com,bing.com,cnn.com,dropbox.com,facebook.com,google.com,live.com,twitter.com,youtube.com)
.EXAMPLE .EXAMPLE
PS> ./check-ping PS> ./check-ping
✔️ Average ping is 36ms average (13ms min, 109ms max) ✅ Ping is 25ms average, 13ms min, 109ms max.
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -18,26 +17,20 @@
param([string]$hosts = "amazon.com,bing.com,cnn.com,dropbox.com,facebook.com,google.com,live.com,twitter.com,youtube.com") param([string]$hosts = "amazon.com,bing.com,cnn.com,dropbox.com,facebook.com,google.com,live.com,twitter.com,youtube.com")
try { try {
write-progress "Sending pings to $hosts..." Write-Progress "⏳ Pinging $hosts..."
$HostsArray = $hosts.Split(",") $HostsArray = $hosts.Split(",")
$Pings = test-connection -count 1 -computerName $HostsArray $Pings = Test-Connection -count 1 -computerName $HostsArray
[int]$Min = 9999999 [int]$Min = 9999999
[int]$Max = 0 [int]$Max = [int]$Avg = 0
[int]$Avg = 0
foreach($Ping in $Pings) { foreach($Ping in $Pings) {
if ($IsLinux) { if ($IsLinux) { [int]$Latency = $Ping.latency } else { [int]$Latency = $Ping.ResponseTime }
[int]$Latency = $Ping.latency
} else {
[int]$Latency = $Ping.ResponseTime
}
if ($Latency -lt $Min) { $Min = $Latency } if ($Latency -lt $Min) { $Min = $Latency }
if ($Latency -gt $Max) { $Max = $Latency } if ($Latency -gt $Max) { $Max = $Latency }
$Avg += $Latency $Avg += $Latency
} }
$Avg = $Avg / $Pings.count $Avg /= $Pings.count
"✅ Ping is $($Avg)ms average, $($Min)ms min, $($Max)ms max."
& "$PSScriptRoot/give-reply.ps1" "$($Avg)ms average ping time ($($Min)ms min, $($Max)ms max)"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

62
Scripts/check-ram.ps1 Normal file
View File

@ -0,0 +1,62 @@
<#
.SYNOPSIS
Checks the RAM
.DESCRIPTION
This PowerShell script queries and prints details of the installed RAM.
.EXAMPLE
PS> ./check-ram
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
function GetRAMType { param([int]$Type)
switch($Type) {
2 { return "DRAM" }
5 { return "EDO RAM" }
6 { return "EDRAM" }
7 { return "VRAM" }
8 { return "SRAM" }
10 { return "ROM" }
11 { return "Flash RAM" }
12 { return "EEPROM" }
13 { return "FEPROM" }
14 { return "EPROM" }
15 { return "CDRAM" }
16 { return "3DRAM" }
17 { return "SDRAM" }
18 { return "SGRAM" }
19 { return "RDRAM" }
20 { return "DDR RAM" }
21 { return "DDR2 RAM" }
22 { return "DDR2 FB-DIMM" }
24 { return "DDR3 RAM" }
26 { return "DDR4 RAM" }
27 { return "DDR5 RAM" }
28 { return "DDR6 RAM" }
29 { return "DDR7 RAM" }
default { return "RAM" }
}
}
try {
if ($IsLinux) {
# TODO
} else {
$Banks = Get-WmiObject -Class Win32_PhysicalMemory
foreach ($Bank in $Banks) {
$Capacity = $Bank.Capacity / (1024 * 1024 * 1024)
$Type = GetRAMType $Bank.SMBIOSMemoryType
$Speed = $Bank.Speed
[float]$Voltage = $Bank.ConfiguredVoltage / 1000.0
$Manufacturer = $Bank.Manufacturer
$Location = "$($Bank.BankLabel)/$($Bank.DeviceLocator)"
"$($Capacity)GB $Type ($($Speed)MHz, $($Voltage)V) at $Location by $Manufacturer."
}
}
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}

77
Scripts/check-repo.ps1 Normal file
View File

@ -0,0 +1,77 @@
<#
.SYNOPSIS
Checks a Git repository
.DESCRIPTION
This PowerShell script verifies the integrity of a local Git repository.
.PARAMETER RepoDir
Specifies the path to the Git repository (current working dir by default)
.EXAMPLE
PS> ./check-repo
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
param([string]$RepoDir = "$PWD")
try {
$StopWatch = [system.diagnostics.stopwatch]::startNew()
Write-Host "⏳ (1/11) Searching for Git executable... " -noNewline
& git --version
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
Write-Host "⏳ (2/11) Checking path... " -noNewline
$FullPath = Resolve-Path "$RepoDir"
if (!(Test-Path "$FullPath" -pathType Container)) { throw "Can't access folder: $FullPath" }
"$FullPath"
Write-Host "⏳ (3/11) Searching for 📂.git... " -noNewline
if (!(Test-Path "$FullPath/.git" -pathType container)) { throw "Can't access folder: $FullPath/.git" }
"OK"
Write-Host "⏳ (4/11) Query remote URL... " -noNewline
& git -C "$FullPath" remote get-url origin
if ($lastExitCode -ne "0") { throw "'git remote get-url origin' failed with exit code $lastExitCode" }
Write-Host "⏳ (5/11) Query current branch... " -noNewline
& git -C "$FullPath" branch --show-current
if ($lastExitCode -ne "0") { throw "'git branch --show-current' failed with exit code $lastExitCode" }
Write-Host "⏳ (6/11) Trying to fetch... " -noNewline
& git -C "$FullPath" fetch
if ($lastExitCode -ne "0") { throw "'git branch --show-current' failed with exit code $lastExitCode" }
Write-Host "OK"
Write-Host "⏳ (7/11) Query latest tag... " -noNewline
$LatestTagCommitID = (git -C "$FullPath" rev-list --tags --max-count=1)
$LatestTagName = (git -C "$FullPath" describe --tags $LatestTagCommitID)
Write-Host "$LatestTagName (commit $LatestTagCommitID)"
Write-Host "⏳ (8/11) Verify data integrity..."
& git -C "$FullPath" fsck
if ($lastExitCode -ne "0") { throw "'git fsck' failed with exit code $lastExitCode" }
Write-Host "⏳ (9/11) Run maintenance tasks..."
& git -C "$FullPath" maintenance run
if ($lastExitCode -ne "0") { throw "'git maintenance run' failed with exit code $lastExitCode" }
Write-Host "⏳ (10/11) Query submodule status... " -noNewline
& git -C "$FullPath" submodule status
if ($lastExitCode -ne "0") { throw "'git submodule status' failed with exit code $lastExitCode" }
" "
Write-Host "⏳ (11/11) Query repository status... " -noNewline
& git -C "$FullPath" status --short
if ($lastExitCode -ne "0") { throw "'git status --short' failed with exit code $lastExitCode" }
" "
$RepoDirName = (Get-Item "$FullPath").Name
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"✔️ checked 📂$RepoDirName repo in $Elapsed sec"
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}

View File

@ -1,34 +1,71 @@
<# <#
.SYNOPSIS .SYNOPSIS
Performs a selftest on your S.M.A.R.T. HDD/SSD devices. Checks SMART devices
.DESCRIPTION .DESCRIPTION
This PowerShell script performs a selftest on your S.M.A.R.T. HDD/SSD devices. This PowerShell script queries S.M.A.R.T. HDD/SSD device details and prints it.
It requires smartctl (smartmontools package) and admin rights.
.PARAMETER type
Specifies the type of selftest: either short (default) or long
.EXAMPLE .EXAMPLE
PS> ./check-smart-devices PS> ./check-smart-devices
✔️ short selftest started on S.M.A.R.T. device /dev/sda ✅ 1TB Samsung SSD 970 EVO via NVMe, 37°C, 2388 hours, 289x on, v2B2QEXE7, selftest passed.
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#Requires -RunAsAdministrator function Bytes2String { param([int64]$Bytes)
if ($Bytes -lt 1000) { return "$Bytes bytes" }
param([string]$type = "short") $Bytes /= 1000
if ($Bytes -lt 1000) { return "$($Bytes)KB" }
$Bytes /= 1000
if ($Bytes -lt 1000) { return "$($Bytes)MB" }
$Bytes /= 1000
if ($Bytes -lt 1000) { return "$($Bytes)GB" }
$Bytes /= 1000
if ($Bytes -lt 1000) { return "$($Bytes)TB" }
$Bytes /= 1000
if ($Bytes -lt 1000) { return "$($Bytes)PB" }
$Bytes /= 1000
if ($Bytes -lt 1000) { return "$($Bytes)EB" }
}
try { try {
$Result=(smartctl --version) Write-Progress "⏳ Step 1/3 - Searching for smartctl executable..."
$Result = (smartctl --version)
if ($lastExitCode -ne "0") { throw "Can't execute 'smartctl' - make sure smartmontools are installed" } if ($lastExitCode -ne "0") { throw "Can't execute 'smartctl' - make sure smartmontools are installed" }
$Devices = $(sudo smartctl --scan-open) Write-Progress "⏳ Step 2/3 - Scanning S.M.A.R.T devices..."
if ($IsLinux) {
$Devices = $(sudo smartctl --scan-open)
} else {
$Devices = $(smartctl --scan-open)
}
foreach($Device in $Devices) { foreach($Device in $Devices) {
Write-Progress "⏳ Step 3/3 - Querying S.M.A.R.T devices..."
$Array = $Device.split(" ") $Array = $Device.split(" ")
$Device = $Array[0] $Device = $Array[0]
$Result = (sudo smartctl --test=$type $Device) if ("$Device" -eq "#") {
"✔️ $type selftest started on S.M.A.R.T. device $Device" continue
} elseif ($IsLinux) {
$Details = (sudo smartctl --all --json $Device) | ConvertFrom-Json
$null = (sudo smartctl --test=short $Device)
} else {
$Details = (smartctl --all --json $Device) | ConvertFrom-Json
$null = (smartctl --test=short $Device)
}
$ModelName = $Details.model_name
$Protocol = $Details.device.protocol
[int64]$GBytes = $Details.user_capacity.bytes
if ($GBytes -gt 0) {
$Capacity = "$(Bytes2String $GBytes) "
} else {
$Capacity = ""
}
$Temp = $Details.temperature.current
$Firmware = $Details.firmware_version
$PowerOn = $Details.power_cycle_count
$Hours = $Details.power_on_time.hours
if ($Details.smart_status.passed) { $Status = "passed" } else { $Status = "FAILED" }
"$($Capacity)$ModelName via $Protocol, $($Temp)°C, $($Hours) hours, $($PowerOn)x on, v$($Firmware), selftest $Status."
} }
exit 0 # success exit 0 # success
} catch { } catch {

View File

@ -4,41 +4,43 @@
.DESCRIPTION .DESCRIPTION
This PowerShell script checks the free swap space. This PowerShell script checks the free swap space.
.PARAMETER MinLevel .PARAMETER MinLevel
Specifies the minimum level (50 GB by default) Specifies the minimum level (10 GB by default)
.EXAMPLE .EXAMPLE
PS> ./check-swap-space PS> ./check-swap-space
✔️ 1213 GB left for swap space (67 of 1280 GB used) ✅ Swap space uses 63 GB of 1856 GB.
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
param([int]$MinLevel = 50) # minimum level in GB param([int]$MinLevel = 10) # minimum level in GB
try { try {
[int]$Total = [int]$Used = [int]$Free = 0
if ($IsLinux) { if ($IsLinux) {
$Result = $(free --mega | grep Swap:) $Result = $(free --mega | grep Swap:)
[int]$Total = $Result.subString(5,14) [int]$Total = $Result.subString(5,14)
[int]$Used = $Result.substring(20,13) [int]$Used = $Result.substring(20,13)
[int]$Free = $Result.substring(31,12) [int]$Free = $Result.substring(32,11)
} else { } else {
$Items = get-wmiobject -class "Win32_PageFileUsage" -namespace "root\CIMV2" -computername localhost $Items = Get-WmiObject -class "Win32_PageFileUsage" -namespace "root\CIMV2" -computername localhost
foreach ($Item in $Items) { foreach ($Item in $Items) {
[int]$Total = $Item.AllocatedBaseSize $Total = $Item.AllocatedBaseSize
[int]$Used = $Item.CurrentUsage $Used = $Item.CurrentUsage
[int]$Free = ($Total - $Used) $Free = ($Total - $Used)
} }
} }
if ($Total -eq "0") { if ($Total -eq 0) {
$Reply = "No swap space configured!" "⚠️ No swap space!"
} elseif ($Free -lt $MinLevel) { } elseif ($Free -lt $MinLevel) {
$Reply = "Swap space has only $Free GB left to use! ($Used of $Total GB used, minimum is $MinLevel GB)" "⚠️ Swap space has only $Free GB of $Total GB left to use!"
} elseif ($Used -lt $Free) {
"✅ Swap space uses $Used GB of $Total GB."
} else { } else {
$Reply = "Swap space has $Free GB left ($Total GB total)" "Swap space has $Free GB of $Total GB left."
} }
& "$PSScriptRoot/give-reply.ps1" "$Reply"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -1,8 +1,8 @@
<# <#
.SYNOPSIS .SYNOPSIS
Determines the time zone Checks the time zone setting
.DESCRIPTION .DESCRIPTION
This PowerShell script determines and returns the current time zone. This PowerShell script determines and prints the current time zone.
.EXAMPLE .EXAMPLE
PS> ./check-time-zone PS> ./check-time-zone
.LINK .LINK
@ -12,9 +12,11 @@
#> #>
try { try {
$TimeZone = (Get-Timezone) [system.threading.thread]::currentThread.currentCulture = [system.globalization.cultureInfo]"en-US"
$Time = $((Get-Date).ToShortTimeString())
& "$PSScriptRoot/give-reply.ps1" "It's $($TimeZone.DisplayName)" $TZ = (Get-Timezone)
if ($TZ.SupportsDaylightSavingTime) { $DST=" & +01:00:00 DST" } else { $DST="" }
"$Time in $($TZ.Id) (UTC+$($TZ.BaseUtcOffset)$DST)."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -1,8 +1,8 @@
<# <#
.SYNOPSIS .SYNOPSIS
Determines the uptime Check uptime
.DESCRIPTION .DESCRIPTION
This PowerShell script determines and says the uptime by text-to-speech (TTS). This PowerShell script queries and prints the uptime.
.EXAMPLE .EXAMPLE
PS> ./check-uptime PS> ./check-uptime
.LINK .LINK
@ -16,32 +16,29 @@ try {
$Uptime = (get-uptime) $Uptime = (get-uptime)
} else { } else {
$BootTime = Get-WinEvent -ProviderName eventlog | Where-Object {$_.Id -eq 6005} | Select-Object TimeCreated -First 1 $BootTime = Get-WinEvent -ProviderName eventlog | Where-Object {$_.Id -eq 6005} | Select-Object TimeCreated -First 1
$TimeNow = Get-Date $Uptime = New-TimeSpan -Start $BootTime.TimeCreated.Date -End (Get-Date)
$Uptime = New-TimeSpan -Start $BootTime.TimeCreated.Date -End $TimeNow
} }
$Days = $Uptime.Days $Days = $Uptime.Days
$Hours = $Uptime.Hours $Hours = $Uptime.Hours
$Minutes = $Uptime.Minutes $Minutes = $Uptime.Minutes
$Reply = "I'm up for " $Reply = "Up for "
if ($Days -eq "1") { if ($Days -eq "1") {
$Reply += "1 day, " $Reply += "1 day, "
} elseif ($Days -ne "0") { } elseif ($Days -ne "0") {
$Reply += "$Days days, " $Reply += "$Days days, "
} }
if ($Hours -eq "1") { if ($Hours -eq "1") {
$Reply += "1 hour " $Reply += "1 hour, "
} elseif ($Hours -ne "0") { } elseif ($Hours -ne "0") {
$Reply += "$Hours hours " $Reply += "$Hours hours, "
} }
if ($Minutes -eq "1") { if ($Minutes -eq "1") {
$Reply += "and 1 minute" $Reply += "1 minute"
} elseif ($Minutes -ne "0") { } else {
$Reply += "and $Minutes minutes" $Reply += "$Minutes minutes"
} }
$Reply += "." "$Reply."
& "$PSScriptRoot/give-reply.ps1" "$Reply"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -1,8 +1,8 @@
<# <#
.SYNOPSIS .SYNOPSIS
Checks the VPN connections Checks the VPN connection
.DESCRIPTION .DESCRIPTION
This PowerShell script checks the status of all available VPN connections. This PowerShell script queries and prints the status of any VPN connection.
.EXAMPLE .EXAMPLE
PS> ./check-vpn PS> ./check-vpn
.LINK .LINK
@ -12,13 +12,17 @@
#> #>
try { try {
$FoundOne = $false $NoVPN = $true
$Connections = (Get-VPNConnection) if ($IsLinux) {
foreach($Connection in $Connections) { # TODO
"VPN $($Connection.Name) is $($Connection.ConnectionStatus)." } else {
$FoundOne = $true $Connections = (Get-VPNConnection)
foreach($Connection in $Connections) {
"✅ VPN '$($Connection.Name)' is $($Connection.ConnectionStatus)."
$NoVPN = $false
}
} }
if (!$FoundOne) { throw "No VPN connection available" } if ($NoVPN) { "⚠️ No VPN connection." }
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -19,15 +19,15 @@ param([string]$RepoDir = "$PWD")
try { try {
$StopWatch = [system.diagnostics.stopwatch]::startNew() $StopWatch = [system.diagnostics.stopwatch]::startNew()
"Step 1/4 - Searching for Git executable..." Write-Host "(1/4) Searching for Git executable... " -noNewline
& git --version & git --version
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" } if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
$RepoDirName = (Get-Item "$RepoDir").Name $RepoDirName = (Get-Item "$RepoDir").Name
"Step 2/4 - Checking folder 📂$RepoDirName..." "(2/4) Checking folder 📂$RepoDirName..."
if (-not(Test-Path "$RepoDir" -pathType container)) { throw "Can't access folder '$RepoDir' - maybe a typo or missing folder permissions?" } if (-not(Test-Path "$RepoDir" -pathType container)) { throw "Can't access folder '$RepoDir' - maybe a typo or missing folder permissions?" }
"Step 3/4 - Cleaning Git repository from untracked files..." "(3/4) Removing untracked files in repository..."
& git -C "$RepoDir" clean -xfd -f # to delete all untracked files in the main repo & git -C "$RepoDir" clean -xfd -f # to delete all untracked files in the main repo
if ($lastExitCode -ne "0") { if ($lastExitCode -ne "0") {
"'git clean' failed with exit code $lastExitCode, retrying once..." "'git clean' failed with exit code $lastExitCode, retrying once..."
@ -35,7 +35,7 @@ try {
if ($lastExitCode -ne "0") { throw "'git clean' failed with exit code $lastExitCode" } if ($lastExitCode -ne "0") { throw "'git clean' failed with exit code $lastExitCode" }
} }
"Step 4/4 - Cleaning Git submodules from untracked files..." "(4/4) Removing untracked files in submodules..."
& git -C "$RepoDir" submodule foreach --recursive git clean -xfd -f # to delete all untracked files in the submodules & git -C "$RepoDir" submodule foreach --recursive git clean -xfd -f # to delete all untracked files in the submodules
if ($lastExitCode -ne "0") { throw "'git clean' in the submodules failed with exit code $lastExitCode" } if ($lastExitCode -ne "0") { throw "'git clean' in the submodules failed with exit code $lastExitCode" }

View File

@ -22,29 +22,33 @@ param([string]$FullName = "", [string]$EmailAddress = "", [string]$FavoriteEdito
try { try {
$StopWatch = [system.diagnostics.stopwatch]::startNew() $StopWatch = [system.diagnostics.stopwatch]::startNew()
"⏳ Step 1/4 - Searching for Git executable..." Write-Host "⏳ (1/6) Searching for Git executable... " -noNewline
& git --version & git --version
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" } if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
"Step 2/4 - Input details..." "(2/6) Asking for details..."
if ($FullName -eq "") { $FullName = read-host "Enter your full name" } if ($FullName -eq "") { $FullName = read-host "Enter your full name" }
if ($EmailAddress -eq "") { $EmailAddress = read-host "Enter your e-mail address"} if ($EmailAddress -eq "") { $EmailAddress = read-host "Enter your e-mail address"}
if ($FavoriteEditor -eq "") { $FavoriteEditor = read-host "Enter your favorite text editor (emacs,nano,vi,vim,...)" } if ($FavoriteEditor -eq "") { $FavoriteEditor = read-host "Enter your favorite text editor (atom,emacs,nano,subl,vi,vim,...)" }
"Step 3/4 - Saving basic settings (name,email,editor,symlinks,etc.)..." "(3/6) Saving personal settings (name,email,editor)..."
& git config --global user.name $FullName & git config --global user.name $FullName
& git config --global user.email $EmailAddress & git config --global user.email $EmailAddress
& git config --global core.editor $FavoriteEditor & git config --global core.editor $FavoriteEditor
& git config --global core.autocrlf false
& git config --global core.symlinks true
& git config --global core.longpaths true
& git config --global http.sslVerify false
& git config --global init.defaultBranch main
& git config --global merge.renamelimit 99999
& git config --global pull.rebase false
if ($lastExitCode -ne "0") { throw "'git config' failed with exit code $lastExitCode" } if ($lastExitCode -ne "0") { throw "'git config' failed with exit code $lastExitCode" }
"Step 4/4 - Saving basic shortcuts (co,br,ci,st,pl,ps,mrg,chp,ls,smu)..." "(4/6) Saving basic settings (autocrlf,symlinks,longpaths,etc.)..."
& git config --global core.autocrlf false # don't change newlines
& git config --global core.symlinks true # enable support for symbolic link files
& git config --global core.longpaths true # enable support for long file paths
& git config --global http.sslVerify false
& git config --global init.defaultBranch main # set the default branch name to 'main'
& git config --global merge.renamelimit 99999
& git config --global pull.rebase false
& git config --global fetch.parallel 0 # enable parallel fetching to improve the speed
if ($lastExitCode -ne "0") { throw "'git config' failed with exit code $lastExitCode" }
"⏳ (5/6) Saving shortcuts (git co, git br, etc.)..."
& git config --global alias.co "checkout" & git config --global alias.co "checkout"
& git config --global alias.br "branch" & git config --global alias.br "branch"
& git config --global alias.ci "commit" & git config --global alias.ci "commit"
@ -57,11 +61,12 @@ try {
& git config --global alias.smu "submodule update --init" & git config --global alias.smu "submodule update --init"
if ($lastExitCode -ne "0") { throw "'git config' failed" } if ($lastExitCode -ne "0") { throw "'git config' failed" }
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds "⏳ (6/6) Listing your Git settings..."
"✔️ saved your Git configuration in $Elapsed sec, it's now:"
& git config --list & git config --list
if ($lastExitCode -ne "0") { throw "'git config --list' failed with exit code $lastExitCode" } if ($lastExitCode -ne "0") { throw "'git config --list' failed with exit code $lastExitCode" }
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"✔️ configured Git in $Elapsed sec."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber)): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber)): $($Error[0])"

View File

@ -1,4 +1,4 @@
<# <#
.SYNOPSIS .SYNOPSIS
Converts a .CSV file into a text file Converts a .CSV file into a text file
.DESCRIPTION .DESCRIPTION

View File

@ -0,0 +1,99 @@
<#
.SYNOPSIS
Convert-ImageToAscii
.DESCRIPTION
Converts an image to ASCII art.
.EXAMPLE
Convert-ImageToAscii -InFile "C:\Folder\Image.jpg" -Width 32 -Height 32
.INPUTS
.OUTPUTS
.NOTES
Author: Fxbyy
.FUNCTIONALITY
Converts an image to ASCII art.
#>
function Convert-ImageToAscii {
[CmdletBinding(DefaultParameterSetName = 'AutoSize')]
param (
[Parameter(Mandatory = $true)]
[string] $InFile,
[Parameter(Mandatory = $false, ParameterSetName = 'CustomSize')]
[int] $Width,
[Parameter(Mandatory = $false, ParameterSetName = 'CustomSize')]
[int] $Height,
[Parameter(Mandatory = $false)]
[switch] $Invert
)
begin {
$tempFile = "$PSScriptRoot\temp.jpg"
[void][System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
$img = [System.Drawing.Image]::FromFile((Get-Item $InFile))
if ($PSCmdlet.ParameterSetName -eq 'AutoSize') {
[int]$Height = $Host.UI.RawUI.WindowSize.Height * ($img.Size.Width / $img.Size.Height)
[int]$Width = $Height * ($img.Size.Width / $img.Size.Height)
} else {
if ($null -eq $Height -or $Height -eq 0) {
[int]$Height = $Width * ($img.Size.Height / $img.Size.Width)
} elseif ($null -eq $Width -or $Width -eq 0) {
[int]$Width = $Height * ($img.Size.Width / $img.Size.Height)
}
}
}
process {
$bmp = New-Object System.Drawing.Bitmap($Width, $Height)
$graph = [System.Drawing.Graphics]::FromImage($bmp)
$graph.DrawImage($img, 0, 0, $Width, $Height)
$graph.Dispose()
$img.Dispose()
if ($Invert) {
$symbols = " .,:~+t?xmoX#M%@"
} else {
$symbols = "@%M#Xomx?t+~:,. "
}
$res = ""
foreach ($h in 1..$bmp.Height) {
foreach ($w in 1..$bmp.Width) {
$px = $bmp.GetPixel($w - 1, $h - 1)
$brightness = (0.2126 * $px.R + 0.7152 * $px.G + 0.0722 * $px.B)
if ($brightness -le 15) { $res += $symbols[0] + " " }
elseif ($brightness -le 31) { $res += $symbols[1] + " " }
elseif ($brightness -le 47) { $res += $symbols[2] + " " }
elseif ($brightness -le 63) { $res += $symbols[3] + " " }
elseif ($brightness -le 79) { $res += $symbols[4] + " " }
elseif ($brightness -le 95) { $res += $symbols[5] + " " }
elseif ($brightness -le 111) { $res += $symbols[6] + " " }
elseif ($brightness -le 127) { $res += $symbols[7] + " " }
elseif ($brightness -le 143) { $res += $symbols[8] + " " }
elseif ($brightness -le 159) { $res += $symbols[9] + " " }
elseif ($brightness -le 175) { $res += $symbols[10] + " " }
elseif ($brightness -le 191) { $res += $symbols[11] + " " }
elseif ($brightness -le 207) { $res += $symbols[12] + " " }
elseif ($brightness -le 223) { $res += $symbols[13] + " " }
elseif ($brightness -le 249) { $res += $symbols[14] + " " }
else { $res += $symbols[15] + " " }
}
$res += "`n"
}
}
end {
$BitMap.Dispose()
Remove-Item $tempFile -Force
$res
}
}

View File

@ -1,6 +1,6 @@
<# <#
.SYNOPSIS .SYNOPSIS
Disconnect VPN Disconnects the VPN
.DESCRIPTION .DESCRIPTION
This PowerShell script disconnects the active VPN connection. This PowerShell script disconnects the active VPN connection.
.EXAMPLE .EXAMPLE

View File

@ -119,7 +119,7 @@ try {
$StopWatch = [system.diagnostics.stopwatch]::startNew() $StopWatch = [system.diagnostics.stopwatch]::startNew()
$PasswordBase64 = [System.Convert]::ToBase64String($Password) $PasswordBase64 = [System.Convert]::ToBase64String($Password)
EnryptFile "$Path" -Algorithm AES -KeyAsPlainText $PasswordBase64 -RemoveSource EncryptFile "$Path" -Algorithm AES -KeyAsPlainText $PasswordBase64 -RemoveSource
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds [int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"✔️ file encrypted in $Elapsed sec" "✔️ file encrypted in $Elapsed sec"

View File

@ -27,7 +27,7 @@ try {
if (-not(Test-Path "$ParentDir" -pathType container)) { throw "Can't access folder: $ParentDir" } if (-not(Test-Path "$ParentDir" -pathType container)) { throw "Can't access folder: $ParentDir" }
$Folders = (Get-ChildItem "$ParentDir" -attributes Directory) $Folders = (Get-ChildItem "$ParentDir" -attributes Directory)
$NumFolders = $Folders.Count $NumFolders = $Folders.Count
"Found $NumFolders subfolders." "Found $NumFolders subfolders, fetching one by one..."
[int]$Step = 3 [int]$Step = 3
foreach ($Folder in $Folders) { foreach ($Folder in $Folders) {
@ -41,7 +41,7 @@ try {
} }
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds [int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"✔️ fetched $NumFolders Git repos at 📂$ParentDirName in $Elapsed sec" "✔️ fetched $NumFolders Git repos in 📂$ParentDirName, it took $Elapsed sec"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -20,6 +20,6 @@ try {
"Audacity installed successfully." "Audacity installed successfully."
exit 0 # success exit 0 # success
} catch { } catch {
"Sorry: $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -18,12 +18,13 @@ try {
"⏳ Step 1 - Loading table from Data/basic-apps.csv..." "⏳ Step 1 - Loading table from Data/basic-apps.csv..."
$Table = Import-CSV "$PSScriptRoot/../Data/basic-apps.csv" $Table = Import-CSV "$PSScriptRoot/../Data/basic-apps.csv"
$NumEntries = $Table.count $NumEntries = $Table.count
Write-Host " I will install: " -NoNewline Write-Host " About to install $NumEntries apps: " -NoNewline
foreach($Row in $Table) { foreach($Row in $Table) {
[string]$AppName = $Row.AppName [string]$AppName = $Row.AppName
Write-Host "$AppName, " -NoNewline Write-Host "$AppName, " -NoNewline
} }
"" ""
"Press <Control> <C> to abort, otherwise the installation will start..."
sleep -s 3 sleep -s 3
[int]$Step = 2 [int]$Step = 2
@ -38,7 +39,7 @@ try {
$Step++ $Step++
} }
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds [int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"✔️ installed $NumEntries basic apps in $Elapsed sec" "✔️ installed $NumEntries apps in $Elapsed sec"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -1,4 +1,4 @@
<# <#
.SYNOPSIS .SYNOPSIS
Installs Chocolatey (needs admin rights) Installs Chocolatey (needs admin rights)
.DESCRIPTION .DESCRIPTION
@ -18,6 +18,6 @@ try {
iwr https://community.chocolatey.org/install.ps1 -UseBasicParsing | iex iwr https://community.chocolatey.org/install.ps1 -UseBasicParsing | iex
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -1,4 +1,4 @@
<# <#
.SYNOPSIS .SYNOPSIS
Installs Chrome Installs Chrome
.DESCRIPTION .DESCRIPTION
@ -20,6 +20,6 @@ try {
"Google Chrome installed successfully." "Google Chrome installed successfully."
exit 0 # success exit 0 # success
} catch { } catch {
"Sorry: $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -1,4 +1,4 @@
<# <#
.SYNOPSIS .SYNOPSIS
Installs CrystalDiskInfo Installs CrystalDiskInfo
.DESCRIPTION .DESCRIPTION
@ -20,6 +20,6 @@ try {
"CrystalDiskInfo installed successfully." "CrystalDiskInfo installed successfully."
exit 0 # success exit 0 # success
} catch { } catch {
"Sorry: $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -1,4 +1,4 @@
<# <#
.SYNOPSIS .SYNOPSIS
Installs CrystalDiskMark Installs CrystalDiskMark
.DESCRIPTION .DESCRIPTION
@ -20,6 +20,6 @@ try {
"CrystalDiskMark installed successfully." "CrystalDiskMark installed successfully."
exit 0 # success exit 0 # success
} catch { } catch {
"Sorry: $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -1,4 +1,4 @@
<# <#
.SYNOPSIS .SYNOPSIS
Installs Discord Installs Discord
.DESCRIPTION .DESCRIPTION
@ -20,6 +20,6 @@ try {
"Discord installed successfully." "Discord installed successfully."
exit 0 # success exit 0 # success
} catch { } catch {
"Sorry: $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -1,4 +1,4 @@
<# <#
.SYNOPSIS .SYNOPSIS
Installs Microsoft Edge Installs Microsoft Edge
.DESCRIPTION .DESCRIPTION
@ -20,6 +20,6 @@ try {
"Microsoft Edge installed successfully." "Microsoft Edge installed successfully."
exit 0 # success exit 0 # success
} catch { } catch {
"Sorry: $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -1,4 +1,4 @@
<# <#
.SYNOPSIS .SYNOPSIS
Installs Mozilla Firefox Installs Mozilla Firefox
.DESCRIPTION .DESCRIPTION
@ -20,6 +20,6 @@ try {
"Firefox installed successfully." "Firefox installed successfully."
exit 0 # success exit 0 # success
} catch { } catch {
"Sorry: $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -1,4 +1,4 @@
<# <#
.SYNOPSIS .SYNOPSIS
Installs Git Extensions Installs Git Extensions
.DESCRIPTION .DESCRIPTION
@ -20,6 +20,6 @@ try {
"Git Extensions installed successfully." "Git Extensions installed successfully."
exit 0 # success exit 0 # success
} catch { } catch {
"Sorry: $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -20,6 +20,6 @@ try {
"Git for Windows installed successfully." "Git for Windows installed successfully."
exit 0 # success exit 0 # success
} catch { } catch {
"Sorry: $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -1,4 +1,4 @@
<# <#
.SYNOPSIS .SYNOPSIS
Installs IrfanView Installs IrfanView
.DESCRIPTION .DESCRIPTION
@ -20,6 +20,6 @@ try {
"IrfanView installed successfully." "IrfanView installed successfully."
exit 0 # success exit 0 # success
} catch { } catch {
"Sorry: $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -1,4 +1,4 @@
<# <#
.SYNOPSIS .SYNOPSIS
Installs Microsoft Teams Installs Microsoft Teams
.DESCRIPTION .DESCRIPTION
@ -20,6 +20,6 @@ try {
"Microsoft Teams installed successfully." "Microsoft Teams installed successfully."
exit 0 # success exit 0 # success
} catch { } catch {
"Sorry: $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -1,4 +1,4 @@
<# <#
.SYNOPSIS .SYNOPSIS
Installs Netflix Installs Netflix
.DESCRIPTION .DESCRIPTION
@ -20,6 +20,6 @@ try {
"Netflix installed successfully." "Netflix installed successfully."
exit 0 # success exit 0 # success
} catch { } catch {
"Sorry: $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -20,6 +20,6 @@ try {
"9 Zip installed successfuly." "9 Zip installed successfuly."
exit 0 # success exit 0 # success
} catch { } catch {
"Sorry: $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -1,4 +1,4 @@
<# <#
.SYNOPSIS .SYNOPSIS
Installs One Calendar Installs One Calendar
.DESCRIPTION .DESCRIPTION
@ -20,6 +20,6 @@ try {
"One Calendar installed successfully." "One Calendar installed successfully."
exit 0 # success exit 0 # success
} catch { } catch {
"Sorry: $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -1,4 +1,4 @@
<# <#
.SYNOPSIS .SYNOPSIS
Installs Opera Browser Installs Opera Browser
.DESCRIPTION .DESCRIPTION
@ -20,6 +20,6 @@ try {
"Opera Browser installed successfully." "Opera Browser installed successfully."
exit 0 # success exit 0 # success
} catch { } catch {
"Sorry: $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -20,6 +20,6 @@ try {
"Opera GX installed successfully." "Opera GX installed successfully."
exit 0 # success exit 0 # success
} catch { } catch {
"Sorry: $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -1,4 +1,4 @@
<# <#
.SYNOPSIS .SYNOPSIS
Installs Paint 3D Installs Paint 3D
.DESCRIPTION .DESCRIPTION
@ -20,6 +20,6 @@ try {
"Paint 3D installed successfully." "Paint 3D installed successfully."
exit 0 # success exit 0 # success
} catch { } catch {
"Sorry: $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -1,4 +1,4 @@
<# <#
.SYNOPSIS .SYNOPSIS
Installs Microsoft Powertoys Installs Microsoft Powertoys
.DESCRIPTION .DESCRIPTION
@ -20,6 +20,6 @@ try {
"Microsoft Powertoys installed successfully." "Microsoft Powertoys installed successfully."
exit 0 # success exit 0 # success
} catch { } catch {
"Sorry: $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -1,4 +1,4 @@
<# <#
.SYNOPSIS .SYNOPSIS
Installs Rufus Installs Rufus
.DESCRIPTION .DESCRIPTION
@ -20,6 +20,6 @@ try {
"Rufus installed successfully." "Rufus installed successfully."
exit 0 # success exit 0 # success
} catch { } catch {
"Sorry: $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -20,6 +20,6 @@ try {
"Skype installed successfully." "Skype installed successfully."
exit 0 # success exit 0 # success
} catch { } catch {
"Sorry: $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -20,6 +20,6 @@ try {
"Spotify installed successfully." "Spotify installed successfully."
exit 0 # success exit 0 # success
} catch { } catch {
"Sorry: $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -11,7 +11,6 @@
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
#Requires -RunAsAdministrator
try { try {
$StopWatch = [system.diagnostics.stopwatch]::startNew() $StopWatch = [system.diagnostics.stopwatch]::startNew()
@ -29,11 +28,11 @@ try {
"⏳ Step 4/4 - Upgrading installed Snap packages..." "⏳ Step 4/4 - Upgrading installed Snap packages..."
& sudo snap refresh & sudo snap refresh
} else { } else {
"⏳ Step 1/2 - Checking for application updates..." "⏳ Step 1/2 - Fetching update infos..."
winget upgrade & winget upgrade
"⏳ Step 2/2 - Upgrading application..." "⏳ Step 2/2 - Upgrading apps..."
winget upgrade --all & winget upgrade --all
} }
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds [int]$Elapsed = $StopWatch.Elapsed.TotalSeconds

View File

@ -20,6 +20,6 @@ try {
"Visual Studio Code installed successfully." "Visual Studio Code installed successfully."
exit 0 # success exit 0 # success
} catch { } catch {
"Sorry: $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -1,4 +1,4 @@
<# <#
.SYNOPSIS .SYNOPSIS
Installs Vivaldi Installs Vivaldi
.DESCRIPTION .DESCRIPTION
@ -20,6 +20,6 @@ try {
"Vivaldi installed successfully." "Vivaldi installed successfully."
exit 0 # success exit 0 # success
} catch { } catch {
"Sorry: $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -1,4 +1,4 @@
<# <#
.SYNOPSIS .SYNOPSIS
Installs VLC Installs VLC
.DESCRIPTION .DESCRIPTION
@ -20,6 +20,6 @@ try {
"VLC media player installed successfully." "VLC media player installed successfully."
exit 0 # success exit 0 # success
} catch { } catch {
"Sorry: $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -1,4 +1,4 @@
<# <#
.SYNOPSIS .SYNOPSIS
Installs Windows Terminal Installs Windows Terminal
.DESCRIPTION .DESCRIPTION
@ -20,6 +20,6 @@ try {
"Windows Terminal installed successfully." "Windows Terminal installed successfully."
exit 0 # success exit 0 # success
} catch { } catch {
"Sorry: $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -1,4 +1,4 @@
<# <#
.SYNOPSIS .SYNOPSIS
Installs Zoom Installs Zoom
.DESCRIPTION .DESCRIPTION
@ -20,6 +20,6 @@ try {
"Zoom installed successfully." "Zoom installed successfully."
exit 0 # success exit 0 # success
} catch { } catch {
"Sorry: $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -2,9 +2,9 @@
.SYNOPSIS .SYNOPSIS
Lists the installed apps Lists the installed apps
.DESCRIPTION .DESCRIPTION
This PowerShell script lists the installed apps (from Windows Store or snaps). This PowerShell script lists the installed applications (from Windows Store, or Snap Store).
.EXAMPLE .EXAMPLE
PS> ./list-installed-apps PS> ./list-apps
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES

20
Scripts/list-bios.ps1 Normal file
View File

@ -0,0 +1,20 @@
<#
.SYNOPSIS
Lists BIOS details
.DESCRIPTION
This PowerShell script lists the BIOS details.
.EXAMPLE
PS> ./list-bios
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
Get-CimInstance -ClassName Win32_BIOS
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}

View File

@ -1,8 +1,8 @@
<# <#
.SYNOPSIS .SYNOPSIS
Lists all Bluetooth devices Lists Bluetooth devices
.DESCRIPTION .DESCRIPTION
This PowerShell script lists all Bluetooth devices. This PowerShell script lists all Bluetooth devices connected to the computer.
.EXAMPLE .EXAMPLE
PS> ./list-bluetooth-devices PS> ./list-bluetooth-devices
.LINK .LINK

View File

@ -1,24 +1,24 @@
<# <#
.SYNOPSIS .SYNOPSIS
Writes out a calendar Lists the calendar
.DESCRIPTION .DESCRIPTION
Writes out calendar elements, either a single month or an entire year. Lists calendar elements, either a single month or an entire year.
.PARAMETER Month .PARAMETER Month
If specified, will limit output to a single month with this numeral value. If specified, will limit output to a single month with this numeral value.
.PARAMETER Year .PARAMETER Year
If specified, will output an entire year. If specified, will output an entire year.
.EXAMPLE .EXAMPLE
PS> ./write-calendar PS> ./list-calendar
Outputs the current month. Lists the calendar for current month.
.EXAMPLE .EXAMPLE
PS> ./write-calendar 2013 PS> ./list-calendar 2013
Outputs the calendar for 2013. Lists the calendar for 2013.
.EXAMPLE .EXAMPLE
PS> ./write-calendar 04 2011 PS> ./list-calendar 04 2011
Outputs the calendar for April, 2011. Lists the calendar for April, 2011.
.EXAMPLE .EXAMPLE
PS> ./write-calendar 7 PS> ./list-calendar 7
Outputs the calendar for July of this year. Lists the calendar for July of this year.
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
@ -139,10 +139,8 @@ function Find-LastWeekDay ($year, $month, $dayOfWeek) {
if ($dayCounter.DayOfWeek -eq $dayOfWeek) { if ($dayCounter.DayOfWeek -eq $dayOfWeek) {
$result = $dayCounter $result = $dayCounter
} }
$dayCounter = $dayCounter.AddDays(1) $dayCounter = $dayCounter.AddDays(1)
} }
return $result return $result
} }

View File

@ -6,10 +6,9 @@
.EXAMPLE .EXAMPLE
PS> ./list-cli-tools PS> ./list-cli-tools
Name Version Location FileSize Name Version Path FileSize
---- ------- -------- -------- ---- ------- ---- --------
at 10.0.19041.1 C:\WINDOWS\system32\at.exe 31232 at 10.0.19041.1 C:\WINDOWS\system32\at.exe 31232
attrib 10.0.19041.1 C:\WINDOWS\system32\attrib.exe 23040
... ...
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
@ -20,10 +19,10 @@
function CheckFor { param([string]$Cmd, [string]$VersionArg) function CheckFor { param([string]$Cmd, [string]$VersionArg)
try { try {
$Info = Get-Command $Cmd -ErrorAction Stop $Info = Get-Command $Cmd -ErrorAction Stop
$Location = $Info.Source $Path = $Info.Source
if ("$($Info.Version)" -eq "0.0.0.0") { if ("$($Info.Version)" -eq "0.0.0.0") {
if ("$VersionArg" -ne "") { if ("$VersionArg" -ne "") {
$Result = invoke-expression "$Location $VersionArg" $Result = invoke-expression "$Path $VersionArg"
if ("$Result" -match '\d+.\d+\.\d+') { if ("$Result" -match '\d+.\d+\.\d+') {
$Version = "$($Matches[0])" $Version = "$($Matches[0])"
} elseif ("$Result" -match '\d+\.\d+') { } elseif ("$Result" -match '\d+\.\d+') {
@ -37,12 +36,12 @@ function CheckFor { param([string]$Cmd, [string]$VersionArg)
} else { } else {
$Version = $Info.Version $Version = $Info.Version
} }
if (Test-Path "$Location" -pathType leaf) { if (Test-Path "$Path" -pathType leaf) {
$FileSize = (Get-Item "$Location").Length $FileSize = (Get-Item "$Path").Length
} else { } else {
$FileSize = "0" $FileSize = "0"
} }
New-Object PSObject -Property @{ Name=$Cmd; Version=$Version; Location=$Location; FileSize=$FileSize } New-Object PSObject -Property @{ Name=$Cmd; Version=$Version; Path=$Path; FileSize=$FileSize }
} catch { } catch {
return return
} }
@ -56,76 +55,174 @@ function ListTools {
CheckFor amixer "--version" CheckFor amixer "--version"
CheckFor aplay "--version" CheckFor aplay "--version"
CheckFor ar "--version" CheckFor ar "--version"
CheckFor arch "--version"
CheckFor arecord "--version" CheckFor arecord "--version"
CheckFor arp ""
CheckFor at "" CheckFor at ""
CheckFor attrib "" CheckFor attrib ""
CheckFor awk "--version" CheckFor awk "--version"
CheckFor b2sum "--version"
CheckFor base32 "--version"
CheckFor base64 "--version"
CheckFor basename "--version" CheckFor basename "--version"
CheckFor basenc "--version"
CheckFor bash "--version" CheckFor bash "--version"
CheckFor bc "--version" CheckFor bc "--version"
CheckFor cc "--version" CheckFor bunzip2 "--version"
CheckFor bzcat "--version"
CheckFor bzip2 "--version"
CheckFor bzip2recover "--version"
CheckFor captoinfo "--version"
CheckFor cat "-version"
CheckFor cc "--version"
CheckFor chattr "--version"
CheckFor chcon "--version"
CheckFor chdsk "" CheckFor chdsk ""
CheckFor chgrp "--version"
CheckFor chmod "--version"
CheckFor chkntfs "" CheckFor chkntfs ""
CheckFor chown "--version"
CheckFor chroot "--version"
CheckFor choco "--version" CheckFor choco "--version"
CheckFor cipher "" CheckFor cipher ""
CheckFor cksum "--version" CheckFor cksum "--version"
CheckFor clang "--version" CheckFor clang "--version"
CheckFor clear "--version"
CheckFor cmake "--version" CheckFor cmake "--version"
CheckFor cmd "" CheckFor cmd ""
CheckFor cmp "--version"
CheckFor column "--version"
CheckFor comp "" CheckFor comp ""
CheckFor compact "" CheckFor compact ""
CheckFor cp "--version"
CheckFor cpack "--version" CheckFor cpack "--version"
CheckFor csplit "--version"
CheckFor ctest "--version" CheckFor ctest "--version"
CheckFor curl "--version" CheckFor curl "--version"
CheckFor cut "--version" CheckFor cut "--version"
CheckFor cygcheck "--version"
CheckFor cygpath "--version"
CheckFor d2u "--version"
CheckFor dash "--version"
CheckFor date "" CheckFor date ""
CheckFor dd "--version"
CheckFor df "--version"
CheckFor diff "--version" CheckFor diff "--version"
CheckFor diff3 "--version"
CheckFor dir "--version"
CheckFor dircolors "--version"
CheckFor dirname "--version"
CheckFor dism "" CheckFor dism ""
CheckFor dos2unix "--version"
CheckFor driverquery "" CheckFor driverquery ""
CheckFor du "--version"
CheckFor echo "--version"
CheckFor egrep "--version" CheckFor egrep "--version"
CheckFor env "--version"
CheckFor ex "--version"
CheckFor expand "--version"
CheckFor expr "--version"
CheckFor factor "--version"
CheckFor false "--version"
CheckFor fido2-assert "--version"
CheckFor fido2-cred "--version"
CheckFor fido2-token "--version"
CheckFor file "--version"
CheckFor find "--version" CheckFor find "--version"
CheckFor fgrep "--version" CheckFor fgrep "--version"
CheckFor fmt "--version"
CheckFor fold "--version"
CheckFor ftp "--version" CheckFor ftp "--version"
CheckFor funzip "--version"
CheckFor gawk "--version"
CheckFor gencat "--version"
CheckFor getconf "--version"
CheckFor getopt "--version"
CheckFor gettext "--version"
CheckFor gcc "--version" CheckFor gcc "--version"
CheckFor gdb "--version" CheckFor gdb "--version"
CheckFor gh "--version" CheckFor gh "--version"
CheckFor git "--version" CheckFor git "--version"
CheckFor gkill "--version"
CheckFor gmondump "--version"
CheckFor gpg "--version" CheckFor gpg "--version"
CheckFor gpg-agent "--version"
CheckFor gpgconf "--version"
CheckFor gpg-error "--version"
CheckFor gpgsplit "--version"
CheckFor gpgtar "--version"
CheckFor grep "--version"
CheckFor groups "--version"
CheckFor gzip "--version"
CheckFor head "--version"
CheckFor hcsdiag "" CheckFor hcsdiag ""
CheckFor help "--version" CheckFor help "--version"
CheckFor hmac256 "--version"
CheckFor hostid "--version"
CheckFor hostname "" CheckFor hostname ""
CheckFor htop "--version" CheckFor htop "--version"
CheckFor iconv "--version"
CheckFor id "--version"
CheckFor ipfs "--version" CheckFor ipfs "--version"
CheckFor java "--version" CheckFor java "--version"
CheckFor join "--version"
CheckFor kill "--version"
CheckFor ldd "--version"
CheckFor less "--version"
CheckFor link "--version"
CheckFor ln "--version"
CheckFor locale "--version"
CheckFor locate "--version"
CheckFor logname "--version"
CheckFor ls "--version"
CheckFor lsattr "--version"
CheckFor lsb_release "" CheckFor lsb_release ""
CheckFor lzma "--version" CheckFor lzma "--version"
CheckFor mac2unix "--version"
CheckFor make "--version" CheckFor make "--version"
CheckFor md5sum "--version" CheckFor md5sum "--version"
CheckFor minidumper "--version"
CheckFor mkdir "--version"
CheckFor mkfifo "--version" CheckFor mkfifo "--version"
CheckFor mkgroup "--version"
CheckFor mknod "--version"
CheckFor mkpasswd "--version"
CheckFor mktemp "--version"
CheckFor mount "--version" CheckFor mount "--version"
CheckFor MpCmdRun "-h" CheckFor MpCmdRun "-h"
CheckFor netsh ""
CheckFor netstat ""
CheckFor nice "--version" CheckFor nice "--version"
CheckFor nohup "--version"
CheckFor nroff "--version" CheckFor nroff "--version"
CheckFor nslookup "" CheckFor nslookup ""
CheckFor openssl "" CheckFor openssl ""
CheckFor passwd "--version"
CheckFor paste "--version"
CheckFor perl "--version" CheckFor perl "--version"
CheckFor ping "-V" CheckFor ping "-V"
CheckFor ping6 "-V" CheckFor ping6 "-V"
CheckFor pip "--version"
CheckFor pip3 "--version"
CheckFor pip3.8 "--version"
CheckFor powercfg "/?" CheckFor powercfg "/?"
CheckFor powershell "--version" CheckFor powershell "--version"
CheckFor print "" CheckFor print ""
CheckFor printf "--version" CheckFor printf "--version"
CheckFor python "--version" CheckFor python "--version"
CheckFor python3 "--version" CheckFor python3 "--version"
CheckFor python3.8 "--version"
CheckFor rasdial "--version" CheckFor rasdial "--version"
CheckFor regedit "--version" CheckFor regedit "--version"
CheckFor replace "--version" CheckFor replace "--version"
CheckFor robocopy "--version" CheckFor robocopy "--version"
CheckFor route ""
CheckFor rsh "" CheckFor rsh ""
CheckFor rsync "--version" CheckFor rsync "--version"
CheckFor rundll32 "--version" CheckFor rundll32 "--version"
CheckFor scp "" CheckFor scp ""
CheckFor sftp "" CheckFor sftp ""
CheckFor sh "--version"
CheckFor sha1sum "--version" CheckFor sha1sum "--version"
CheckFor sha256sum "--version" CheckFor sha256sum "--version"
CheckFor sha512sum "--version" CheckFor sha512sum "--version"
@ -178,7 +275,7 @@ function ListTools {
} }
try { try {
ListTools | Format-Table -property @{e='Name';width=12},@{e='Version';width=15},@{e='Location';width=55},@{e='FileSize';width=10} ListTools | Format-Table -property @{e='Name';width=12},@{e='Version';width=15},@{e='Path';width=70},@{e='FileSize';width=10}
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -18,17 +18,22 @@
param([string]$RepoDir = "$PWD") param([string]$RepoDir = "$PWD")
try { try {
"⏳ Step 1/3: Checking requirements..." Write-Progress "⏳ Step 1/4 - Searching for Git executable..."
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" } $null = (git --version)
$Null = (git --version)
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" } if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
"⏳ Step 2/3: Fetching updates..." $RepoDirName = (Get-Item "$RepoDir").Name
Write-Progress "⏳ Step 2/4 - Checking folder 📂$RepoDirName..."
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
Write-Progress "⏳ Step 3/4 - Fetching updates..."
& git -C "$RepoDir" fetch --all --quiet & git -C "$RepoDir" fetch --all --quiet
if ($lastExitCode -ne "0") { throw "'git fetch' failed with exit code $lastExitCode" } if ($lastExitCode -ne "0") { throw "'git fetch' failed with exit code $lastExitCode" }
"⏳ Step 3/3: Listing commits without merges..." Write-Progress "⏳ Step 4/4 - Querying commits..."
" "
"Commits Author"
"------- ------"
git -C "$RepoDir" shortlog --summary --numbered --email --no-merges git -C "$RepoDir" shortlog --summary --numbered --email --no-merges
if ($lastExitCode -ne "0") { throw "'git shortlog' failed with exit code $lastExitCode" } if ($lastExitCode -ne "0") { throw "'git shortlog' failed with exit code $lastExitCode" }
exit 0 # success exit 0 # success

20
Scripts/list-cpu.ps1 Normal file
View File

@ -0,0 +1,20 @@
<#
.SYNOPSIS
Lists CPU details
.DESCRIPTION
This PowerShell script lists the CPU details.
.EXAMPLE
PS> ./list-cpu
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
Get-WmiObject -Class Win32_Processor
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}

View File

@ -1,8 +1,8 @@
<# <#
.SYNOPSIS .SYNOPSIS
Lists the current crypto exchange rates Lists crypto exchange rates
.DESCRIPTION .DESCRIPTION
This PowerShell script lists the current crypto exchange rates. This PowerShell script queries and lists the current crypto exchange rates from cryptocompare.com.
.EXAMPLE .EXAMPLE
PS> ./list-crypto-rates PS> ./list-crypto-rates
.LINK .LINK
@ -12,39 +12,38 @@
#> #>
function ListCryptoRate { param([string]$Symbol, [string]$Name) function ListCryptoRate { param([string]$Symbol, [string]$Name)
$Rates = (invoke-webRequest -uri "https://min-api.cryptocompare.com/data/price?fsym=$Symbol&tsyms=USD,EUR,RUB,CNY" -userAgent "curl" -useBasicParsing).Content | ConvertFrom-Json $Rates = (Invoke-WebRequest -URI "https://min-api.cryptocompare.com/data/price?fsym=$Symbol&tsyms=USD,EUR,RUB,CNY" -userAgent "curl" -useBasicParsing).Content | ConvertFrom-Json
new-object PSObject -property @{ 'Cryptocurrency' = "1 $Name ($Symbol) ="; 'USD' = "$($Rates.USD)"; 'EUR' = "$($Rates.EUR)"; 'RUB' = "$($Rates.RUB)"; 'CNY' = "$($Rates.CNY)" } New-Object PSObject -property @{ 'Cryptocurrency' = "1 $Name ($Symbol) ="; 'USD' = "$($Rates.USD)"; 'EUR' = "$($Rates.EUR)"; 'RUB' = "$($Rates.RUB)"; 'CNY' = "$($Rates.CNY)" }
} }
function ListCryptoRates { function ListCryptoRates {
ListCryptoRate BTC "Bitcoin" ListCryptoRate BTC "Bitcoin"
ListCryptoRate ETH "Ethereum" ListCryptoRate ETH "Ethereum"
ListCryptoRate ADA "Cardano" ListCryptoRate ADA "Cardano"
ListCryptoRate BNB "Binance Coin" ListCryptoRate BNB "Binance Coin"
ListCryptoRate USDT "Tether" ListCryptoRate USDT "Tether"
ListCryptoRate XRP "XRP" ListCryptoRate XRP "XRP"
ListCryptoRate DOGE "Dogecoin" ListCryptoRate DOGE "Dogecoin"
ListCryptoRate USDC "USD Coin" ListCryptoRate USDC "USD Coin"
ListCryptoRate DOT "Polkadot" ListCryptoRate DOT "Polkadot"
ListCryptoRate SOL "Solana" ListCryptoRate SOL "Solana"
ListCryptoRate UNI "Uniswap" ListCryptoRate UNI "Uniswap"
ListCryptoRate BUSD "Binance USD" ListCryptoRate BUSD "Binance USD"
ListCryptoRate BCH "Bitcoin Cash" ListCryptoRate BCH "Bitcoin Cash"
ListCryptoRate LTC "Litecoin" ListCryptoRate LTC "Litecoin"
ListCryptoRate LINK "Chainlink" ListCryptoRate LINK "Chainlink"
ListCryptoRate LUNA "Terra" ListCryptoRate LUNA "Terra"
ListCryptoRate ICP "Internet Computer" ListCryptoRate ICP "Internet Computer"
ListCryptoRate WBTC "Wrapped Bitcoin" ListCryptoRate WBTC "Wrapped Bitcoin"
ListCryptoRate MATIC "Polygon" ListCryptoRate MATIC "Polygon"
ListCryptoRate XLM "Stellar" ListCryptoRate XLM "Stellar"
} }
try { try {
"" " "
"Current Crypto Exchange Rates (source: cryptocompare.com)" "Current Crypto Exchange Rates by cryptocompare.com"
"=============================" "=================================================="
ListCryptoRates | Format-Table -property @{e='Cryptocurrency';width=28},USD,EUR,RUB,CNY
ListCryptoRates | format-table -property @{e='Cryptocurrency';width=28},USD,EUR,RUB,CNY
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -1,8 +1,8 @@
<# <#
.SYNOPSIS .SYNOPSIS
Lists the full directory tree Lists the directory tree content
.DESCRIPTION .DESCRIPTION
This PowerShell script lists the full directory tree. This PowerShell script lists all files and folders in a directory tree.
.PARAMETER DirTree .PARAMETER DirTree
Specifies the path to the directory tree Specifies the path to the directory tree
.EXAMPLE .EXAMPLE
@ -17,21 +17,17 @@ param([string]$DirTree = "$PWD")
function ListDir { param([string]$Directory, [int]$Depth) function ListDir { param([string]$Directory, [int]$Depth)
$Depth++ $Depth++
$Items = get-childItem -path $Directory $Items = Get-ChildItem -path $Directory
foreach ($Item in $Items) { foreach($Item in $Items) {
$Filename = $Item.Name $Filename = $Item.Name
for ($i = 1; $i -lt $Depth; $i++) { Write-Host "" -noNewline }
if ($Item.Mode -like "d*") { if ($Item.Mode -like "d*") {
for ($i = 0; $i -lt $Depth; $i++) { Write-Host "├─" -noNewline
write-host -nonewline "+--" Write-Host -foregroundColor green "📂$Filename"
}
write-host -foregroundColor green "📂$Filename"
ListDir "$Directory\$Filename" $Depth ListDir "$Directory\$Filename" $Depth
$global:Dirs++ $global:Dirs++
} else { } else {
for ($i = 1; $i -lt $Depth; $i++) { Write-Host "$Filename ($($Item.Length) bytes)"
write-host -nonewline "| "
}
write-host "|-$Filename ($($Item.Length) bytes)"
$global:Files++ $global:Files++
$global:Bytes += $Item.Length $global:Bytes += $Item.Length
} }
@ -43,7 +39,7 @@ try {
[int]$global:Files = 0 [int]$global:Files = 0
[int]$global:Bytes = 0 [int]$global:Bytes = 0
ListDir $DirTree 0 ListDir $DirTree 0
write-host "($($global:Dirs) directories, $($global:Files) files, $($global:Bytes) bytes total)" "($($global:Dirs) folders, $($global:Files) files, $($global:Bytes) bytes total)"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -1,4 +1,4 @@
<# <#
.SYNOPSIS .SYNOPSIS
Lists the Fibonacci numbers Lists the Fibonacci numbers
.DESCRIPTION .DESCRIPTION

View File

@ -0,0 +1,20 @@
<#
.SYNOPSIS
Lists motherboard details
.DESCRIPTION
This PowerShell script lists the motherboard details.
.EXAMPLE
PS> ./list-motherboard
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
Get-WmiObject -Class Win32_BaseBoard
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}

View File

@ -0,0 +1,20 @@
<#
.SYNOPSIS
Lists network routes
.DESCRIPTION
This PowerShell script lists the network routes on the local computer.
.EXAMPLE
PS> ./list-network-routes
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
& route print
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}

View File

@ -1,10 +1,10 @@
<# <#
.SYNOPSIS .SYNOPSIS
Lists the latest news Lists the news
.DESCRIPTION .DESCRIPTION
This PowerShell script lists the latest RSS feed news. This PowerShell script lists the latest news by using RSS (Really Simple Syndication) feeds.
.PARAMETER RSS_URL .PARAMETER RSS_URL
Specifies the URL to the RSS feed Specifies the URL to the RSS feed (Yahoo News by default)
.PARAMETER MaxCount .PARAMETER MaxCount
Specifies the number of lines to list (20 by default) Specifies the number of lines to list (20 by default)
.EXAMPLE .EXAMPLE
@ -20,11 +20,13 @@ param([string]$RSS_URL = "https://yahoo.com/news/rss/world", [int]$MaxCount = 20
try { try {
[xml]$Content = (Invoke-WebRequest -URI $RSS_URL -useBasicParsing).Content [xml]$Content = (Invoke-WebRequest -URI $RSS_URL -useBasicParsing).Content
[int]$Count = 1 [int]$Count = 1
foreach ($item in $Content.rss.channel.item) { foreach ($Item in $Content.rss.channel.item) {
"$($item.title)" & "$PSScriptRoot/write-typewriter.ps1" "$($Item.title)" 20 # ms speed
if ($Count++ -eq $MaxCount) { break } if ($Count++ -eq $MaxCount) { break }
} }
" Source: 🌍 $($Content.rss.channel.title) 🌍" $Source = $Content.rss.channel.title
$Date = $Content.rss.channel.pubDate
" By *$($Source)* as of $Date"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

20
Scripts/list-nic.ps1 Normal file
View File

@ -0,0 +1,20 @@
<#
.SYNOPSIS
Lists NIC details
.DESCRIPTION
This PowerShell script lists the details of the installed network interfaces.
.EXAMPLE
PS> ./list-nic
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
Get-WmiObject -Class Win32_NetworkAdapterConfiguration | Format-Table -property ServiceName,Description,IPAddress,DHCPEnabled -AutoSize
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}

28
Scripts/list-os.ps1 Normal file
View File

@ -0,0 +1,28 @@
<#
.SYNOPSIS
Lists the operating system version
.DESCRIPTION
This PowerShell script lists the exact operating system version.
.EXAMPLE
PS> ./list-os
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
if ($IsLinux) {
"🐧(uname -sr)"
} else {
$OS = Get-WmiObject -class Win32_OperatingSystem
$OSname = $OS.Caption
$OSarchitecture = $OS.OSArchitecture
$OSversion = $OS.Version
"🌐$OSname for $OSarchitecture version $OSversion"
}
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}

20
Scripts/list-ram.ps1 Normal file
View File

@ -0,0 +1,20 @@
<#
.SYNOPSIS
Lists RAM details
.DESCRIPTION
This PowerShell script lists the details of the installed RAM.
.EXAMPLE
PS> ./list-ram
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
Get-WmiObject -Class Win32_PhysicalMemory
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}

View File

@ -0,0 +1,62 @@
<#
.SYNOPSIS
Lists special folders
.DESCRIPTION
This PowerShell script lists the special folders (sorted alphabetically).
.EXAMPLE
PS> ./list-special-folders
Folder Name Folder Path
----------- -----------
AdminTools 📂C:\Users\Markus\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Administrative Tools
...
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
function GetTempDir {
if ("$env:TEMP" -ne "") { return "$env:TEMP" }
if ("$env:TMP" -ne "") { return "$env:TMP" }
if ($IsLinux) { return "/tmp" }
return "C:\Temp"
}
function AddLine { param([string]$FolderName, [string]$FolderPath)
New-Object PSObject -property @{ 'Folder Name' = "$FolderName"; 'Folder Path' = "📂$FolderPath" }
}
function ListSpecialFolders {
if ($IsLinux) {
AddLine "Desktop" "$HOME/Desktop"
AddLine "Downloads" "$HOME/Downloads"
AddLine "Home Folder" "$HOME"
AddLine "MyDocuments" "$HOME/Documents"
AddLine "MyMusic" "$HOME/Music"
AddLine "MyPictures" "$HOME/Pictures"
AddLine "MyScreenshots" "$HOME/Pictures/Screenshots"
AddLine "MyVideos" "$HOME/Videos"
AddLine "Temporary Folder" "$(GetTempDir)"
$Path = Resolve-Path "$HOME/.."
AddLine "Users" "$Path"
} else {
$FolderNames = [System.Enum]::GetNames('System.Environment+SpecialFolder')
$FolderNames | Sort-Object | ForEach-Object {
if ($Path = [System.Environment]::GetFolderPath($_)) {
AddLine "$_" "$Path"
}
}
AddLine "TemporaryFolder" "$(GetTempDir)"
$Path = Resolve-Path "$HOME/.."
AddLine "Users" "$Path"
}
}
try {
ListSpecialFolders | Format-Table -property @{e='Folder Name';width=22},'Folder Path'
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}

View File

@ -0,0 +1,30 @@
<#
.SYNOPSIS
Lists suggestions
.DESCRIPTION
This PowerShell script lists "Did you mean?" suggestions from Google.
.EXAMPLE
PS> ./list-suggestions Joe
joe biden
joe cocker
...
.PARAMETER text
Specifies the word or sentence to get suggestions for.
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
param([string]$text = "")
try {
if ("$text" -eq "") { $text = read-host "Enter a word or sentence to get suggestions for" }
$URI = [uri]::escapeuristring("suggestqueries.google.com/complete/search?client=firefox&q=$text")
$Content = (Invoke-WebRequest -URI $URI -useBasicParsing).Content
($Content | ConvertFrom-Json).SyncRoot | Select-Object -Skip 1
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}

View File

@ -1,6 +1,6 @@
<# <#
.SYNOPSIS .SYNOPSIS
Lists the details of the current time zone Lists time zone details
.DESCRIPTION .DESCRIPTION
This PowerShell script lists the details of the current time zone. This PowerShell script lists the details of the current time zone.
.EXAMPLE .EXAMPLE
@ -19,7 +19,8 @@
#> #>
try { try {
get-timezone [system.threading.thread]::currentThread.currentCulture = [system.globalization.cultureInfo]"en-US"
Get-Timezone
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -0,0 +1,20 @@
<#
.SYNOPSIS
Lists user accounts
.DESCRIPTION
This PowerShell script lists the user accounts on the local computer.
.EXAMPLE
PS> ./list-user-accounts
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
& net user
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}

20
Scripts/list-wifi.ps1 Normal file
View File

@ -0,0 +1,20 @@
<#
.SYNOPSIS
Lists WIFI
.DESCRIPTION
This PowerShell script lists the WIFI networks.
.EXAMPLE
PS> ./list-wifi
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
& netsh wlan show profile
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}

View File

@ -1,4 +1,4 @@
<# <#
.SYNOPSIS .SYNOPSIS
Locks the desktop Locks the desktop
.DESCRIPTION .DESCRIPTION

View File

@ -1,4 +1,4 @@
<# <#
.SYNOPSIS .SYNOPSIS
Minimizes all windows Minimizes all windows
.DESCRIPTION .DESCRIPTION

View File

@ -1,4 +1,4 @@
<# <#
.SYNOPSIS .SYNOPSIS
Opens the VPN settings Opens the VPN settings
.DESCRIPTION .DESCRIPTION

View File

@ -24,26 +24,25 @@ try {
$StopWatch = [system.diagnostics.stopwatch]::startNew() $StopWatch = [system.diagnostics.stopwatch]::startNew()
"Step 1/3: Searching for IPFS executable..." Write-Host "(1/3) Searching for IPFS executable..." -NoNewline
& ipfs --version & ipfs --version
if ($lastExitCode -ne "0") { throw "Can't execute 'ipfs' - make sure IPFS is installed and available" } if ($lastExitCode -ne "0") { throw "Can't execute 'ipfs' - make sure IPFS is installed and available" }
if (test-path "$FilePattern" -pathType container) { if (test-path "$FilePattern" -pathType container) {
"" "⏳ (2/3) Publishing folder $FilePattern/..."
"⏳ Step 2/3: Publishing folder $FilePattern/..."
& ipfs add -r "$FilePattern" > $HashList & ipfs add -r "$FilePattern" > $HashList
[int]$Count = 1 [int]$Count = 1
"" ""
"Step 3/3: Calculating digital forensics hashes to $DF_HASHES ..." "(3/3) Calculating digital forensics hashes to $DF_HASHES ..."
& nice hashdeep -c md5,sha1,sha256 -r -d -l -j 1 "$FilePattern" > $DF_Hashes & nice hashdeep -c md5,sha1,sha256 -r -d -l -j 1 "$FilePattern" > $DF_Hashes
} else { } else {
$FileList = (get-childItem "$FilePattern") $FileList = (get-childItem "$FilePattern")
foreach ($File in $FileList) { foreach ($File in $FileList) {
if (test-path "$FilePattern" -pathType container) { if (test-path "$FilePattern" -pathType container) {
"Step 2/3: Publishing folder $File/..." "(2/3) Publishing folder $File/..."
& ipfs add -r "$File" >> $HashList & ipfs add -r "$File" >> $HashList
} else { } else {
"Step 3/3: Publishing file $File..." "(3/3) Publishing file $File..."
& ipfs add "$File" >> $HashList & ipfs add "$File" >> $HashList
} }
} }

View File

@ -1,10 +1,10 @@
<# <#
.SYNOPSIS .SYNOPSIS
Pulls Git repository updates Pulls repository updates
.DESCRIPTION .DESCRIPTION
This PowerShell script pulls updates for a local Git repository (including submodules). This PowerShell script pulls updates for a local Git repository (including submodules).
.PARAMETER RepoDir .PARAMETER RepoDir
Specifies the path to the Git repository Specifies the file path to the local Git repository (default is working directory)
.EXAMPLE .EXAMPLE
PS> ./pull-repo PS> ./pull-repo
.LINK .LINK
@ -18,27 +18,27 @@ param([string]$RepoDir = "$PWD")
try { try {
$StopWatch = [system.diagnostics.stopwatch]::startNew() $StopWatch = [system.diagnostics.stopwatch]::startNew()
"Step 1/4 - Searching for Git executable..." Write-Host "(1/4) Searching for Git executable... " -noNewline
& git --version & git --version
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" } if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
$RepoDirName = (Get-Item "$RepoDir").Name $RepoDirName = (Get-Item "$RepoDir").Name
"Step 2/4 - Checking Git repository 📂$RepoDirName..." "(2/4) Checking Git repository 📂$RepoDirName... "
if (-not(Test-Path "$RepoDir" -pathType container)) { throw "Can't access folder: $RepoDir" } if (-not(Test-Path "$RepoDir" -pathType container)) { throw "Can't access folder: $RepoDir" }
$Result = (git -C "$RepoDir" status) $Result = (git -C "$RepoDir" status)
if ("$Result" -match "HEAD detached at ") { throw "Not on a branch, so nothing to pull (in detached HEAD state)" } if ("$Result" -match "HEAD detached at ") { throw "Currently in detached HEAD state (not on a branch!), so nothing to pull" }
"Step 3/4 - Pulling updates..." "(3/4) Pulling updates..."
& git -C "$RepoDir" pull --recurse-submodules --jobs=4 & git -C "$RepoDir" pull --recurse-submodules=yes
if ($lastExitCode -ne "0") { throw "'git pull' failed with exit code $lastExitCode" } if ($lastExitCode -ne "0") { throw "'git pull' failed with exit code $lastExitCode" }
"Step 4/4 - Updating submodules... " "(4/4) Updating submodules... "
& git -C "$RepoDir" submodule update --init --recursive & git -C "$RepoDir" submodule update --init --recursive
if ($lastExitCode -ne "0") { throw "'git submodule update' failed with exit code $lastExitCode" } if ($lastExitCode -ne "0") { throw "'git submodule update' failed with exit code $lastExitCode" }
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds [int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"✔️ pulled updates for 📂$RepoDirName repo in $Elapsed sec" "✔️ updated 📂$RepoDirName repository in $Elapsed sec."
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -18,22 +18,22 @@ param([string]$ParentDir = "$PWD")
try { try {
$StopWatch = [system.diagnostics.stopwatch]::startNew() $StopWatch = [system.diagnostics.stopwatch]::startNew()
"⏳ Step 1 - Searching for Git executable..." Write-Host "⏳ (1) Searching for Git executable... " -NoNewline
& git --version & git --version
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" } if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
$ParentDirName = (Get-Item "$ParentDir").Name $ParentDirName = (Get-Item "$ParentDir").Name
"⏳ Step 2 - Checking folder 📂$ParentDirName..." Write-Host "⏳ (29 Checking folder 📂$ParentDirName... " -NoNewline
if (-not(Test-Path "$ParentDir" -pathType container)) { throw "Can't access folder: $ParentDir" } if (-not(Test-Path "$ParentDir" -pathType container)) { throw "Can't access folder: $ParentDir" }
$Folders = (Get-ChildItem "$ParentDir" -attributes Directory) $Folders = (Get-ChildItem "$ParentDir" -attributes Directory)
$NumFolders = $Folders.Count $NumFolders = $Folders.Count
"Found $NumFolders subfolders." "found $NumFolders subfolders"
[int]$Step = 3 [int]$Step = 3
[int]$Failed = 0 [int]$Failed = 0
foreach ($Folder in $Folders) { foreach ($Folder in $Folders) {
$FolderName = (Get-Item "$Folder").Name $FolderName = (Get-Item "$Folder").Name
"Step $Step/$($NumFolders + 2) - Pulling into 📂$FolderName... " "($Step/$($NumFolders + 2)) Pulling into 📂$FolderName... "
& git -C "$Folder" pull --recurse-submodules --jobs=4 & git -C "$Folder" pull --recurse-submodules --jobs=4
if ($lastExitCode -ne "0") { $Failed++; write-warning "'git pull' in 📂$FolderName failed" } if ($lastExitCode -ne "0") { $Failed++; write-warning "'git pull' in 📂$FolderName failed" }
@ -45,7 +45,7 @@ try {
} }
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds [int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"✔️ pulled $NumFolders Git repos at 📂$ParentDirName in $Elapsed sec ($Failed failed)" "✔️ pulled $NumFolders Git repos in 📂$ParentDirName ($Failed failed, it took $Elapsed sec)"
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -51,7 +51,7 @@ try {
$Cmd = "smartctl --all --json " + $Device $Cmd = "smartctl --all --json " + $Device
Invoke-Expression $Cmd > $Filename Invoke-Expression $Cmd > $Filename
$DevInfo++ $DevNo++
} }
"✔️ Done." "✔️ Done."

View File

@ -1,4 +1,4 @@
<# <#
.SYNOPSIS .SYNOPSIS
Sets the volume Sets the volume
.DESCRIPTION .DESCRIPTION

View File

@ -1,4 +1,4 @@
<# <#
.SYNOPSIS .SYNOPSIS
Shows a notification Shows a notification
.DESCRIPTION .DESCRIPTION
@ -25,6 +25,6 @@ try {
$balloon.ShowBalloonTip($Duration) $balloon.ShowBalloonTip($Duration)
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1 exit 1
} }

View File

@ -18,11 +18,11 @@ param([string]$text = "")
try { try {
if ($text -eq "") { $text = read-host "Enter the Arabic text to speak" } if ($text -eq "") { $text = read-host "Enter the Arabic text to speak" }
$TTSVoice = New-Object -ComObject SAPI.SPVoice $TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTSVoice.GetVoices()) { foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- Arabic*") { if ($Voice.GetDescription() -like "*- Arabic*") {
$TTSVoice.Voice = $Voice $TTS.Voice = $Voice
[void]$TTSVoice.Speak($text) [void]$TTS.Speak($text)
exit 0 # success exit 0 # success
} }
} }

View File

@ -18,11 +18,11 @@ param([string]$text = "")
try { try {
if ($text -eq "") { $text = read-host "Enter the Danish text to speak" } if ($text -eq "") { $text = read-host "Enter the Danish text to speak" }
$TTSVoice = New-Object -ComObject SAPI.SPVoice $TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTSVoice.GetVoices()) { foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- Danish*") { if ($Voice.GetDescription() -like "*- Danish*") {
$TTSVoice.Voice = $Voice $TTS.Voice = $Voice
[void]$TTSVoice.Speak($text) [void]$TTS.Speak($text)
exit 0 # success exit 0 # success
} }
} }

View File

@ -18,11 +18,11 @@ param([string]$text = "")
try { try {
if ("$text" -eq "") { $text = read-host "Enter the English text to speak" } if ("$text" -eq "") { $text = read-host "Enter the English text to speak" }
$TTSVoice = New-Object -ComObject SAPI.SPVoice $TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTSVoice.GetVoices()) { foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- English*") { if ($Voice.GetDescription() -like "*- English*") {
$TTSVoice.Voice = $Voice $TTS.Voice = $Voice
[void]$TTSVoice.Speak($text) [void]$TTS.Speak($text)
exit 0 # success exit 0 # success
} }
} }

View File

@ -18,11 +18,11 @@ param([string]$text = "")
try { try {
if ($text -eq "") { $text = read-host "Enter the French text to speak" } if ($text -eq "") { $text = read-host "Enter the French text to speak" }
$TTSVoice = New-Object -ComObject SAPI.SPVoice $TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTSVoice.GetVoices()) { foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- French*") { if ($Voice.GetDescription() -like "*- French*") {
$TTSVoice.Voice = $Voice $TTS.Voice = $Voice
[void]$TTSVoice.Speak($text) [void]$TTS.Speak($text)
exit 0 # success exit 0 # success
} }
} }

View File

@ -18,11 +18,11 @@ param([string]$text = "")
try { try {
if ($text -eq "") { $text = read-host "Enter the German text to speak" } if ($text -eq "") { $text = read-host "Enter the German text to speak" }
$TTSVoice = New-Object -ComObject SAPI.SPVoice $TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTSVoice.GetVoices()) { foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- German*") { if ($Voice.GetDescription() -like "*- German*") {
$TTSVoice.Voice = $Voice $TTS.Voice = $Voice
[void]$TTSVoice.Speak($text) [void]$TTS.Speak($text)
exit 0 # success exit 0 # success
} }
} }

View File

@ -18,11 +18,11 @@ param([string]$text = "")
try { try {
if ($text -eq "") { $text = read-host "Enter the Greek text to speak" } if ($text -eq "") { $text = read-host "Enter the Greek text to speak" }
$TTSVoice = New-Object -ComObject SAPI.SPVoice $TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTSVoice.GetVoices()) { foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- Greek*") { if ($Voice.GetDescription() -like "*- Greek*") {
$TTSVoice.Voice = $Voice $TTS.Voice = $Voice
[void]$TTSVoice.Speak($text) [void]$TTS.Speak($text)
exit 0 # success exit 0 # success
} }
} }

View File

@ -18,11 +18,11 @@ param([string]$text = "")
try { try {
if ($text -eq "") { $text = read-host "Enter the Hindi text to speak" } if ($text -eq "") { $text = read-host "Enter the Hindi text to speak" }
$TTSVoice = New-Object -ComObject SAPI.SPVoice $TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTSVoice.GetVoices()) { foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- Hindi*") { if ($Voice.GetDescription() -like "*- Hindi*") {
$TTSVoice.Voice = $Voice $TTS.Voice = $Voice
[void]$TTSVoice.Speak($text) [void]$TTS.Speak($text)
exit 0 # success exit 0 # success
} }
} }

View File

@ -18,11 +18,11 @@ param([string]$text = "")
try { try {
if ($text -eq "") { $text = read-host "Enter the Italian text to speak" } if ($text -eq "") { $text = read-host "Enter the Italian text to speak" }
$TTSVoice = New-Object -ComObject SAPI.SPVoice $TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTSVoice.GetVoices()) { foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- Italian*") { if ($Voice.GetDescription() -like "*- Italian*") {
$TTSVoice.Voice = $Voice $TTS.Voice = $Voice
[void]$TTSVoice.Speak($text) [void]$TTS.Speak($text)
exit 0 # success exit 0 # success
} }
} }

View File

@ -18,11 +18,11 @@ param([string]$text = "")
try { try {
if ($text -eq "") { $text = read-host "Enter the Japanese text to speak" } if ($text -eq "") { $text = read-host "Enter the Japanese text to speak" }
$TTSVoice = New-Object -ComObject SAPI.SPVoice $TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTSVoice.GetVoices()) { foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- Japanese*") { if ($Voice.GetDescription() -like "*- Japanese*") {
$TTSVoice.Voice = $Voice $TTS.Voice = $Voice
[void]$TTSVoice.Speak($text) [void]$TTS.Speak($text)
exit 0 # success exit 0 # success
} }
} }

View File

@ -1,6 +1,6 @@
<# <#
.SYNOPSIS .SYNOPSIS
Speaks text with a Latin text-to-speech voice Speaks text in Latin
.DESCRIPTION .DESCRIPTION
This PowerShell script speaks the given text with a Latin text-to-speech (TTS) voice. This PowerShell script speaks the given text with a Latin text-to-speech (TTS) voice.
.PARAMETER text .PARAMETER text
@ -18,11 +18,11 @@ param([string]$text = "")
try { try {
if ($text -eq "") { $text = read-host "Enter the Latin text to speak" } if ($text -eq "") { $text = read-host "Enter the Latin text to speak" }
$TTSVoice = New-Object -ComObject SAPI.SPVoice $TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTSVoice.GetVoices()) { foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- Latin*") { if ($Voice.GetDescription() -like "*- Latin*") {
$TTSVoice.Voice = $Voice $TTS.Voice = $Voice
[void]$TTSVoice.Speak($text) [void]$TTS.Speak($text)
exit 0 # success exit 0 # success
} }
} }

View File

@ -18,11 +18,11 @@ param([string]$text = "")
try { try {
if ($text -eq "") { $text = read-host "Enter the Mandarin text to speak" } if ($text -eq "") { $text = read-host "Enter the Mandarin text to speak" }
$TTSVoice = New-Object -ComObject SAPI.SPVoice $TTS = New-Object -ComObject SAPI.SPVoice
foreach ($Voice in $TTSVoice.GetVoices()) { foreach ($Voice in $TTS.GetVoices()) {
if ($Voice.GetDescription() -like "*- Mandarin*") { if ($Voice.GetDescription() -like "*- Mandarin*") {
$TTSVoice.Voice = $Voice $TTS.Voice = $Voice
[void]$TTSVoice.Speak($text) [void]$TTS.Speak($text)
exit 0 # success exit 0 # success
} }
} }

Some files were not shown because too many files have changed in this diff Show More