Remove the #!/usr/bin/pwsh line

This commit is contained in:
Markus Fleschutz 2021-04-21 19:53:52 +02:00
parent 7ab2795778
commit 450869a593
184 changed files with 108 additions and 344 deletions

View File

@ -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 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) 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) 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) 4. provide a comment-based help with syntax, description, link, author, and license
5. 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. check the requirements (e.g. #Requires -RunAsAdministrator, or #Requires -Version 3) 6. prefer command-line options, else ask the user for help
7. prefer command-line options, else ask the user for help 7. recommended is `Set-StrictMode -Version Latest` to enable additional error checking
8. 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. 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 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)
11. on success exit with error code 0 (exit 0)
Your Question is not answered here? Your Question is not answered here?
----------------------------------- -----------------------------------

View File

@ -1,7 +1,7 @@
Mega Collection of PowerShell Scripts 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 **NOTE:** the scripts support Unicode input & output! Please use a modern console supporting UTF-8 such as Windows Terminal

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX MD5.ps1 [<file>] .SYNTAX MD5.ps1 [<file>]
.DESCRIPTION prints the MD5 checksum of the given file .DESCRIPTION prints the MD5 checksum of the given file
@ -7,14 +6,11 @@
#> #>
param($File = "") param($File = "")
if ($File -eq "" ) { $File = read-host "Enter path to file" }
if ($File -eq "" ) {
$File = read-host "Enter path to file"
}
try { try {
$Result = get-filehash $File -algorithm MD5 $Result = get-filehash $File -algorithm MD5
write-output "MD5 hash is" $Result.Hash "MD5 hash is" $Result.Hash
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX SHA1.ps1 [<file>] .SYNTAX SHA1.ps1 [<file>]
.DESCRIPTION prints the SHA1 checksum of the given file .DESCRIPTION prints the SHA1 checksum of the given file

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX SHA256.ps1 [<file>] .SYNTAX SHA256.ps1 [<file>]
.DESCRIPTION prints the SHA256 checksum of the given file .DESCRIPTION prints the SHA256 checksum of the given file

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX add-firewall-rules.ps1 [<path-to-executables>] .SYNTAX add-firewall-rules.ps1 [<path-to-executables>]
.DESCRIPTION adds firewall rules for the given executables, administrator rights are required .DESCRIPTION adds firewall rules for the given executables, administrator rights are required

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX alert.ps1 [<message>] .SYNTAX alert.ps1 [<message>]
.DESCRIPTION handle and escalate the given alert message .DESCRIPTION handle and escalate the given alert message

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX build-repo.ps1 [<repo-dir>] .SYNTAX build-repo.ps1 [<repo-dir>]
.DESCRIPTION builds a Git repository (supporting cmake,configure,autogen,Imakefile,Makefile) .DESCRIPTION builds a Git repository (supporting cmake,configure,autogen,Imakefile,Makefile)
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX build-repos.ps1 [<parent-dir>] .SYNTAX build-repos.ps1 [<parent-dir>]
.DESCRIPTION builds all Git repositories under the current/given directory .DESCRIPTION builds all Git repositories under the current/given directory
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX cd-docs.ps1 .SYNTAX cd-docs.ps1
.DESCRIPTION go to the user's documents folder .DESCRIPTION go to the user's documents folder
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX check-cpu-temp.ps1 .SYNTAX check-cpu-temp.ps1
.DESCRIPTION checks the CPU temperature .DESCRIPTION checks the CPU temperature
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX check-dns-resolution.ps1 .SYNTAX check-dns-resolution.ps1
.DESCRIPTION checks the DNS resolution with frequently used domain names .DESCRIPTION checks the DNS resolution with frequently used domain names
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX check-drive-space.ps1 [<drive>] [<min-level>] .SYNTAX check-drive-space.ps1 [<drive>] [<min-level>]
.DESCRIPTION checks the given drive for free space left .DESCRIPTION checks the given drive for free space left
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX check-file-system.ps1 [<drive>] .SYNTAX check-file-system.ps1 [<drive>]
.DESCRIPTION checks the validity of the file system (needs admin rights) .DESCRIPTION checks the validity of the file system (needs admin rights)
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX check-health.ps1 .SYNTAX check-health.ps1
.DESCRIPTION checks the health of the local computer .DESCRIPTION checks the health of the local computer
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX check-ipv4-address.ps1 [<address>] .SYNTAX check-ipv4-address.ps1 [<address>]
.DESCRIPTION checks the given IPv4 address for validity .DESCRIPTION checks the given IPv4 address for validity

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX check-ipv6-address.ps1 [<address>] .SYNTAX check-ipv6-address.ps1 [<address>]
.DESCRIPTION checks the given IPv6 address for validity .DESCRIPTION checks the given IPv6 address for validity

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX check-mac-address.ps1 [<MAC>] .SYNTAX check-mac-address.ps1 [<MAC>]
.DESCRIPTION checks the given MAC address for validity .DESCRIPTION checks the given MAC address for validity

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX check-ping.ps1 .SYNTAX check-ping.ps1
.DESCRIPTION checks the ping latency to the internet .DESCRIPTION checks the ping latency to the internet
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX check-swap-space.ps1 [<min-level>] .SYNTAX check-swap-space.ps1 [<min-level>]
.DESCRIPTION checks the free swap space .DESCRIPTION checks the free swap space
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX check-symlinks.ps1 [<dir-tree>] .SYNTAX check-symlinks.ps1 [<dir-tree>]
.DESCRIPTION checks every symlink in the given directory tree .DESCRIPTION checks every symlink in the given directory tree

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX check-weather.ps1 [<location>] .SYNTAX check-weather.ps1 [<location>]
.DESCRIPTION checks the weather for critical values .DESCRIPTION checks the weather for critical values
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX check-windows-system-files.ps1 .SYNTAX check-windows-system-files.ps1
.DESCRIPTION checks the validity of the Windows system files (requires admin rights) .DESCRIPTION checks the validity of the Windows system files (requires admin rights)
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX check-xml-file [<file>] .SYNTAX check-xml-file [<file>]
.DESCRIPTION checks the given XML file for validity .DESCRIPTION checks the given XML file for validity

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX cherry-picker.ps1 [<commit-id>] [<commit-message>] [<branches>] [<repo-dir>] .SYNTAX cherry-picker.ps1 [<commit-id>] [<commit-message>] [<branches>] [<repo-dir>]
.DESCRIPTION cherry-picks a Git commit into multiple branches .DESCRIPTION cherry-picks a Git commit into multiple branches
@ -8,15 +7,9 @@
param($CommitID = "", $CommitMessage = "", $Branches = "", $RepoDir = "$PWD") param($CommitID = "", $CommitMessage = "", $Branches = "", $RepoDir = "$PWD")
if ($CommitID -eq "" ) { if ($CommitID -eq "" ) { $CommitID = read-host "Enter the commit id to cherry-pick" }
$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 ($CommitMessage -eq "" ) {
$CommitMessage = read-host "Enter the commit message to use"
}
if ($Branches -eq "" ) {
$Branches = read-host "Enter the target branches"
}
try { try {
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" } if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX clean-repo.ps1 [<repo-dir>] .SYNTAX clean-repo.ps1 [<repo-dir>]
.DESCRIPTION cleans a Git repository from untracked files (including submodules, e.g. for a fresh build) .DESCRIPTION cleans a Git repository from untracked files (including submodules, e.g. for a fresh build)
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX clone-repos.ps1 [<parent-dir>] .SYNTAX clone-repos.ps1 [<parent-dir>]
.DESCRIPTION clones well-known Git repositories under the current/given directory. .DESCRIPTION clones well-known Git repositories under the current/given directory.
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX close-calculator.ps1 .SYNTAX close-calculator.ps1
.DESCRIPTION closes the calculator program gracefully .DESCRIPTION closes the calculator program gracefully

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX close-chrome.ps1 .SYNTAX close-chrome.ps1
.DESCRIPTION closes Google Chrome gracefully .DESCRIPTION closes Google Chrome gracefully

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX close-cortana.ps1 .SYNTAX close-cortana.ps1
.DESCRIPTION closes Cortana gracefully .DESCRIPTION closes Cortana gracefully

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX close-edge.ps1 .SYNTAX close-edge.ps1
.DESCRIPTION closes Microsoft Edge gracefully .DESCRIPTION closes Microsoft Edge gracefully

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX close-file-explorer.ps1 .SYNTAX close-file-explorer.ps1
.DESCRIPTION closes Microsoft File Explorer gracefully .DESCRIPTION closes Microsoft File Explorer gracefully

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX close-program.ps1 [<full-program-name>] [<program-name>] [<program-alias-name>] .SYNTAX close-program.ps1 [<full-program-name>] [<program-name>] [<program-alias-name>]
.DESCRIPTION closes the processes of the given program gracefully .DESCRIPTION closes the processes of the given program gracefully
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX close-system-settings.ps1 .SYNTAX close-system-settings.ps1
.DESCRIPTION closes the System Settings gracefully .DESCRIPTION closes the System Settings gracefully

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX close-thunderbird.ps1 .SYNTAX close-thunderbird.ps1
.DESCRIPTION closes Mozilla Thunderbird gracefully .DESCRIPTION closes Mozilla Thunderbird gracefully

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX close-vlc.ps1 .SYNTAX close-vlc.ps1
.DESCRIPTION closes the VLC media player gracefully .DESCRIPTION closes the VLC media player gracefully

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX close-windows-terminal.ps1 .SYNTAX close-windows-terminal.ps1
.DESCRIPTION closes Windows Terminal gracefully .DESCRIPTION closes Windows Terminal gracefully

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX configure-git.ps1 [<full-name>] [<email-address>] [<favorite-editor>] .SYNTAX configure-git.ps1 [<full-name>] [<email-address>] [<favorite-editor>]
.DESCRIPTION sets up the Git user configuration .DESCRIPTION sets up the Git user configuration
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX convert-csv2txt.ps1 [<csv-file>] .SYNTAX convert-csv2txt.ps1 [<csv-file>]
.DESCRIPTION converts the given CSV file into a text list .DESCRIPTION converts the given CSV file into a text list

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX convert-mysql2csv.ps1 [<server>] [<database>] [<username>] [<password>] [<query>] .SYNTAX convert-mysql2csv.ps1 [<server>] [<database>] [<username>] [<password>] [<query>]
.DESCRIPTION convert the MySQL database table to a CSV file .DESCRIPTION convert the MySQL database table to a CSV file

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX convert-sql2csv.ps1 [<server>] [<database>] [<username>] [<password>] [<query>] .SYNTAX convert-sql2csv.ps1 [<server>] [<database>] [<username>] [<password>] [<query>]
.DESCRIPTION convert the SQL database table to a CSV file .DESCRIPTION convert the SQL database table to a CSV file

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX convert-txt2wav.ps1 [<text>] [<wav-file>] .SYNTAX convert-txt2wav.ps1 [<text>] [<wav-file>]
.DESCRIPTION converts the given text to a .WAV audio file .DESCRIPTION converts the given text to a .WAV audio file

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX create-branch.ps1 [<new-branch-name>] [<repo-dir>] .SYNTAX create-branch.ps1 [<new-branch-name>] [<repo-dir>]
.DESCRIPTION creates and switches to a new branch in a Git repository .DESCRIPTION creates and switches to a new branch in a Git repository
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX create-shortcut.ps1 [<shortcut>] [<target>] [<description>] .SYNTAX create-shortcut.ps1 [<shortcut>] [<target>] [<description>]
.DESCRIPTION creates a new shortcut .DESCRIPTION creates a new shortcut
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX create-symlink.ps1 [<symlink>] [<target>] .SYNTAX create-symlink.ps1 [<symlink>] [<target>]
.DESCRIPTION creates a symbolic link .DESCRIPTION creates a symbolic link
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX create-tag.ps1 [<new-tag-name>] [<repo-dir>] .SYNTAX create-tag.ps1 [<new-tag-name>] [<repo-dir>]
.DESCRIPTION creates a new tag in the current/given Git repository .DESCRIPTION creates a new tag in the current/given Git repository
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX decrypt-file.ps1 [<path>] [<password>] .SYNTAX decrypt-file.ps1 [<path>] [<password>]
.DESCRIPTION decrypts the given file .DESCRIPTION decrypts the given file

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX display-time.ps1 [<seconds>] .SYNTAX display-time.ps1 [<seconds>]
.DESCRIPTION displays the current time for 10 seconds by default .DESCRIPTION displays the current time for 10 seconds by default

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX download-dir.ps1 [<URL>] .SYNTAX download-dir.ps1 [<URL>]
.DESCRIPTION downloads a directory tree from the given URL .DESCRIPTION downloads a directory tree from the given URL

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX download-file.ps1 [<URL>] .SYNTAX download-file.ps1 [<URL>]
.DESCRIPTION downloads a file from the given URL .DESCRIPTION downloads a file from the given URL

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX edit.ps1 <filename> .SYNTAX edit.ps1 <filename>
.DESCRIPTION starts the built-in text editor to edit the given file .DESCRIPTION starts the built-in text editor to edit the given file

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX enable-crash-dumps.ps1 .SYNTAX enable-crash-dumps.ps1
.DESCRIPTION enables the writing of crash dumps .DESCRIPTION enables the writing of crash dumps
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX enable-god-mode.ps1 .SYNTAX enable-god-mode.ps1
.DESCRIPTION enables the god mode (adds a new icon to the desktop) .DESCRIPTION enables the god mode (adds a new icon to the desktop)
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell
@ -14,7 +13,7 @@ try {
} }
$null = new-item @GodModeSplat $null = new-item @GodModeSplat
write-host -foregroundColor green "✔️ new icon added to the desktop" "✔️ new icon added to the desktop"
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX enable-ssh-client.ps1 .SYNTAX enable-ssh-client.ps1
.DESCRIPTION enables the SSH client (needs admin rights) .DESCRIPTION enables the SSH client (needs admin rights)

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX enable-ssh-server.ps1 .SYNTAX enable-ssh-server.ps1
.DESCRIPTION enables the SSH server (needs admin rights) .DESCRIPTION enables the SSH server (needs admin rights)

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX encrypt-file.ps1 [<path>] [<password>] .SYNTAX encrypt-file.ps1 [<path>] [<password>]
.DESCRIPTION encrypts the given file .DESCRIPTION encrypts the given file

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX fetch-repo.ps1 [<repo-dir>] .SYNTAX fetch-repo.ps1 [<repo-dir>]
.DESCRIPTION fetches updates for a local Git repository (including submodules) .DESCRIPTION fetches updates for a local Git repository (including submodules)
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX fetch-repos.ps1 [<parent-dir>] .SYNTAX fetch-repos.ps1 [<parent-dir>]
.DESCRIPTION fetches updates for all Git repositories under the current/given directory (including submodules) .DESCRIPTION fetches updates for all Git repositories under the current/given directory (including submodules)
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX generate-qrcode.ps1 [<text>] [<image-size>] .SYNTAX generate-qrcode.ps1 [<text>] [<image-size>]
.DESCRIPTION generates a QR code .DESCRIPTION generates a QR code

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX hibernate.ps1 .SYNTAX hibernate.ps1
.DESCRIPTION enables hibernate mode for the local computer (needs admin rights) .DESCRIPTION enables hibernate mode for the local computer (needs admin rights)

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX inspect-exe.ps1 [<path-to-exe-file>] .SYNTAX inspect-exe.ps1 [<path-to-exe-file>]
.DESCRIPTION prints basic information of the given executable file .DESCRIPTION prints basic information of the given executable file

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX install-google-chrome.ps1 .SYNTAX install-google-chrome.ps1
.DESCRIPTION silently installs latest Google Chrome .DESCRIPTION silently installs latest Google Chrome
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX introduce-powershell.ps1 .SYNTAX introduce-powershell.ps1
.DESCRIPTION introduces PowerShell to new users .DESCRIPTION introduces PowerShell to new users

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX list-aliases.ps1 .SYNTAX list-aliases.ps1
.DESCRIPTION lists all PowerShell aliases .DESCRIPTION lists all PowerShell aliases

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX list-anagrams.ps1 [<word>] [<columns>] .SYNTAX list-anagrams.ps1 [<word>] [<columns>]
.DESCRIPTION lists all anagrams of the given word .DESCRIPTION lists all anagrams of the given word

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX list-automatic-variables.ps1 .SYNTAX list-automatic-variables.ps1
.DESCRIPTION lists the automatic variables of PowerShell .DESCRIPTION lists the automatic variables of PowerShell

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX list-branches.ps1 [<repo-dir>] [<pattern>] .SYNTAX list-branches.ps1 [<repo-dir>] [<pattern>]
.DESCRIPTION lists all branches in the current/given Git repository .DESCRIPTION lists all branches in the current/given Git repository

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX list-cheat-sheet.ps1 .SYNTAX list-cheat-sheet.ps1
.DESCRIPTION lists the PowerShell cheat sheet .DESCRIPTION lists the PowerShell cheat sheet

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX list-city-weather.ps1 .SYNTAX list-city-weather.ps1
.DESCRIPTION list the current weather of cities world-wide (west to east) .DESCRIPTION list the current weather of cities world-wide (west to east)
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX list-clipboard.ps1 .SYNTAX list-clipboard.ps1
.DESCRIPTION lists the contents of the clipboard .DESCRIPTION lists the contents of the clipboard
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX list-cmdlets.ps1 .SYNTAX list-cmdlets.ps1
.DESCRIPTION lists all PowerShell cmdlets .DESCRIPTION lists all PowerShell cmdlets

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX list-commits.ps1 [<repo-dir>] [<format>] .SYNTAX list-commits.ps1 [<repo-dir>] [<format>]
.DESCRIPTION lists all commits in the current/given Git repository .DESCRIPTION lists all commits in the current/given Git repository
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX list-dir-tree.ps1 [<dir-tree>] .SYNTAX list-dir-tree.ps1 [<dir-tree>]
.DESCRIPTION lists a directory tree .DESCRIPTION lists a directory tree
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX list-dir.ps1 [<directory>] .SYNTAX list-dir.ps1 [<directory>]
.DESCRIPTION lists the directory content formatted in columns .DESCRIPTION lists the directory content formatted in columns
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX list-drives.ps1 .SYNTAX list-drives.ps1
.DESCRIPTION lists all drives connected to the computer .DESCRIPTION lists all drives connected to the computer

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX list-earthquakes.ps1 .SYNTAX list-earthquakes.ps1
.DESCRIPTION lists earthquakes with magnitude >= 6.0 for the last 30 days .DESCRIPTION lists earthquakes with magnitude >= 6.0 for the last 30 days
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX list-emojis.ps1 .SYNTAX list-emojis.ps1
.DESCRIPTION lists the Emojis of Unicode 13.0 .DESCRIPTION lists the Emojis of Unicode 13.0
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX list-empty-dirs.ps1 [<dir-tree>] .SYNTAX list-empty-dirs.ps1 [<dir-tree>]
.DESCRIPTION lists empty subfolders within the given directory tree .DESCRIPTION lists empty subfolders within the given directory tree
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX list-empty-files.ps1 [<dir-tree>] .SYNTAX list-empty-files.ps1 [<dir-tree>]
.DESCRIPTION lists empty files within the given directory tree .DESCRIPTION lists empty files within the given directory tree

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX list-environment-variables.ps1 .SYNTAX list-environment-variables.ps1
.DESCRIPTION lists all environment variables .DESCRIPTION lists all environment variables

View File

@ -1,19 +1,15 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX list-files.ps1 [<folder>] .SYNTAX list-files.ps1 [<dir-tree>]
.DESCRIPTION lists all files in the given folder and also in every subfolder .DESCRIPTION lists all files in the given directory tree
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell
.NOTES Author: Markus Fleschutz / License: CC0 .NOTES Author: Markus Fleschutz / License: CC0
#> #>
param($Folder = "") param($DirTree = "")
if ($DirTree -eq "" ) { $DirTree = read-host "Enter path to directory tree" }
if ($Folder -eq "" ) {
$Folder = read-host "Enter path to folder"
}
try { try {
Get-ChildItem -path $Folder -recurse | select FullName Get-ChildItem -path $DirTree -recurse | select FullName
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX list-fritzbox-calls.ps1 [<username>] [<password>] .SYNTAX list-fritzbox-calls.ps1 [<username>] [<password>]
.DESCRIPTION lists the phone calls of the FRITZ!Box device .DESCRIPTION lists the phone calls of the FRITZ!Box device
@ -9,13 +8,8 @@
#Requires -Version 3 #Requires -Version 3
param($Username = "", $Password = "") param($Username = "", $Password = "")
if ($Username -eq "") { $Username = read-host "Enter username for FRITZ!Box" }
if ($Username -eq "") { if ($Password -eq "") { $Password = read-host "Enter password for FRITZ!Box" }
$Username = read-host "Enter username for FRITZ!Box"
}
if ($Password -eq "") {
$Password = read-host "Enter password for FRITZ!Box"
}
write-progress "Contacting FRITZ!Box ..." write-progress "Contacting FRITZ!Box ..."
$FQDN = "fritz.box" $FQDN = "fritz.box"

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX list-fritzbox-calls.ps1 [<username>] [<password>] .SYNTAX list-fritzbox-calls.ps1 [<username>] [<password>]
.DESCRIPTION lists FRITZ!Box's known devices .DESCRIPTION lists FRITZ!Box's known devices
@ -9,13 +8,8 @@
#Requires -Version 3 #Requires -Version 3
param($Username = "", $Password = "") param($Username = "", $Password = "")
if ($Username -eq "") { $Username = read-host "Enter username for FRITZ!Box" }
if ($Username -eq "") { if ($Password -eq "") { $Password = read-host "Enter password for FRITZ!Box" }
$Username = read-host "Enter username for FRITZ!Box"
}
if ($Password -eq "") {
$Password = read-host "Enter password for FRITZ!Box"
}
write-progress "Contacting FRITZ!Box ..." write-progress "Contacting FRITZ!Box ..."
[string]$HostURL = "https://fritz.box:49443" [string]$HostURL = "https://fritz.box:49443"

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX list-hidden-files.ps1 [<dir-tree>] .SYNTAX list-hidden-files.ps1 [<dir-tree>]
.DESCRIPTION lists hidden files within the given directory tree .DESCRIPTION lists hidden files within the given directory tree
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell
@ -9,9 +8,10 @@
param($DirTree = "$PWD") param($DirTree = "$PWD")
try { try {
$DirTree = resolve-path "$DirTree/" $DirTree = resolve-path "$DirTree"
[int]$Count = 0
write-progress "Listing hidden files in $DirTree ..." write-progress "Listing hidden files in $DirTree ..."
[int]$Count = 0
get-childItem "$DirTree" -attributes Hidden -recurse | foreach-object { get-childItem "$DirTree" -attributes Hidden -recurse | foreach-object {
"📄 $($_.FullName)" "📄 $($_.FullName)"
$Count++ $Count++

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX list-hourly-weather.ps1 [<location>] .SYNTAX list-hourly-weather.ps1 [<location>]
.DESCRIPTION lists the hourly weather today .DESCRIPTION lists the hourly weather today
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX list-installed-apps.ps1 .SYNTAX list-installed-apps.ps1
.DESCRIPTION lists the installed Windows Store apps .DESCRIPTION lists the installed Windows Store apps
@ -8,7 +7,6 @@
try { try {
get-appxPackage | select-object Name,Version | format-table -autoSize get-appxPackage | select-object Name,Version | format-table -autoSize
exit 0 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX list-installed-software.ps1 .SYNTAX list-installed-software.ps1
.DESCRIPTION lists the installed software (except Windows Store apps) .DESCRIPTION lists the installed software (except Windows Store apps)

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX list-logbook.ps1 .SYNTAX list-logbook.ps1
.DESCRIPTION lists the content of the logbook (in ../Data/logbook.csv) .DESCRIPTION lists the content of the logbook (in ../Data/logbook.csv)

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX list-modules.ps1 .SYNTAX list-modules.ps1
.DESCRIPTION lists all PowerShell modules .DESCRIPTION lists all PowerShell modules

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX list-network-shares.ps1 .SYNTAX list-network-shares.ps1
.DESCRIPTION lists the network shares of the local computer .DESCRIPTION lists the network shares of the local computer

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX list-news.ps1 [<RSS-URL>] .SYNTAX list-news.ps1 [<RSS-URL>]
.DESCRIPTION lists the latest news .DESCRIPTION lists the latest news
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX list-os-releases.ps1 .SYNTAX list-os-releases.ps1
.DESCRIPTION lists OS releases and download URL .DESCRIPTION lists OS releases and download URL

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX list-printers.ps1 .SYNTAX list-printers.ps1
.DESCRIPTION lists all printer known to the computer .DESCRIPTION lists all printer known to the computer

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX list-processes.ps1 .SYNTAX list-processes.ps1
.DESCRIPTION lists the local computer processes .DESCRIPTION lists the local computer processes

View File

@ -1,5 +1,4 @@
#!/usr/bin/pwsh <#
<#
.SYNTAX list-profiles.ps1 .SYNTAX list-profiles.ps1
.DESCRIPTION lists your PowerShell profiles .DESCRIPTION lists your PowerShell profiles
.LINK https://github.com/fleschutz/PowerShell .LINK https://github.com/fleschutz/PowerShell

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX list-random-passwords.ps1 [<password-length>] [<columns>] [<rows>] .SYNTAX list-random-passwords.ps1 [<password-length>] [<columns>] [<rows>]
.DESCRIPTION prints a list of random passwords .DESCRIPTION prints a list of random passwords

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX list-random-pins.ps1 [<pin-length>] [<columns>] [<rows>] .SYNTAX list-random-pins.ps1 [<pin-length>] [<columns>] [<rows>]
.DESCRIPTION prints a list of random PIN's .DESCRIPTION prints a list of random PIN's

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX list-scripts.ps1 .SYNTAX list-scripts.ps1
.DESCRIPTION lists all PowerShell scripts in this repository (sorted alphabetically) .DESCRIPTION lists all PowerShell scripts in this repository (sorted alphabetically)

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX list-services.ps1 .SYNTAX list-services.ps1
.DESCRIPTION lists the services on the local computer .DESCRIPTION lists the services on the local computer

View File

@ -1,4 +1,3 @@
#!/usr/bin/pwsh
<# <#
.SYNTAX list-system-info.ps1 .SYNTAX list-system-info.ps1
.DESCRIPTION lists system information on the local computer .DESCRIPTION lists system information on the local computer

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