Updated some scripts

This commit is contained in:
Markus Fleschutz
2020-11-06 14:30:14 +00:00
parent 0ffef56c95
commit 946e76a5ca
11 changed files with 227 additions and 219 deletions

View File

@ -1,6 +1,6 @@
#!/snap/bin/powershell #!/snap/bin/powershell
# 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
# Author: Markus Fleschutz # Author: Markus Fleschutz
# Source: github.com/fleschutz/PowerShell # Source: github.com/fleschutz/PowerShell
@ -8,7 +8,7 @@
param([string]$File) param([string]$File)
if ($File -eq "" ) { if ($File -eq "" ) {
$File = read-host "Enter file: " $File = read-host "Enter file"
} }
try { try {

View File

@ -1,6 +1,6 @@
#!/snap/bin/powershell #!/snap/bin/powershell
# 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
# Author: Markus Fleschutz # Author: Markus Fleschutz
# Source: github.com/fleschutz/PowerShell # Source: github.com/fleschutz/PowerShell
@ -8,7 +8,7 @@
param([string]$File) param([string]$File)
if ($File -eq "" ) { if ($File -eq "" ) {
$File = read-host "Enter file: " $File = read-host "Enter file"
} }
try { try {

View File

@ -1,6 +1,6 @@
#!/snap/bin/powershell #!/snap/bin/powershell
# 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
# Author: Markus Fleschutz # Author: Markus Fleschutz
# Source: github.com/fleschutz/PowerShell # Source: github.com/fleschutz/PowerShell
@ -8,7 +8,7 @@
param([string]$File) param([string]$File)
if ($File -eq "" ) { if ($File -eq "" ) {
$File = read-host "Enter file: " $File = read-host "Enter file"
} }
try { try {

View File

@ -1,4 +1,4 @@
#!/snap/bin/powershell #!/snap/bin/powershell
# Syntax: ./crash_dumps.ps1 # Syntax: ./crash_dumps.ps1
# Description: enables crash dumps # Description: enables crash dumps

View File

@ -1,6 +1,6 @@
#!/snap/bin/powershell #!/snap/bin/powershell
# Syntax: ./download.ps1 <URL> # Syntax: ./download.ps1 [<URL>]
# Description: downloads the file/directory from the given URL # Description: downloads the file/directory from the given URL
# Author: Markus Fleschutz # Author: Markus Fleschutz
# Source: github.com/fleschutz/PowerShell # Source: github.com/fleschutz/PowerShell
@ -8,7 +8,7 @@
param([string]$URL) param([string]$URL)
if ($URL -eq "" ) { if ($URL -eq "" ) {
$URL = read-host "Enter URL to download: " $URL = read-host "Enter URL to download"
} }
try { try {

View File

@ -6,9 +6,9 @@
# Source: github.com/fleschutz/PowerShell # Source: github.com/fleschutz/PowerShell
# License: CC0 # License: CC0
$UserName = read-host "Your full name: " $UserName = read-host "Your full name"
$UserEmail = read-host "Your email address: " $UserEmail = read-host "Your email address"
$UserEditor = read-host "Your favorite editor (nano, vi, emacs): " $UserEditor = read-host "Your favorite editor (nano, vi, emacs)"
try { try {
git config --global user.name $UserName git config --global user.name $UserName

View File

@ -1,14 +1,18 @@
#!/snap/bin/powershell #!/snap/bin/powershell
# Syntax: ./latlong.ps1 <city> # Syntax: ./latlong.ps1 [<city>]
# Description: prints the lat/long coordinates of the given city # Description: prints the lat/long coordinates of the given city
# Author: Markus Fleschutz # Author: Markus Fleschutz
# Source: github.com/fleschutz/PowerShell # Source: github.com/fleschutz/PowerShell
# License: CC0 # License: CC0
param([string]$City) param([string]$City)
if ($City -eq "" ) {
$City = read-host "Enter city"
}
try { try {
write-progress "Reading worldcities.csv..."
$Table = import-csv worldcities.csv $Table = import-csv worldcities.csv
$FoundOne = 0 $FoundOne = 0
foreach($Row in $Table) { foreach($Row in $Table) {

View File

@ -1,4 +1,4 @@
#!/snap/bin/powershell #!/snap/bin/powershell
# Syntax: ./test.ps1 # Syntax: ./test.ps1
# Description: simple PowerShell test script # Description: simple PowerShell test script

View File

@ -1,11 +1,16 @@
#!/snap/bin/powershell #!/snap/bin/powershell
# Syntax: ./wakeup.ps1 # Syntax: ./wakeup.ps1 [<hostname>]
# Description: sends a magic packet to the given computer, waking him up # Description: sends a magic packet to the given computer, waking him up
# Author: Markus Fleschutz # Author: Markus Fleschutz
# Source: github.com/fleschutz/PowerShell # Source: github.com/fleschutz/PowerShell
# License: CC0 # License: CC0
param([string]$Hostname)
if ($Hostname -eq "" ) {
$Hostname = read-host "Enter hostname"
}
function Send-WOL function Send-WOL
{ {
<# <#
@ -39,7 +44,6 @@ $UDPclient.Connect($broadcast,$port)
[void]$UDPclient.Send($packet, 102) [void]$UDPclient.Send($packet, 102)
} }
$Hostname = read-host "Enter hostname: "
$MyMACAddresses = "io=11:22:33:44:55:66","pi=11:22:33:44:55:66" $MyMACAddresses = "io=11:22:33:44:55:66","pi=11:22:33:44:55:66"
try { try {