Improved the scripts

This commit is contained in:
Markus Fleschutz 2021-01-27 15:12:17 +01:00
parent 676a0898a7
commit dcc52122c4
15 changed files with 92 additions and 96 deletions

View File

@ -9,8 +9,7 @@
param([string]$Path = "", [string]$Password = "")
function DecryptFile
{
function DecryptFile {
<#
.SYNOPSIS
Decrypts a file encrypted with Protect-File.

View File

@ -8,8 +8,7 @@
param([string]$Path = "", [string]$Password = "")
function EncryptFile
{
function EncryptFile {
<#
.SYNOPSIS
Encrypts a file using a symmetrical algorithm.

View File

@ -83,7 +83,7 @@ function New-Request {
$script:secport = (New-Request -urn "urn:dslforum-org:service:DeviceInfo:1" -action 'GetSecurityPort' -proto 'http').Envelope.Body.GetSecurityPortResponse.NewSecurityPort
function GetCallList() { param([int]$MaxEntries = 999, [int]$MaxDays = 999
function GetCallList { param([int]$MaxEntries = 999, [int]$MaxDays = 999
)
$resp = New-Request -urn 'urn:dslforum-org:service:X_AVM-DE_OnTel:1' -action 'GetCallList'
$list = [xml](new-object System.Net.WebClient).DownloadString("$($resp.Envelope.Body.GetCallListResponse.NewCallListURL)&max=$MaxEntries&MaxDays=$days")

View File

@ -12,7 +12,7 @@ $Lines = 24
$MinCharCode = 33
$MaxCharCode = 126
function GeneratePassword() {
function GeneratePassword {
$Generator = New-Object System.Random
for ($i = 0; $i -lt $PasswordLength; $i++) {
$Result += [char]$Generator.next($MinCharCode,$MaxCharCode)

View File

@ -8,7 +8,7 @@
param([int]$PinLength = 5, [int]$Columns = 12, [int]$Rows = 24)
function GeneratePIN() {
function GeneratePIN {
$Generator = New-Object System.Random
for ($i = 0; $i -lt $PinLength; $i++) {
$PIN += [char]$Generator.next(48,57)

View File

@ -85,7 +85,7 @@ function New-Request {
$script:secport = (New-Request -urn "urn:dslforum-org:service:DeviceInfo:1" -action 'GetSecurityPort' -proto 'http').Envelope.Body.GetSecurityPortResponse.NewSecurityPort
function Reboot-FritzBox() {
function Reboot-FritzBox {
$resp = New-Request -urn 'urn:dslforum-org:service:DeviceConfig:1' -action 'Reboot'
return $resp.Envelope.Body.InnerText
}

View File

@ -6,7 +6,7 @@
.NOTES Author: Markus Fleschutz / License: CC0
#>
function Speak([string]$Text) {
function Speak { param([string]$Text)
write-progress "$Text"
$Voice = new-object -ComObject SAPI.SPVoice
$Voices = $Voice.GetVoices()

View File

@ -8,7 +8,7 @@
param([string]$Filename = "")
function Speak([string]$Text) {
function Speak { param([string]$Text)
write-output "$Text"
$Voice = new-object -ComObject SAPI.SPVoice
$Voices = $Voice.GetVoices()

View File

@ -6,7 +6,7 @@
.NOTES Author: Markus Fleschutz / License: CC0
#>
function Speak([string]$Text) {
function Speak { param([string]$Text)
write-progress "$Text"
$Voice = new-object -ComObject SAPI.SPVoice
$Voices = $Voice.GetVoices()

View File

@ -8,7 +8,7 @@
param([string]$Directory = "")
function TakeScreenshot() { param([string]$FilePath)
function TakeScreenshot { param([string]$FilePath)
Add-Type -Assembly System.Windows.Forms
$ScreenBounds = [Windows.Forms.SystemInformation]::VirtualScreen
$ScreenshotObject = New-Object Drawing.Bitmap $ScreenBounds.Width, $ScreenBounds.Height

View File

@ -8,7 +8,7 @@
param([string]$Directory = "", [int]$Interval = 60)
function TakeScreenshot() { param([string]$FilePath)
function TakeScreenshot { param([string]$FilePath)
Add-Type -Assembly System.Windows.Forms
$ScreenBounds = [Windows.Forms.SystemInformation]::VirtualScreen
$ScreenshotObject = New-Object Drawing.Bitmap $ScreenBounds.Width, $ScreenBounds.Height

View File

@ -11,8 +11,7 @@ if ($Hostname -eq "" ) {
$Hostname = read-host "Enter hostname"
}
function Send-WOL
{
function Send-WOL {
<#
.SYNOPSIS
Send a WOL packet to a broadcast address

View File

@ -10,7 +10,7 @@ param([string]$Text = "")
Set-StrictMode -Version Latest
function BigA() { param([int]$Row)
function BigA { param([int]$Row)
switch($Row) {
1 { return " __ " }
2 { return " /__\ " }
@ -19,7 +19,7 @@ function BigA() { param([int]$Row)
}
}
function BigB() { param([int]$Row)
function BigB { param([int]$Row)
switch($Row) {
1 { return " ____ " }
2 { return "| _ )" }
@ -28,7 +28,7 @@ function BigB() { param([int]$Row)
}
}
function BigC() { param([int]$Row)
function BigC { param([int]$Row)
switch($Row) {
1 { return " ___ " }
2 { return " / __)" }
@ -37,7 +37,7 @@ function BigC() { param([int]$Row)
}
}
function BigD() { param([int]$Row)
function BigD { param([int]$Row)
switch($Row) {
1 { return " ____ " }
2 { return "| _ \ " }
@ -46,7 +46,7 @@ function BigD() { param([int]$Row)
}
}
function BigE() { param([int]$Row)
function BigE { param([int]$Row)
switch($Row) {
1 { return " ____ " }
2 { return "| ___)" }
@ -55,7 +55,7 @@ function BigE() { param([int]$Row)
}
}
function BigF() { param([int]$Row)
function BigF { param([int]$Row)
switch($Row) {
1 { return " ____ " }
2 { return "| ___)" }
@ -64,7 +64,7 @@ function BigF() { param([int]$Row)
}
}
function BigG() { param([int]$Row)
function BigG { param([int]$Row)
switch($Row) {
1 { return " ____ " }
2 { return " / ___)" }
@ -73,7 +73,7 @@ function BigG() { param([int]$Row)
}
}
function BigH() { param([int]$Row)
function BigH { param([int]$Row)
switch($Row) {
1 { return " _ _ " }
2 { return "| |_| |" }
@ -82,7 +82,7 @@ function BigH() { param([int]$Row)
}
}
function BigI() { param([int]$Row)
function BigI { param([int]$Row)
switch($Row) {
1 { return " _ " }
2 { return "| |" }
@ -91,7 +91,7 @@ function BigI() { param([int]$Row)
}
}
function BigJ() { param([int]$Row)
function BigJ { param([int]$Row)
switch($Row) {
1 { return " __ " }
2 { return " ( |" }
@ -100,7 +100,7 @@ function BigJ() { param([int]$Row)
}
}
function BigK() { param([int]$Row)
function BigK { param([int]$Row)
switch($Row) {
1 { return " _ _ " }
2 { return "| |/ )" }
@ -109,7 +109,7 @@ function BigK() { param([int]$Row)
}
}
function BigL() { param([int]$Row)
function BigL { param([int]$Row)
switch($Row) {
1 { return " _ " }
2 { return "| | " }
@ -118,7 +118,7 @@ function BigL() { param([int]$Row)
}
}
function BigM() { param([int]$Row)
function BigM { param([int]$Row)
switch($Row) {
1 { return " _ _ " }
2 { return "| \ / |" }
@ -127,7 +127,7 @@ function BigM() { param([int]$Row)
}
}
function BigN() { param([int]$Row)
function BigN { param([int]$Row)
switch($Row) {
1 { return " _ _ " }
2 { return "| \ | |" }
@ -136,7 +136,7 @@ function BigN() { param([int]$Row)
}
}
function BigO() { param([int]$Row)
function BigO { param([int]$Row)
switch($Row) {
1 { return " ___ " }
2 { return " / _ \ " }
@ -145,7 +145,7 @@ function BigO() { param([int]$Row)
}
}
function BigP() { param([int]$Row)
function BigP { param([int]$Row)
switch($Row) {
1 { return " ____ " }
2 { return "| _ \" }
@ -154,7 +154,7 @@ function BigP() { param([int]$Row)
}
}
function BigQ() { param([int]$Row)
function BigQ { param([int]$Row)
switch($Row) {
1 { return " ____ " }
2 { return " / _ \ " }
@ -163,7 +163,7 @@ function BigQ() { param([int]$Row)
}
}
function BigR() { param([int]$Row)
function BigR { param([int]$Row)
switch($Row) {
1 { return " ____ " }
2 { return "| _ \" }
@ -172,7 +172,7 @@ function BigR() { param([int]$Row)
}
}
function BigS() { param([int]$Row)
function BigS { param([int]$Row)
switch($Row) {
1 { return " ____ " }
2 { return "/ __)" }
@ -181,7 +181,7 @@ function BigS() { param([int]$Row)
}
}
function BigT() { param([int]$Row)
function BigT { param([int]$Row)
switch($Row) {
1 { return " _____ " }
2 { return "|_ _|" }
@ -190,7 +190,7 @@ function BigT() { param([int]$Row)
}
}
function BigU() { param([int]$Row)
function BigU { param([int]$Row)
switch($Row) {
1 { return " _ _ " }
2 { return "| | | |" }
@ -199,7 +199,7 @@ function BigU() { param([int]$Row)
}
}
function BigV() { param([int]$Row)
function BigV { param([int]$Row)
switch($Row) {
1 { return " _ _ " }
2 { return "( \/ )" }
@ -208,7 +208,7 @@ function BigV() { param([int]$Row)
}
}
function BigW() { param([int]$Row)
function BigW { param([int]$Row)
switch($Row) {
1 { return " __ __ " }
2 { return "\ \/\/ /" }
@ -217,7 +217,7 @@ function BigW() { param([int]$Row)
}
}
function BigX() { param([int]$Row)
function BigX { param([int]$Row)
switch($Row) {
1 { return " _ _ " }
2 { return "( \/ )" }
@ -226,7 +226,7 @@ function BigX() { param([int]$Row)
}
}
function BigY() { param([int]$Row)
function BigY { param([int]$Row)
switch($Row) {
1 { return " _ _ " }
2 { return "( \/ )" }
@ -235,7 +235,7 @@ function BigY() { param([int]$Row)
}
}
function BigZ() { param([int]$Row)
function BigZ { param([int]$Row)
switch($Row) {
1 { return " ____ " }
2 { return "(_ )" }
@ -244,8 +244,7 @@ function BigZ() { param([int]$Row)
}
}
function Big0() { param([int]$Row)
function Big0 { param([int]$Row)
switch($Row) {
1 { return " ___ " }
2 { return " / _ \ " }
@ -254,7 +253,7 @@ function Big0() { param([int]$Row)
}
}
function Big1() { param([int]$Row)
function Big1 { param([int]$Row)
switch($Row) {
1 { return " ___ " }
2 { return "/_ |" }
@ -263,7 +262,7 @@ function Big1() { param([int]$Row)
}
}
function Big2() { param([int]$Row)
function Big2 { param([int]$Row)
switch($Row) {
1 { return " ___ " }
2 { return "(__ \ " }
@ -272,7 +271,7 @@ function Big2() { param([int]$Row)
}
}
function Big3() { param([int]$Row)
function Big3 { param([int]$Row)
switch($Row) {
1 { return " ___ " }
2 { return "(__ )" }
@ -281,7 +280,7 @@ function Big3() { param([int]$Row)
}
}
function Big4() { param([int]$Row)
function Big4 { param([int]$Row)
switch($Row) {
1 { return " __ " }
2 { return " /. | " }
@ -290,7 +289,7 @@ function Big4() { param([int]$Row)
}
}
function Big5() { param([int]$Row)
function Big5 { param([int]$Row)
switch($Row) {
1 { return " ____ " }
2 { return "| ___)" }
@ -299,7 +298,7 @@ function Big5() { param([int]$Row)
}
}
function Big6() { param([int]$Row)
function Big6 { param([int]$Row)
switch($Row) {
1 { return " _ " }
2 { return " / ) " }
@ -308,7 +307,7 @@ function Big6() { param([int]$Row)
}
}
function Big7() { param([int]$Row)
function Big7 { param([int]$Row)
switch($Row) {
1 { return " ___ " }
2 { return "(__ )" }
@ -317,7 +316,7 @@ function Big7() { param([int]$Row)
}
}
function Big8() { param([int]$Row)
function Big8 { param([int]$Row)
switch($Row) {
1 { return " ___ " }
2 { return "( _ )" }
@ -326,7 +325,7 @@ function Big8() { param([int]$Row)
}
}
function Big9() { param([int]$Row)
function Big9 { param([int]$Row)
switch($Row) {
1 { return " ___ " }
2 { return "/ _ \" }
@ -335,7 +334,7 @@ function Big9() { param([int]$Row)
}
}
function BigColon() { param([int]$Row)
function BigColon { param([int]$Row)
switch($Row) {
1 { return " " }
2 { return " o " }
@ -344,7 +343,7 @@ function BigColon() { param([int]$Row)
}
}
function BigMinus() { param([int]$Row)
function BigMinus { param([int]$Row)
switch($Row) {
1 { return " " }
2 { return " ____ " }
@ -353,7 +352,7 @@ function BigMinus() { param([int]$Row)
}
}
function BigChar() { param([string]$Char, [int]$Row)
function BigChar { param([string]$Char, [int]$Row)
switch($Char) {
'A' { return BigA $Row }
'B' { return BigB $Row }

View File

@ -8,7 +8,7 @@
param([string]$Text = "")
function BrailleA() { param([int]$Row)
function BrailleA { param([int]$Row)
switch($Row) {
1 { return ".o" }
2 { return "oo" }
@ -16,7 +16,7 @@ function BrailleA() { param([int]$Row)
}
}
function BrailleB() { param([int]$Row)
function BrailleB { param([int]$Row)
switch($Row) {
1 { return ".o" }
2 { return ".o" }
@ -24,7 +24,7 @@ function BrailleB() { param([int]$Row)
}
}
function BrailleC() { param([int]$Row)
function BrailleC { param([int]$Row)
switch($Row) {
1 { return ".." }
2 { return "oo" }
@ -32,7 +32,7 @@ function BrailleC() { param([int]$Row)
}
}
function BrailleD() { param([int]$Row)
function BrailleD { param([int]$Row)
switch($Row) {
1 { return ".." }
2 { return "o." }
@ -40,7 +40,7 @@ function BrailleD() { param([int]$Row)
}
}
function BrailleE() { param([int]$Row)
function BrailleE { param([int]$Row)
switch($Row) {
1 { return ".o" }
2 { return "o." }
@ -48,7 +48,7 @@ function BrailleE() { param([int]$Row)
}
}
function BrailleF() { param([int]$Row)
function BrailleF { param([int]$Row)
switch($Row) {
1 { return ".." }
2 { return ".o" }
@ -56,7 +56,7 @@ function BrailleF() { param([int]$Row)
}
}
function BrailleG() { param([int]$Row)
function BrailleG { param([int]$Row)
switch($Row) {
1 { return ".." }
2 { return ".." }
@ -64,7 +64,7 @@ function BrailleG() { param([int]$Row)
}
}
function BrailleH() { param([int]$Row)
function BrailleH { param([int]$Row)
switch($Row) {
1 { return ".o" }
2 { return ".." }
@ -72,7 +72,7 @@ function BrailleH() { param([int]$Row)
}
}
function BrailleI() { param([int]$Row)
function BrailleI { param([int]$Row)
switch($Row) {
1 { return "o." }
2 { return ".o" }
@ -80,7 +80,7 @@ function BrailleI() { param([int]$Row)
}
}
function BrailleJ() { param([int]$Row)
function BrailleJ { param([int]$Row)
switch($Row) {
1 { return "o." }
2 { return ".." }
@ -88,7 +88,7 @@ function BrailleJ() { param([int]$Row)
}
}
function BrailleK() { param([int]$Row)
function BrailleK { param([int]$Row)
switch($Row) {
1 { return ".o" }
2 { return "oo" }
@ -96,7 +96,7 @@ function BrailleK() { param([int]$Row)
}
}
function BrailleL() { param([int]$Row)
function BrailleL { param([int]$Row)
switch($Row) {
1 { return ".o" }
2 { return ".o" }
@ -104,7 +104,7 @@ function BrailleL() { param([int]$Row)
}
}
function BrailleM() { param([int]$Row)
function BrailleM { param([int]$Row)
switch($Row) {
1 { return ".." }
2 { return "oo" }
@ -112,7 +112,7 @@ function BrailleM() { param([int]$Row)
}
}
function BrailleN() { param([int]$Row)
function BrailleN { param([int]$Row)
switch($Row) {
1 { return ".." }
2 { return "o." }
@ -120,7 +120,7 @@ function BrailleN() { param([int]$Row)
}
}
function BrailleO() { param([int]$Row)
function BrailleO { param([int]$Row)
switch($Row) {
1 { return ".o" }
2 { return "o." }
@ -128,7 +128,7 @@ function BrailleO() { param([int]$Row)
}
}
function BrailleP() { param([int]$Row)
function BrailleP { param([int]$Row)
switch($Row) {
1 { return ".." }
2 { return ".o" }
@ -136,7 +136,7 @@ function BrailleP() { param([int]$Row)
}
}
function BrailleQ() { param([int]$Row)
function BrailleQ { param([int]$Row)
switch($Row) {
1 { return ".." }
2 { return ".." }
@ -144,7 +144,7 @@ function BrailleQ() { param([int]$Row)
}
}
function BrailleR() { param([int]$Row)
function BrailleR { param([int]$Row)
switch($Row) {
1 { return ".o" }
2 { return ".." }
@ -152,7 +152,7 @@ function BrailleR() { param([int]$Row)
}
}
function BrailleS() { param([int]$Row)
function BrailleS { param([int]$Row)
switch($Row) {
1 { return "o." }
2 { return ".o" }
@ -160,7 +160,7 @@ function BrailleS() { param([int]$Row)
}
}
function BrailleT() { param([int]$Row)
function BrailleT { param([int]$Row)
switch($Row) {
1 { return "o." }
2 { return ".." }
@ -168,7 +168,7 @@ function BrailleT() { param([int]$Row)
}
}
function BrailleU() { param([int]$Row)
function BrailleU { param([int]$Row)
switch($Row) {
1 { return ".o" }
2 { return "oo" }
@ -176,7 +176,7 @@ function BrailleU() { param([int]$Row)
}
}
function BrailleV() { param([int]$Row)
function BrailleV { param([int]$Row)
switch($Row) {
1 { return ".o" }
2 { return ".o" }
@ -184,7 +184,7 @@ function BrailleV() { param([int]$Row)
}
}
function BrailleW() { param([int]$Row)
function BrailleW { param([int]$Row)
switch($Row) {
1 { return "o." }
2 { return ".." }
@ -192,7 +192,7 @@ function BrailleW() { param([int]$Row)
}
}
function BrailleX() { param([int]$Row)
function BrailleX { param([int]$Row)
switch($Row) {
1 { return ".." }
2 { return "oo" }
@ -200,7 +200,7 @@ function BrailleX() { param([int]$Row)
}
}
function BrailleY() { param([int]$Row)
function BrailleY { param([int]$Row)
switch($Row) {
1 { return ".." }
2 { return "o." }
@ -208,7 +208,7 @@ function BrailleY() { param([int]$Row)
}
}
function BrailleZ() { param([int]$Row)
function BrailleZ { param([int]$Row)
switch($Row) {
1 { return ".o" }
2 { return "o." }
@ -216,7 +216,7 @@ function BrailleZ() { param([int]$Row)
}
}
function Braille1() { param([int]$Row)
function Braille1 { param([int]$Row)
switch($Row) {
1 { return ".o" }
2 { return "oo" }
@ -224,7 +224,7 @@ function Braille1() { param([int]$Row)
}
}
function Braille2() { param([int]$Row)
function Braille2 { param([int]$Row)
switch($Row) {
1 { return ".o" }
2 { return ".o" }
@ -232,7 +232,7 @@ function Braille2() { param([int]$Row)
}
}
function Braille3() { param([int]$Row)
function Braille3 { param([int]$Row)
switch($Row) {
1 { return ".." }
2 { return "oo" }
@ -240,7 +240,7 @@ function Braille3() { param([int]$Row)
}
}
function Braille4() { param([int]$Row)
function Braille4 { param([int]$Row)
switch($Row) {
1 { return ".." }
2 { return "o." }
@ -248,7 +248,7 @@ function Braille4() { param([int]$Row)
}
}
function Braille5() { param([int]$Row)
function Braille5 { param([int]$Row)
switch($Row) {
1 { return ".o" }
2 { return "o." }
@ -256,7 +256,7 @@ function Braille5() { param([int]$Row)
}
}
function Braille6() { param([int]$Row)
function Braille6 { param([int]$Row)
switch($Row) {
1 { return ".." }
2 { return ".o" }
@ -264,7 +264,7 @@ function Braille6() { param([int]$Row)
}
}
function Braille7() { param([int]$Row)
function Braille7 { param([int]$Row)
switch($Row) {
1 { return ".." }
2 { return ".." }
@ -272,7 +272,7 @@ function Braille7() { param([int]$Row)
}
}
function Braille8() { param([int]$Row)
function Braille8 { param([int]$Row)
switch($Row) {
1 { return ".o" }
2 { return ".." }
@ -280,7 +280,7 @@ function Braille8() { param([int]$Row)
}
}
function Braille9() { param([int]$Row)
function Braille9 { param([int]$Row)
switch($Row) {
1 { return "o." }
2 { return ".o" }
@ -288,7 +288,7 @@ function Braille9() { param([int]$Row)
}
}
function Braille0() { param([int]$Row)
function Braille0 { param([int]$Row)
switch($Row) {
1 { return "o." }
2 { return ".." }
@ -296,7 +296,7 @@ function Braille0() { param([int]$Row)
}
}
function BrailleChar() { param([string]$Char, [int]$Row)
function BrailleChar { param([string]$Char, [int]$Row)
switch($Char) {
'A' { return BrailleA $Row }
'B' { return BrailleB $Row }

View File

@ -8,24 +8,24 @@
param([string]$Text = "", [int]$OneTimeUnit = 100) # in milliseconds
function gap() { param([int]$Length)
function gap { param([int]$Length)
for ([int]$i = 1; $i -lt $Length; $i++) {
write-host " " -nonewline
}
start-sleep -milliseconds ($Length * $OneTimeUnit)
}
function dot() {
function dot {
write-host "." -nonewline
start-sleep -milliseconds $OneTimeUnit # signal
}
function dash() {
function dash {
write-host "_" -nonewline
start-sleep -milliseconds (3 * $OneTimeUnit) # signal
}
function Char2MorseCode() { param([string]$Char)
function Char2MorseCode { param([string]$Char)
switch($Char) {
'A' { dot; gap 1; dash; gap 3 }
'B' { dash; gap 1; dot; gap 1; dot; gap 1; dot; gap 3 }