mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-08 00:54:04 +01:00
Remove the #!/usr/bin/pwsh line
This commit is contained in:
parent
7ab2795778
commit
450869a593
15
Misc/FAQ.md
15
Misc/FAQ.md
@ -68,14 +68,13 @@ Good PowerShell scripts are user-friendly and platform-independant. As a guideli
|
||||
1. the filename is named using the `<verb>-<object>.ps1` scheme
|
||||
2. the encoding is UTF-8-BOM to support and use Unicode characters (including emojis where appropriate)
|
||||
3. the script has execute file permissions: chmod a+rx <file> (for Linux support)
|
||||
4. the first line reads `#!/usr/bin/pwsh` (for Linux support)
|
||||
5. provide a comment-based help with syntax, description, link, author, and license
|
||||
6. check the requirements (e.g. #Requires -RunAsAdministrator, or #Requires -Version 3)
|
||||
7. prefer command-line options, else ask the user for help
|
||||
8. recommended is `Set-StrictMode -Version Latest` to enable additional error checking
|
||||
9. for readibility use UpperCamelCase for variables and functions, lowerCamelCase for everything else
|
||||
10. on error call write-error with keyword "ERROR:" (to support log parsers) and exit the error code (mostly 1)
|
||||
11. on success exit with error code 0 (exit 0)
|
||||
4. provide a comment-based help with syntax, description, link, author, and license
|
||||
5. check the requirements (e.g. #Requires -RunAsAdministrator, or #Requires -Version 3)
|
||||
6. prefer command-line options, else ask the user for help
|
||||
7. recommended is `Set-StrictMode -Version Latest` to enable additional error checking
|
||||
8. for readibility use UpperCamelCase for variables and functions, lowerCamelCase for everything else
|
||||
9. on error call write-error with keyword "ERROR:" (to support log parsers) and exit the error code (mostly 1)
|
||||
10. on success exit with error code 0 (exit 0)
|
||||
|
||||
Your Question is not answered here?
|
||||
-----------------------------------
|
||||
|
@ -1,7 +1,7 @@
|
||||
Mega Collection of PowerShell Scripts
|
||||
=====================================
|
||||
|
||||
**This repository provides more than 190 useful and cross-platform PowerShell scripts in the subfolder [Scripts/](Scripts/) - to be used by command-line interface (CLI), for remote control (e.g. via SSH), by context menu, by voice control, by automation software like Jenkins, automatically as daily tasks, or simply to learn PowerShell. See the [PowerShell FAQ page](Misc/FAQ.md) if you need help or have any questions.**
|
||||
**This repository provides more than 200 useful and cross-platform PowerShell scripts in the subfolder [Scripts/](Scripts/) - to be used by command-line interface (CLI), for remote control (e.g. via SSH), by context menu, by voice control, by automation software like Jenkins, automatically as daily tasks, or simply to learn PowerShell. See the [PowerShell FAQ page](Misc/FAQ.md) if you need help or have any questions.**
|
||||
|
||||
**NOTE:** the scripts support Unicode input & output! Please use a modern console supporting UTF-8 such as Windows Terminal
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX MD5.ps1 [<file>]
|
||||
.DESCRIPTION prints the MD5 checksum of the given file
|
||||
@ -7,14 +6,11 @@
|
||||
#>
|
||||
|
||||
param($File = "")
|
||||
|
||||
if ($File -eq "" ) {
|
||||
$File = read-host "Enter path to file"
|
||||
}
|
||||
if ($File -eq "" ) { $File = read-host "Enter path to file" }
|
||||
|
||||
try {
|
||||
$Result = get-filehash $File -algorithm MD5
|
||||
write-output "MD5 hash is" $Result.Hash
|
||||
"MD5 hash is" $Result.Hash
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX SHA1.ps1 [<file>]
|
||||
.DESCRIPTION prints the SHA1 checksum of the given file
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX SHA256.ps1 [<file>]
|
||||
.DESCRIPTION prints the SHA256 checksum of the given file
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX add-firewall-rules.ps1 [<path-to-executables>]
|
||||
.DESCRIPTION adds firewall rules for the given executables, administrator rights are required
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX alert.ps1 [<message>]
|
||||
.DESCRIPTION handle and escalate the given alert message
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX build-repo.ps1 [<repo-dir>]
|
||||
.DESCRIPTION builds a Git repository (supporting cmake,configure,autogen,Imakefile,Makefile)
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX build-repos.ps1 [<parent-dir>]
|
||||
.DESCRIPTION builds all Git repositories under the current/given directory
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX cd-docs.ps1
|
||||
.DESCRIPTION go to the user's documents folder
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX check-cpu-temp.ps1
|
||||
.DESCRIPTION checks the CPU temperature
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX check-dns-resolution.ps1
|
||||
.DESCRIPTION checks the DNS resolution with frequently used domain names
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX check-drive-space.ps1 [<drive>] [<min-level>]
|
||||
.DESCRIPTION checks the given drive for free space left
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX check-file-system.ps1 [<drive>]
|
||||
.DESCRIPTION checks the validity of the file system (needs admin rights)
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX check-health.ps1
|
||||
.DESCRIPTION checks the health of the local computer
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX check-ipv4-address.ps1 [<address>]
|
||||
.DESCRIPTION checks the given IPv4 address for validity
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX check-ipv6-address.ps1 [<address>]
|
||||
.DESCRIPTION checks the given IPv6 address for validity
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX check-mac-address.ps1 [<MAC>]
|
||||
.DESCRIPTION checks the given MAC address for validity
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX check-ping.ps1
|
||||
.DESCRIPTION checks the ping latency to the internet
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX check-swap-space.ps1 [<min-level>]
|
||||
.DESCRIPTION checks the free swap space
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX check-symlinks.ps1 [<dir-tree>]
|
||||
.DESCRIPTION checks every symlink in the given directory tree
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX check-weather.ps1 [<location>]
|
||||
.DESCRIPTION checks the weather for critical values
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX check-windows-system-files.ps1
|
||||
.DESCRIPTION checks the validity of the Windows system files (requires admin rights)
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX check-xml-file [<file>]
|
||||
.DESCRIPTION checks the given XML file for validity
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX cherry-picker.ps1 [<commit-id>] [<commit-message>] [<branches>] [<repo-dir>]
|
||||
.DESCRIPTION cherry-picks a Git commit into multiple branches
|
||||
@ -8,15 +7,9 @@
|
||||
|
||||
param($CommitID = "", $CommitMessage = "", $Branches = "", $RepoDir = "$PWD")
|
||||
|
||||
if ($CommitID -eq "" ) {
|
||||
$CommitID = read-host "Enter the commit id to cherry-pick"
|
||||
}
|
||||
if ($CommitMessage -eq "" ) {
|
||||
$CommitMessage = read-host "Enter the commit message to use"
|
||||
}
|
||||
if ($Branches -eq "" ) {
|
||||
$Branches = read-host "Enter the target branches"
|
||||
}
|
||||
if ($CommitID -eq "" ) { $CommitID = read-host "Enter the commit id to cherry-pick" }
|
||||
if ($CommitMessage -eq "" ) { $CommitMessage = read-host "Enter the commit message to use" }
|
||||
if ($Branches -eq "" ) { $Branches = read-host "Enter the target branches" }
|
||||
|
||||
try {
|
||||
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX clean-repo.ps1 [<repo-dir>]
|
||||
.DESCRIPTION cleans a Git repository from untracked files (including submodules, e.g. for a fresh build)
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX clone-repos.ps1 [<parent-dir>]
|
||||
.DESCRIPTION clones well-known Git repositories under the current/given directory.
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX close-calculator.ps1
|
||||
.DESCRIPTION closes the calculator program gracefully
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX close-chrome.ps1
|
||||
.DESCRIPTION closes Google Chrome gracefully
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX close-cortana.ps1
|
||||
.DESCRIPTION closes Cortana gracefully
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX close-edge.ps1
|
||||
.DESCRIPTION closes Microsoft Edge gracefully
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX close-file-explorer.ps1
|
||||
.DESCRIPTION closes Microsoft File Explorer gracefully
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX close-program.ps1 [<full-program-name>] [<program-name>] [<program-alias-name>]
|
||||
.DESCRIPTION closes the processes of the given program gracefully
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX close-system-settings.ps1
|
||||
.DESCRIPTION closes the System Settings gracefully
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX close-thunderbird.ps1
|
||||
.DESCRIPTION closes Mozilla Thunderbird gracefully
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX close-vlc.ps1
|
||||
.DESCRIPTION closes the VLC media player gracefully
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX close-windows-terminal.ps1
|
||||
.DESCRIPTION closes Windows Terminal gracefully
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX configure-git.ps1 [<full-name>] [<email-address>] [<favorite-editor>]
|
||||
.DESCRIPTION sets up the Git user configuration
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX convert-csv2txt.ps1 [<csv-file>]
|
||||
.DESCRIPTION converts the given CSV file into a text list
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX convert-mysql2csv.ps1 [<server>] [<database>] [<username>] [<password>] [<query>]
|
||||
.DESCRIPTION convert the MySQL database table to a CSV file
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX convert-sql2csv.ps1 [<server>] [<database>] [<username>] [<password>] [<query>]
|
||||
.DESCRIPTION convert the SQL database table to a CSV file
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX convert-txt2wav.ps1 [<text>] [<wav-file>]
|
||||
.DESCRIPTION converts the given text to a .WAV audio file
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX create-branch.ps1 [<new-branch-name>] [<repo-dir>]
|
||||
.DESCRIPTION creates and switches to a new branch in a Git repository
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX create-shortcut.ps1 [<shortcut>] [<target>] [<description>]
|
||||
.DESCRIPTION creates a new shortcut
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX create-symlink.ps1 [<symlink>] [<target>]
|
||||
.DESCRIPTION creates a symbolic link
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX create-tag.ps1 [<new-tag-name>] [<repo-dir>]
|
||||
.DESCRIPTION creates a new tag in the current/given Git repository
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX decrypt-file.ps1 [<path>] [<password>]
|
||||
.DESCRIPTION decrypts the given file
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX display-time.ps1 [<seconds>]
|
||||
.DESCRIPTION displays the current time for 10 seconds by default
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX download-dir.ps1 [<URL>]
|
||||
.DESCRIPTION downloads a directory tree from the given URL
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX download-file.ps1 [<URL>]
|
||||
.DESCRIPTION downloads a file from the given URL
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX edit.ps1 <filename>
|
||||
.DESCRIPTION starts the built-in text editor to edit the given file
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX enable-crash-dumps.ps1
|
||||
.DESCRIPTION enables the writing of crash dumps
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
@ -289,4 +288,4 @@ Else
|
||||
write-host "You did not enter a valid option. Please re-run Get-Dump.ps1"
|
||||
start-sleep -s 5
|
||||
}
|
||||
exit 0
|
||||
exit 0
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX enable-god-mode.ps1
|
||||
.DESCRIPTION enables the god mode (adds a new icon to the desktop)
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
@ -14,7 +13,7 @@ try {
|
||||
}
|
||||
$null = new-item @GodModeSplat
|
||||
|
||||
write-host -foregroundColor green "✔️ new icon added to the desktop"
|
||||
"✔️ new icon added to the desktop"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX enable-ssh-client.ps1
|
||||
.DESCRIPTION enables the SSH client (needs admin rights)
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX enable-ssh-server.ps1
|
||||
.DESCRIPTION enables the SSH server (needs admin rights)
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX encrypt-file.ps1 [<path>] [<password>]
|
||||
.DESCRIPTION encrypts the given file
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX fetch-repo.ps1 [<repo-dir>]
|
||||
.DESCRIPTION fetches updates for a local Git repository (including submodules)
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX fetch-repos.ps1 [<parent-dir>]
|
||||
.DESCRIPTION fetches updates for all Git repositories under the current/given directory (including submodules)
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX generate-qrcode.ps1 [<text>] [<image-size>]
|
||||
.DESCRIPTION generates a QR code
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX hibernate.ps1
|
||||
.DESCRIPTION enables hibernate mode for the local computer (needs admin rights)
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX inspect-exe.ps1 [<path-to-exe-file>]
|
||||
.DESCRIPTION prints basic information of the given executable file
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX install-google-chrome.ps1
|
||||
.DESCRIPTION silently installs latest Google Chrome
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX introduce-powershell.ps1
|
||||
.DESCRIPTION introduces PowerShell to new users
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX list-aliases.ps1
|
||||
.DESCRIPTION lists all PowerShell aliases
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX list-anagrams.ps1 [<word>] [<columns>]
|
||||
.DESCRIPTION lists all anagrams of the given word
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX list-automatic-variables.ps1
|
||||
.DESCRIPTION lists the automatic variables of PowerShell
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX list-branches.ps1 [<repo-dir>] [<pattern>]
|
||||
.DESCRIPTION lists all branches in the current/given Git repository
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX list-cheat-sheet.ps1
|
||||
.DESCRIPTION lists the PowerShell cheat sheet
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX list-city-weather.ps1
|
||||
.DESCRIPTION list the current weather of cities world-wide (west to east)
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX list-clipboard.ps1
|
||||
.DESCRIPTION lists the contents of the clipboard
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX list-cmdlets.ps1
|
||||
.DESCRIPTION lists all PowerShell cmdlets
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX list-commits.ps1 [<repo-dir>] [<format>]
|
||||
.DESCRIPTION lists all commits in the current/given Git repository
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX list-dir-tree.ps1 [<dir-tree>]
|
||||
.DESCRIPTION lists a directory tree
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX list-dir.ps1 [<directory>]
|
||||
.DESCRIPTION lists the directory content formatted in columns
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX list-drives.ps1
|
||||
.DESCRIPTION lists all drives connected to the computer
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX list-earthquakes.ps1
|
||||
.DESCRIPTION lists earthquakes with magnitude >= 6.0 for the last 30 days
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX list-emojis.ps1
|
||||
.DESCRIPTION lists the Emojis of Unicode 13.0
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX list-empty-dirs.ps1 [<dir-tree>]
|
||||
.DESCRIPTION lists empty subfolders within the given directory tree
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX list-empty-files.ps1 [<dir-tree>]
|
||||
.DESCRIPTION lists empty files within the given directory tree
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX list-environment-variables.ps1
|
||||
.DESCRIPTION lists all environment variables
|
||||
|
@ -1,19 +1,15 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX list-files.ps1 [<folder>]
|
||||
.DESCRIPTION lists all files in the given folder and also in every subfolder
|
||||
.SYNTAX list-files.ps1 [<dir-tree>]
|
||||
.DESCRIPTION lists all files in the given directory tree
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($Folder = "")
|
||||
|
||||
if ($Folder -eq "" ) {
|
||||
$Folder = read-host "Enter path to folder"
|
||||
}
|
||||
param($DirTree = "")
|
||||
if ($DirTree -eq "" ) { $DirTree = read-host "Enter path to directory tree" }
|
||||
|
||||
try {
|
||||
Get-ChildItem -path $Folder -recurse | select FullName
|
||||
Get-ChildItem -path $DirTree -recurse | select FullName
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX list-fritzbox-calls.ps1 [<username>] [<password>]
|
||||
.DESCRIPTION lists the phone calls of the FRITZ!Box device
|
||||
@ -9,13 +8,8 @@
|
||||
#Requires -Version 3
|
||||
|
||||
param($Username = "", $Password = "")
|
||||
|
||||
if ($Username -eq "") {
|
||||
$Username = read-host "Enter username for FRITZ!Box"
|
||||
}
|
||||
if ($Password -eq "") {
|
||||
$Password = read-host "Enter password for FRITZ!Box"
|
||||
}
|
||||
if ($Username -eq "") { $Username = read-host "Enter username for FRITZ!Box" }
|
||||
if ($Password -eq "") { $Password = read-host "Enter password for FRITZ!Box" }
|
||||
|
||||
write-progress "Contacting FRITZ!Box ..."
|
||||
$FQDN = "fritz.box"
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX list-fritzbox-calls.ps1 [<username>] [<password>]
|
||||
.DESCRIPTION lists FRITZ!Box's known devices
|
||||
@ -9,13 +8,8 @@
|
||||
#Requires -Version 3
|
||||
|
||||
param($Username = "", $Password = "")
|
||||
|
||||
if ($Username -eq "") {
|
||||
$Username = read-host "Enter username for FRITZ!Box"
|
||||
}
|
||||
if ($Password -eq "") {
|
||||
$Password = read-host "Enter password for FRITZ!Box"
|
||||
}
|
||||
if ($Username -eq "") { $Username = read-host "Enter username for FRITZ!Box" }
|
||||
if ($Password -eq "") { $Password = read-host "Enter password for FRITZ!Box" }
|
||||
|
||||
write-progress "Contacting FRITZ!Box ..."
|
||||
[string]$HostURL = "https://fritz.box:49443"
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX list-hidden-files.ps1 [<dir-tree>]
|
||||
.DESCRIPTION lists hidden files within the given directory tree
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
@ -9,9 +8,10 @@
|
||||
param($DirTree = "$PWD")
|
||||
|
||||
try {
|
||||
$DirTree = resolve-path "$DirTree/"
|
||||
[int]$Count = 0
|
||||
$DirTree = resolve-path "$DirTree"
|
||||
write-progress "Listing hidden files in $DirTree ..."
|
||||
|
||||
[int]$Count = 0
|
||||
get-childItem "$DirTree" -attributes Hidden -recurse | foreach-object {
|
||||
"📄 $($_.FullName)"
|
||||
$Count++
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX list-hourly-weather.ps1 [<location>]
|
||||
.DESCRIPTION lists the hourly weather today
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX list-installed-apps.ps1
|
||||
.DESCRIPTION lists the installed Windows Store apps
|
||||
@ -8,7 +7,6 @@
|
||||
|
||||
try {
|
||||
get-appxPackage | select-object Name,Version | format-table -autoSize
|
||||
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX list-installed-software.ps1
|
||||
.DESCRIPTION lists the installed software (except Windows Store apps)
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX list-logbook.ps1
|
||||
.DESCRIPTION lists the content of the logbook (in ../Data/logbook.csv)
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX list-modules.ps1
|
||||
.DESCRIPTION lists all PowerShell modules
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX list-network-shares.ps1
|
||||
.DESCRIPTION lists the network shares of the local computer
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX list-news.ps1 [<RSS-URL>]
|
||||
.DESCRIPTION lists the latest news
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX list-os-releases.ps1
|
||||
.DESCRIPTION lists OS releases and download URL
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX list-printers.ps1
|
||||
.DESCRIPTION lists all printer known to the computer
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX list-processes.ps1
|
||||
.DESCRIPTION lists the local computer processes
|
||||
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
<#
|
||||
.SYNTAX list-profiles.ps1
|
||||
.DESCRIPTION lists your PowerShell profiles
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX list-random-passwords.ps1 [<password-length>] [<columns>] [<rows>]
|
||||
.DESCRIPTION prints a list of random passwords
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX list-random-pins.ps1 [<pin-length>] [<columns>] [<rows>]
|
||||
.DESCRIPTION prints a list of random PIN's
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX list-scripts.ps1
|
||||
.DESCRIPTION lists all PowerShell scripts in this repository (sorted alphabetically)
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX list-services.ps1
|
||||
.DESCRIPTION lists the services on the local computer
|
||||
|
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/pwsh
|
||||
<#
|
||||
.SYNTAX list-system-info.ps1
|
||||
.DESCRIPTION lists system information on the local computer
|
||||
@ -100,4 +99,4 @@ $info = $info | ConvertTo-JSON
|
||||
|
||||
# Output
|
||||
$info
|
||||
exit 0
|
||||
exit 0
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user