Add example output

This commit is contained in:
Markus Fleschutz 2021-10-04 17:42:06 +02:00
parent 7ddc6617c6
commit a1ec7f0183
34 changed files with 57 additions and 18 deletions

View File

@ -1,10 +1,13 @@
<#
.SYNOPSIS
add-firewall-rules.ps1 [<path-to-executables>]
add-firewall-rules.ps1 [<PathToExecutables>]
.DESCRIPTION
Adds firewall rules for the given executables (needs administrator rights)
Adds firewall rules for the given executables (needs admin rights)
.EXAMPLE
PS> ./add-firewall-rules C:\MyApp\bin
Adding firewall rule for C:\MyApp\bin\app1.exe
Adding firewall rule for C:\MyApp\bin\app2.exe
...
.LINK
https://github.com/fleschutz/PowerShell
.NOTES

View File

@ -5,6 +5,7 @@
Adds the given memo text to $HOME/Memos.csv
.EXAMPLE
PS> ./add-memo "Buy apples"
added to 📄/home/markus/Memos.csv
.LINK
https://github.com/fleschutz/PowerShell
.NOTES

View File

@ -5,6 +5,7 @@
Change the working directory to the user's documents folder
.EXAMPLE
PS> ./cd-docs
📂/home/markus/Documents
.LINK
https://github.com/fleschutz/PowerShell
.NOTES

View File

@ -5,6 +5,7 @@
Change the working directory to the user's downloads folder
.EXAMPLE
PS> ./cd-downloads
📂/home/markus/Downloads
.LINK
https://github.com/fleschutz/PowerShell
.NOTES

View File

@ -5,6 +5,7 @@
Change the working directory to the user's Dropbox folder
.EXAMPLE
PS> ./cd-dropbox
📂/home/markus/Dropbox
.LINK
https://github.com/fleschutz/PowerShell
.NOTES

View File

@ -5,6 +5,7 @@
Change the working directory to the user's home directory
.EXAMPLE
PS> ./cd-home
📂/home/markus
.LINK
https://github.com/fleschutz/PowerShell
.NOTES

View File

@ -5,6 +5,7 @@
Change the working directory to the user's music folder
.EXAMPLE
PS> ./cd-music
📂/home/markus/Music
.LINK
https://github.com/fleschutz/PowerShell
.NOTES

View File

@ -5,6 +5,7 @@
Change the working directory to the user's OneDrive folder
.EXAMPLE
PS> ./cd-onedrive
📂/home/markus/OneDrive
.LINK
https://github.com/fleschutz/PowerShell
.NOTES

View File

@ -5,6 +5,7 @@
Change the working directory to the user's pictures folder
.EXAMPLE
PS> ./cd-pics
📂/home/markus/Pictures
.LINK
https://github.com/fleschutz/PowerShell
.NOTES

View File

@ -5,6 +5,7 @@
Change the working directory to the user's recycle bin folder
.EXAMPLE
PS> ./cd-recycle-bin
📂C:\$Recycle.Bin\S-1-5-21-123404-23309-294260-1001
.LINK
https://github.com/fleschutz/PowerShell
.NOTES

View File

@ -5,6 +5,7 @@
Change the working directory to the user's Git repositories folder
.EXAMPLE
PS> ./cd-repos
📂/home/markus/Repos
.LINK
https://github.com/fleschutz/PowerShell
.NOTES

View File

@ -5,6 +5,7 @@
Change the working directory to the root directory (C:\ on Windows)
.EXAMPLE
PS> ./cd-root
📂C:\
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -14,7 +15,7 @@
if ($IsLinux) {
$TargetDir = resolve-path "/"
} else {
$TargetDir = resolve-path "C:/"
$TargetDir = resolve-path "C:\"
}
if (-not(test-path "$TargetDir" -pathType container)) {
write-warning "Sorry, the root directory at 📂$TargetDir does not exist (yet)"

View File

@ -5,6 +5,7 @@
Change the working directory to the PowerShell scripts folder
.EXAMPLE
PS> ./cd-scripts
📂/home/markus/PowerShell/Scripts
.LINK
https://github.com/fleschutz/PowerShell
.NOTES

View File

@ -5,6 +5,7 @@
Change the working directory to the user's SSH folder
.EXAMPLE
PS> ./cd-ssh
📂/home/markus/.ssh
.LINK
https://github.com/fleschutz/PowerShell
.NOTES

View File

@ -5,6 +5,7 @@
Change the working directory to one level up
.EXAMPLE
PS> .\cd-up
(one level up)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES

View File

@ -5,6 +5,7 @@
Change the working directory to two directory levels up
.EXAMPLE
PS> ./cd-up2
(two levels up)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES

View File

@ -5,6 +5,7 @@
Change the working directory to three directory levels up
.EXAMPLE
PS> ./cd-up3
(three levels up)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES

View File

@ -5,6 +5,7 @@
Change the working directory to four directory levels up
.EXAMPLE
PS> ./cd-up4
(four levels up)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES

View File

@ -5,6 +5,7 @@
Change the working directory to the user's videos folder
.EXAMPLE
PS> ./cd-videos
📂/home/markus/Videos
.LINK
https://github.com/fleschutz/PowerShell
.NOTES

View File

@ -5,6 +5,7 @@
Checks the DNS resolution with frequently used domain names
.EXAMPLE
PS> ./check-dns-resolution
11.8 domains/sec (177 domains resolved in 15 sec)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -30,7 +31,7 @@ try {
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
$Average = [math]::round($Count / $Elapsed, 1)
"✔️ $Average domains/s ($Count domains resolved in $Elapsed sec)"
"✔️ $Average domains/sec ($Count domains resolved in $Elapsed sec)"
exit 0 # success
} catch {
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"

View File

@ -5,6 +5,7 @@
Checks a drive for free space left (20 GB by default)
.EXAMPLE
PS> ./check-drive-space C
172 GB left on drive C (61 of 233 GB used)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES

View File

@ -5,6 +5,7 @@
Checks the file system of a drive (needs admin rights)
.EXAMPLE
PS> ./check-file-system C
file system on drive C is clean
.LINK
https://github.com/fleschutz/PowerShell
.NOTES

View File

@ -5,6 +5,12 @@
Checks the health of the local computer
.EXAMPLE
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
19.7 domains/s (177 domains resolved in 9 sec)
29 ms ping average (13 ms min, 110 ms max, 10 hosts)
Windmill is healthy
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -12,9 +18,7 @@
License: CC0
#>
$Hostname = $(hostname)
$Healthy = 1
"Checking $Hostname's health..."
& "$PSScriptRoot/check-swap-space.ps1"
if ($lastExitCode -ne "0") { $Healthy = 0 }
@ -41,6 +45,7 @@ if ($IsLinux) {
if ($lastExitCode -ne "0") { $Healthy = 0 }
}
$Hostname = $(hostname)
if ($Healthy) {
"✔️ $Hostname is healthy"
exit 0 # success

View File

@ -1,10 +1,11 @@
<#
.SYNOPSIS
check-ipv4-address.ps1 [<address>]
check-ipv4-address.ps1 [<Address>]
.DESCRIPTION
Checks the given IPv4 address for validity
.EXAMPLE
PS> ./check-ipv4-address 192.168.11.22
IPv4 192.168.11.22 is valid
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -26,7 +27,7 @@ try {
if ($Address -eq "" ) { $Address = read-host "Enter IPv4 address to validate" }
if (IsIPv4AddressValid $Address) {
"✔️ IPv4 address $Address is valid"
"✔️ IPv4 $Address is valid"
exit 0 # success
} else {
write-warning "Invalid IPv4 address: $Address"

View File

@ -1,10 +1,11 @@
<#
.SYNOPSIS
check-ipv6-address.ps1 [<address>]
check-ipv6-address.ps1 [<Address>]
.DESCRIPTION
Checks the given IPv6 address for validity
.EXAMPLE
PS> ./check-ipv6-address fe80::200:5aee:feaa:20a2
IPv6 fe80::200:5aee:feaa:20a2 is valid
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -40,7 +41,7 @@ try {
$Address = read-host "Enter IPv6 address to validate"
}
if (IsIPv6AddressValid $Address) {
"✔️ IPv6 address $Address is valid"
"✔️ IPv6 $Address is valid"
exit 0 # success
} else {
write-warning "Invalid IPv6 address: $Address"

View File

@ -5,6 +5,7 @@
Checks the given MAC address for validity (MAC address like 00:00:00:00:00:00 or 00-00-00-00-00-00 or 000000000000).
.EXAMPLE
PS> ./check-mac-address 11:22:33:44:55:66
MAC address 11:22:33:44:55:66 is valid
.LINK
https://github.com/fleschutz/PowerShell
.NOTES

View File

@ -6,6 +6,7 @@
(default is: 'amazon.com,apple.com,bing.com,cnn.com,dropbox.com,facebook.com,google.com,live.com,twitter.com,youtube.com)
.EXAMPLE
PS> ./check-ping
36 ms ping average (13 ms min, 109 ms max, 10 hosts)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -34,7 +35,7 @@ try {
}
$Avg = $Avg / $Pings.count
"✔️ $Avg ms net latency average ($Min ms min, $Max ms max, $($Pings.count) hosts)"
"✔️ $Avg ms ping average ($Min ms min, $Max ms max, $($Pings.count) hosts)"
exit 0 # success
} catch {
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"

View File

@ -5,6 +5,7 @@
Checks the given subnet mask for validity
.EXAMPLE
PS> ./check-subnet-mask 255.255.255.0
subnet mask 255.255.255.0 is valid
.LINK
https://github.com/fleschutz/PowerShell
.NOTES

View File

@ -5,6 +5,7 @@
Checks the free swap space
.EXAMPLE
PS> ./check-swap-space
1213 GB left for swap space (67 of 1280 GB used)
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -36,7 +37,7 @@ try {
write-warning "Swap space has only $Free GB left to use! ($Used of $Total GB used, minimum is $MinLevel GB)"
exit 1
}
"✔️ $Free GB left on swap space ($Used of $Total GB used)"
"✔️ $Free GB left for swap space ($Used of $Total GB used)"
exit 0 # success
} catch {
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"

View File

@ -5,6 +5,7 @@
Checks the validity of the Windows system files (requires admin rights)
.EXAMPLE
PS> ./check-windows-system-files
checked Windows system files
.LINK
https://github.com/fleschutz/PowerShell
.NOTES

View File

@ -5,6 +5,7 @@
Checks the given XML file for validity
.EXAMPLE
PS> ./check-xml-file myfile.xml
XML file is valid
.NOTES
Author: Markus Fleschutz · License: CC0
.LINK

View File

@ -5,6 +5,8 @@
Cleans a Git repository from untracked files (including submodules, e.g. for a fresh build)
.EXAMPLE
PS> ./clean-repo C:\MyRepo
🧹 Cleaning Git repository 📂C:\MyRepo from untracked files...
cleaned Git repository 📂C:\MyRepo in 0 sec
.NOTES
Author: Markus Fleschutz · License: CC0
.LINK

View File

@ -6,6 +6,7 @@
NOTE: can not be undo!
.EXAMPLE
PS> ./clear-recycle-bin
cleared recycle bin
.NOTES
Author: Markus Fleschutz · License: CC0
.LINK

View File

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