mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-02-02 10:59:14 +01:00
Improved the scripts
This commit is contained in:
parent
d5032a9d02
commit
87409780ff
@ -6,12 +6,13 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$File = "")
|
||||
param($File = "")
|
||||
|
||||
if ($File -eq "" ) {
|
||||
$File = read-host "Enter path to file"
|
||||
}
|
||||
|
||||
try {
|
||||
if ($File -eq "" ) {
|
||||
$File = read-host "Enter path to file"
|
||||
}
|
||||
$Result = get-filehash $File -algorithm MD5
|
||||
write-output "MD5 hash is" $Result.Hash
|
||||
exit 0
|
||||
|
@ -6,13 +6,13 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$File = "")
|
||||
param($File = "")
|
||||
|
||||
if ($File -eq "" ) {
|
||||
$File = read-host "Enter the filename"
|
||||
}
|
||||
|
||||
try {
|
||||
if ($File -eq "" ) {
|
||||
$File = read-host "Enter file"
|
||||
}
|
||||
|
||||
$Result = get-filehash $File -algorithm SHA1
|
||||
write-output "SHA1 hash is" $Result.Hash
|
||||
exit 0
|
||||
|
@ -6,13 +6,13 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$File = "")
|
||||
param($File = "")
|
||||
|
||||
if ($File -eq "" ) {
|
||||
$File = read-host "Enter the filename"
|
||||
}
|
||||
|
||||
try {
|
||||
if ($File -eq "" ) {
|
||||
$File = read-host "Enter file"
|
||||
}
|
||||
|
||||
$Result = get-filehash $File -algorithm SHA256
|
||||
write-output "SHA256 hash is:" $Result.Hash
|
||||
exit 0
|
||||
|
@ -6,7 +6,8 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$Message)
|
||||
param($Message = "")
|
||||
|
||||
if ($Message -eq "" ) {
|
||||
$URL = read-host "Enter alert message"
|
||||
}
|
||||
|
@ -8,11 +8,11 @@
|
||||
|
||||
param($DirTree = "")
|
||||
|
||||
try {
|
||||
if ($DirTree -eq "" ) {
|
||||
$DirTree = read-host "Enter the path to the directory tree"
|
||||
}
|
||||
if ($DirTree -eq "" ) {
|
||||
$DirTree = read-host "Enter the path to the directory tree"
|
||||
}
|
||||
|
||||
try {
|
||||
write-progress "Checking symlinks in $DirTree..."
|
||||
[int]$SymlinksTotal = [int]$SymlinksBroken = 0
|
||||
Get-ChildItem $DirTree -recurse | Where { $_.Attributes -match "ReparsePoint" } | ForEach-Object {
|
||||
|
@ -8,10 +8,11 @@
|
||||
|
||||
param($File = "")
|
||||
|
||||
if ($File -eq "" ) {
|
||||
$File = read-host "Enter path to XML file"
|
||||
}
|
||||
|
||||
try {
|
||||
if ($File -eq "" ) {
|
||||
$File = read-host "Enter path to XML file"
|
||||
}
|
||||
$XmlFile = Get-Item $File
|
||||
|
||||
$script:ErrorCount = 0
|
||||
|
@ -8,15 +8,15 @@
|
||||
|
||||
param($FullProgramName = "", $ProgramName = "", $ProgramAliasName = "")
|
||||
|
||||
try {
|
||||
if ($ProgramName -eq "") {
|
||||
get-process | where-object {$_.mainWindowTitle} | format-table Id, Name, mainWindowtitle -AutoSize
|
||||
$ProgramName = read-host "Enter program name"
|
||||
}
|
||||
if ($FullProgramName -eq "") {
|
||||
$FullProgramName = $ProgramName
|
||||
}
|
||||
if ($ProgramName -eq "") {
|
||||
get-process | where-object {$_.mainWindowTitle} | format-table Id, Name, mainWindowtitle -AutoSize
|
||||
$ProgramName = read-host "Enter program name"
|
||||
}
|
||||
if ($FullProgramName -eq "") {
|
||||
$FullProgramName = $ProgramName
|
||||
}
|
||||
|
||||
try {
|
||||
$Processes = get-process -name $ProgramName -errorAction 'silentlycontinue'
|
||||
if ($Processes.Count -ne 0) {
|
||||
foreach ($Process in $Processes) {
|
||||
|
@ -8,6 +8,16 @@
|
||||
|
||||
param($FullName = "", $EmailAddress = "", $FavoriteEditor = "")
|
||||
|
||||
if ($FullName -eq "") {
|
||||
$FullName = read-host "Enter your full name"
|
||||
}
|
||||
if ($EmailAddress -eq "") {
|
||||
$EmailAddress = read-host "Enter your e-mail address"
|
||||
}
|
||||
if ($FavoriteEditor -eq "") {
|
||||
$FavoriteEditor = read-host "Enter your favorite text editor (emacs,nano,vi,vim,...)"
|
||||
}
|
||||
|
||||
try {
|
||||
& git --version
|
||||
} catch {
|
||||
@ -16,15 +26,6 @@ try {
|
||||
}
|
||||
|
||||
try {
|
||||
if ($FullName -eq "") {
|
||||
$FullName = read-host "Enter your full name"
|
||||
}
|
||||
if ($EmailAddress -eq "") {
|
||||
$EmailAddress = read-host "Enter your e-mail address"
|
||||
}
|
||||
if ($FavoriteEditor -eq "") {
|
||||
$FavoriteEditor = read-host "Enter your favorite text editor (emacs,nano,vi,vim,...)"
|
||||
}
|
||||
& git config --global user.name $FullName
|
||||
& git config --global user.email $EmailAddress
|
||||
& git config --global core.editor $FavoriteEditor
|
||||
|
@ -8,14 +8,14 @@
|
||||
|
||||
param($Symlink = "", $Target = "")
|
||||
|
||||
try {
|
||||
if ($Symlink -eq "" ) {
|
||||
$Symlink = read-host "Enter filename of symlink"
|
||||
}
|
||||
if ($Target -eq "" ) {
|
||||
$Target = read-host "Enter path to target"
|
||||
}
|
||||
if ($Symlink -eq "" ) {
|
||||
$Symlink = read-host "Enter filename of symlink"
|
||||
}
|
||||
if ($Target -eq "" ) {
|
||||
$Target = read-host "Enter path to target"
|
||||
}
|
||||
|
||||
try {
|
||||
new-item -path "$Symlink" -itemType SymbolicLink -Value "$Target"
|
||||
|
||||
write-host -foregroundColor green "Done."
|
||||
|
@ -8,11 +8,11 @@
|
||||
|
||||
param([String]$Path)
|
||||
|
||||
try {
|
||||
if ($Path -eq "" ) {
|
||||
$Path = read-host "Enter path to CSV file"
|
||||
}
|
||||
if ($Path -eq "" ) {
|
||||
$Path = read-host "Enter path to CSV file"
|
||||
}
|
||||
|
||||
try {
|
||||
$Table = Import-CSV -path "$Path" -header A,B,C,D,E,F,G,H
|
||||
|
||||
foreach($Row in $Table) {
|
||||
|
@ -8,6 +8,10 @@
|
||||
|
||||
param($URL = "")
|
||||
|
||||
if ($URL -eq "" ) {
|
||||
$URL = read-host "Enter URL to download"
|
||||
}
|
||||
|
||||
try {
|
||||
& wget --version
|
||||
} catch {
|
||||
@ -16,10 +20,6 @@ try {
|
||||
}
|
||||
|
||||
try {
|
||||
if ($URL -eq "" ) {
|
||||
$URL = read-host "Enter URL to download"
|
||||
}
|
||||
|
||||
wget --mirror --convert-links --adjust-extension --page-requisites --no-parent $URL --directory-prefix . --no-verbose
|
||||
|
||||
write-host -foregroundColor green "Done."
|
||||
|
@ -8,13 +8,14 @@
|
||||
|
||||
param($Text = "", $ImageSize = "")
|
||||
|
||||
if ($Text -eq "") {
|
||||
$Text = read-input "Enter text or URL"
|
||||
}
|
||||
if ($ImageSize -eq "") {
|
||||
$ImageSize = read-input "Enter image size (e.g. 500x500)"
|
||||
}
|
||||
|
||||
try {
|
||||
if ($Text -eq "") {
|
||||
$Text = read-input "Enter text or URL"
|
||||
}
|
||||
if ($ImageSize -eq "") {
|
||||
$ImageSize = read-input "Enter image size (e.g. 500x500)"
|
||||
}
|
||||
$ECC = "M" # can be L, M, Q, H
|
||||
$QuietZone = 1
|
||||
$ForegroundColor = "000000"
|
||||
|
@ -6,12 +6,13 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$PathToExe)
|
||||
param($PathToExe = "")
|
||||
|
||||
if ($PathToExe -eq "" ) {
|
||||
$PathToExe = read-host "Enter path to executable file"
|
||||
}
|
||||
|
||||
try {
|
||||
if ($PathToExe -eq "" ) {
|
||||
$PathToExe = read-host "Enter path to executable file"
|
||||
}
|
||||
get-childitem $PathToExe | % {$_.VersionInfo} | Select *
|
||||
exit 0
|
||||
} catch {
|
||||
|
@ -6,7 +6,7 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$Word, [int]$Columns = 8)
|
||||
param($Word = "", [int]$Columns = 8)
|
||||
|
||||
function GetPermutations {
|
||||
[cmdletbinding()]
|
||||
|
@ -8,10 +8,11 @@
|
||||
|
||||
param($DirTree = "")
|
||||
|
||||
if ($DirTree -eq "" ) {
|
||||
$DirTree = read-host "Enter the path to the directory tree"
|
||||
}
|
||||
|
||||
try {
|
||||
if ($DirTree -eq "" ) {
|
||||
$DirTree = read-host "Enter the path to the directory tree"
|
||||
}
|
||||
write-progress "Listing empty directories in $DirTree..."
|
||||
[int]$Count = 0
|
||||
Get-ChildItem $DirTree -recurse | Where {$_.PSIsContainer -eq $true} | Where {$_.GetFileSystemInfos().Count -eq 0} | ForEach-Object {
|
||||
|
@ -8,10 +8,11 @@
|
||||
|
||||
param($DirTree = "")
|
||||
|
||||
if ($DirTree -eq "" ) {
|
||||
$DirTree = read-host "Enter the path to the directory tree"
|
||||
}
|
||||
|
||||
try {
|
||||
if ($DirTree -eq "" ) {
|
||||
$DirTree = read-host "Enter the path to the directory tree"
|
||||
}
|
||||
[int]$Count = 0
|
||||
write-progress "Listing empty files in $DirTree ..."
|
||||
get-childItem $DirTree -recurse | where {$_.PSIsContainer -eq $false} | where {$_.Length -eq 0} | foreach-object {
|
||||
|
@ -6,12 +6,13 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$Folder)
|
||||
param($Folder = "")
|
||||
|
||||
if ($Folder -eq "" ) {
|
||||
$Folder = read-host "Enter path to folder"
|
||||
}
|
||||
|
||||
try {
|
||||
if ($Folder -eq "" ) {
|
||||
[string]$Folder = read-host "Enter path to folder"
|
||||
}
|
||||
Get-ChildItem -path $Folder -recurse | select FullName
|
||||
exit 0
|
||||
} catch {
|
||||
|
@ -6,7 +6,7 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$Dir = "")
|
||||
param($Dir = "")
|
||||
|
||||
function ListDirectory { param([string]$Path)
|
||||
$Items = get-childItem -path $Path
|
||||
|
@ -8,13 +8,15 @@
|
||||
|
||||
#Requires -Version 3
|
||||
|
||||
param([string]$Username = "", [string]$Password = "")
|
||||
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"
|
||||
}
|
||||
|
||||
write-progress "Contacting FRITZ!Box ..."
|
||||
$FQDN = "fritz.box"
|
||||
|
||||
|
@ -8,13 +8,15 @@
|
||||
|
||||
#Requires -Version 3
|
||||
|
||||
param([string]$Username = "", [string]$Password = "")
|
||||
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"
|
||||
}
|
||||
|
||||
write-progress "Contacting FRITZ!Box ..."
|
||||
[string]$HostURL = "https://fritz.box:49443"
|
||||
[string]$SOAPAction="urn:dslforum-org:service:Hosts:1#X_AVM-DE_GetHostListPath"
|
||||
|
@ -6,7 +6,7 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$RSS_URL = "https://yahoo.com/news/rss/world")
|
||||
param($RSS_URL = "https://yahoo.com/news/rss/world")
|
||||
|
||||
try {
|
||||
[xml]$Content = (invoke-webRequest -URI $RSS_URL).Content
|
||||
|
@ -6,7 +6,7 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$DirTree, [int]$NumberOfDaysUnused)
|
||||
param($DirTree = "", [int]$NumberOfDaysUnused = 99)
|
||||
|
||||
write-host "Listing files in $DirTree with last access time older than $NumberOfDaysUnused days"
|
||||
|
||||
|
@ -6,10 +6,12 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$City)
|
||||
param($City = "")
|
||||
|
||||
if ($City -eq "" ) {
|
||||
$City = read-host "Enter the city"
|
||||
$City = read-host "Enter the city name"
|
||||
}
|
||||
|
||||
$PathToRepo = "$PSScriptRoot/.."
|
||||
|
||||
try {
|
||||
|
@ -7,10 +7,12 @@
|
||||
#>
|
||||
|
||||
param($IPaddr = "")
|
||||
|
||||
if ($IPaddr -eq "" ) {
|
||||
$IPaddr = read-host "Enter IP address to locate"
|
||||
}
|
||||
|
||||
try {
|
||||
if ($IPaddr -eq "" ) {
|
||||
$IPaddr = read-host "Enter IP address to locate"
|
||||
}
|
||||
$result = Invoke-RestMethod -Method Get -Uri "http://ip-api.com/json/$IPaddr"
|
||||
write-output $result
|
||||
exit 0
|
||||
|
@ -6,18 +6,18 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$CountryCode = "", [string]$ZipCode = "")
|
||||
$PathToRepo = "$PSScriptRoot/.."
|
||||
param($CountryCode = "", $ZipCode = "")
|
||||
|
||||
if ($CountryCode -eq "" ) {
|
||||
$CountryCode = read-host "Enter the country code"
|
||||
}
|
||||
if ($ZipCode -eq "" ) {
|
||||
$ZipCode = read-host "Enter the zip code"
|
||||
}
|
||||
|
||||
try {
|
||||
if ($CountryCode -eq "" ) {
|
||||
$CountryCode = read-host "Enter the country code"
|
||||
}
|
||||
if ($ZipCode -eq "" ) {
|
||||
$ZipCode = read-host "Enter the zip code"
|
||||
}
|
||||
|
||||
write-progress "Reading zip-codes.csv..."
|
||||
$PathToRepo = "$PSScriptRoot/.."
|
||||
$Table = import-csv "$PathToRepo/Data/zip-codes.csv"
|
||||
|
||||
$FoundOne = 0
|
||||
|
@ -6,12 +6,13 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$EmailAddress = "")
|
||||
param($EmailAddress = "")
|
||||
|
||||
if ($EmailAddress -eq "" ) {
|
||||
$EmailAddress = "markus@fleschutz.de"
|
||||
}
|
||||
|
||||
try {
|
||||
if ($EmailAddress -eq "" ) {
|
||||
$EmailAddress = "markus@fleschutz.de"
|
||||
}
|
||||
$URL="mailto:$EmailAddress"
|
||||
Start-Process $URL
|
||||
exit 0
|
||||
|
@ -6,12 +6,13 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$URL = "")
|
||||
param($URL = "")
|
||||
|
||||
if ($URL -eq "" ) {
|
||||
$URL = "http://www.fleschutz.de"
|
||||
}
|
||||
|
||||
try {
|
||||
if ($URL -eq "" ) {
|
||||
$URL = "http://www.fleschutz.de"
|
||||
}
|
||||
Start-Process $URL
|
||||
exit 0
|
||||
} catch {
|
||||
|
@ -8,10 +8,11 @@
|
||||
|
||||
param($Filename = "")
|
||||
|
||||
if ($Filename -eq "" ) {
|
||||
$Filename = read-host "Enter the M3U playlist filename"
|
||||
}
|
||||
|
||||
try {
|
||||
if ($Filename -eq "" ) {
|
||||
$Filename = read-host "Enter the M3U playlist filename"
|
||||
}
|
||||
$Lines = get-content $Filename
|
||||
|
||||
add-type -assemblyName presentationCore
|
||||
|
@ -8,10 +8,11 @@
|
||||
|
||||
param($Filename = "")
|
||||
|
||||
if ($Filename -eq "" ) {
|
||||
$Filename = read-host "Enter the MP3 filename"
|
||||
}
|
||||
|
||||
try {
|
||||
if ($Filename -eq "" ) {
|
||||
$Filename = read-host "Enter the MP3 filename"
|
||||
}
|
||||
add-type -assemblyName presentationCore
|
||||
$MediaPlayer = new-object system.windows.media.mediaplayer
|
||||
$MediaPlayer.open("$Filename")
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
#Requires -RunAsAdministrator
|
||||
|
||||
param([string]$Directory = "")
|
||||
param($Directory = "")
|
||||
|
||||
|
||||
function CheckIfInstalled {
|
||||
|
@ -6,7 +6,7 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$USERNAME = "", [string]$PASSWORD = "")
|
||||
param($USERNAME = "", $PASSWORD = "")
|
||||
if ($USERNAME -eq "") {
|
||||
$USERNAME = read-host "Enter username for FRITZ!Box"
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$Pattern = "", [string]$Path = "")
|
||||
param($Pattern = "", $Path = "")
|
||||
|
||||
function ListScripts { param([string]$Pattern, [string]$Path)
|
||||
$List = Select-String -Path $Path -Pattern "$Pattern"
|
||||
|
@ -6,7 +6,7 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$TargetIP = "", [int]$TargetPort = 0, [string]$Message = "")
|
||||
param($TargetIP = "", [int]$TargetPort = 0, $Message = "")
|
||||
|
||||
try {
|
||||
if ($TargetIP -eq "" ) {
|
||||
|
@ -6,7 +6,7 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$TargetIP = "", [int]$TargetPort = 0, [string]$Message = "")
|
||||
param($TargetIP = "", [int]$TargetPort = 0, $Message = "")
|
||||
|
||||
try {
|
||||
if ($TargetIP -eq "" ) {
|
||||
|
@ -8,11 +8,11 @@
|
||||
|
||||
param([int]$Seconds = 0)
|
||||
|
||||
try {
|
||||
if ($Seconds -eq 0 ) {
|
||||
[int]$Seconds = read-host "Enter number of seconds"
|
||||
}
|
||||
if ($Seconds -eq 0 ) {
|
||||
[int]$Seconds = read-host "Enter number of seconds"
|
||||
}
|
||||
|
||||
try {
|
||||
for ($i = $Seconds; $i -gt 0; $i--) {
|
||||
clear-host
|
||||
./write-big "T-$i seconds"
|
||||
|
@ -7,7 +7,7 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$ImageFile = "", [string]$Style = "Fit")
|
||||
param($ImageFile = "", $Style = "Fit")
|
||||
|
||||
function SetWallPaper {
|
||||
param([string]$Image, [ValidateSet('Fill', 'Fit', 'Stretch', 'Tile', 'Center', 'Span')][string]$Style)
|
||||
|
@ -8,10 +8,11 @@
|
||||
|
||||
param($IPaddress = "")
|
||||
|
||||
if ($IPaddress -eq "" ) {
|
||||
$IPaddress = read-host "Enter IP address of Shelly1 device"
|
||||
}
|
||||
|
||||
try {
|
||||
if ($IPaddress -eq "" ) {
|
||||
$IPaddress = read-host "Enter IP address of Shelly1 device"
|
||||
}
|
||||
for ([int]$i = 0; $i -lt 1000; $i++) {
|
||||
& ./switch-shelly1.ps1 $IPaddress on 0
|
||||
start-sleep -s 10
|
||||
|
@ -7,7 +7,7 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$Directory = "")
|
||||
param($Directory = "")
|
||||
|
||||
function WriteCsvHeader { param([PSCustomObject]$File)
|
||||
foreach($Entry in $File.ata_smart_attributes.table) {
|
||||
|
@ -6,7 +6,7 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$Filename = "")
|
||||
param($Filename = "")
|
||||
|
||||
function Speak { param([string]$Text)
|
||||
write-output "$Text"
|
||||
|
@ -6,12 +6,13 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$File = "")
|
||||
param($File = "")
|
||||
|
||||
if ($File -eq "") {
|
||||
$File = read-host "Enter path to text file"
|
||||
}
|
||||
|
||||
try {
|
||||
if ($File -eq "") {
|
||||
$File = read-host "Enter path to text file"
|
||||
}
|
||||
$Text = Get-Content $File
|
||||
|
||||
$Voice = new-object -ComObject SAPI.SPVoice
|
||||
|
@ -8,15 +8,16 @@
|
||||
|
||||
param($Text = "")
|
||||
|
||||
if ($Text -eq "") {
|
||||
$Text = read-host "Enter the text to speak"
|
||||
}
|
||||
|
||||
try {
|
||||
$Voice = new-object -ComObject SAPI.SPVoice
|
||||
$Voices = $Voice.GetVoices()
|
||||
foreach ($OtherVoice in $Voices) {
|
||||
$Description = $OtherVoice.GetDescription()
|
||||
if ($Description -like "*- German*") {
|
||||
if ($Text -eq "") {
|
||||
$Text = read-host "Enter the text to speak"
|
||||
}
|
||||
write-progress "$Text"
|
||||
$Voice.Voice = $OtherVoice
|
||||
[void]$Voice.Speak($Text)
|
||||
|
@ -6,13 +6,13 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$Text = "")
|
||||
param($Text = "")
|
||||
|
||||
if ($Text -eq "") {
|
||||
$Text = read-host "Enter the text to speak"
|
||||
}
|
||||
|
||||
try {
|
||||
if ($Text -eq "") {
|
||||
$Text = read-host "Enter the text to speak"
|
||||
}
|
||||
|
||||
$Voice = new-object -ComObject SAPI.SPVoice
|
||||
$Result = $Voice.Speak($Text)
|
||||
exit 0
|
||||
|
@ -8,6 +8,10 @@
|
||||
|
||||
param($Branch = "")
|
||||
|
||||
if ($Branch -eq "") {
|
||||
$Branch = read-host "Enter branch name to switch to"
|
||||
}
|
||||
|
||||
try {
|
||||
& git --version
|
||||
} catch {
|
||||
@ -16,10 +20,6 @@ try {
|
||||
}
|
||||
|
||||
try {
|
||||
if ($Branch -eq "") {
|
||||
$Branch = read-host "Enter branch name to switch to"
|
||||
}
|
||||
|
||||
& git switch --recurse-submodules $Branch
|
||||
if ($lastExitCode -ne "0") { throw "'git switch --recurse-submodules $Branch' failed" }
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$Directory = "")
|
||||
param($Directory = "")
|
||||
|
||||
function TakeScreenshot { param([string]$FilePath)
|
||||
Add-Type -Assembly System.Windows.Forms
|
||||
|
@ -6,7 +6,7 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$Directory = "", [int]$Interval = 60)
|
||||
param($Directory = "", [int]$Interval = 60)
|
||||
|
||||
function TakeScreenshot { param([string]$FilePath)
|
||||
Add-Type -Assembly System.Windows.Forms
|
||||
|
@ -8,18 +8,18 @@
|
||||
|
||||
param($File = "", $SourceLanguage = "", $TargetLanguage = "")
|
||||
|
||||
if ($File -eq "" ) {
|
||||
$File = read-host "Enter path to file"
|
||||
}
|
||||
if ($SourceLanguage -eq "" ) {
|
||||
$SourceLanguage = read-host "Enter language of this file"
|
||||
}
|
||||
if ($TargetLanguage -eq "" ) {
|
||||
$TargetLanguage = read-host "Enter language to translate to"
|
||||
}
|
||||
|
||||
try {
|
||||
$PathToRepo = "$PSScriptRoot/.."
|
||||
|
||||
if ($File -eq "" ) {
|
||||
$File = read-host "Enter path to file"
|
||||
}
|
||||
if ($SourceLanguage -eq "" ) {
|
||||
$SourceLanguage = read-host "Enter language of this file"
|
||||
}
|
||||
if ($TargetLanguage -eq "" ) {
|
||||
$TargetLanguage = read-host "Enter language to translate to"
|
||||
}
|
||||
|
||||
Start-Process -FilePath "$PathToRepo/Data/trans" -ArgumentList "-i $File -s $SourceLanguage -t $TargetLanguage -e google -brief" -NoNewWindow -Wait
|
||||
exit 0
|
||||
|
@ -8,6 +8,10 @@
|
||||
|
||||
param($Directory = "")
|
||||
|
||||
if ($Directory -eq "") {
|
||||
$Directory = "$PWD"
|
||||
}
|
||||
|
||||
try {
|
||||
& git --version
|
||||
} catch {
|
||||
@ -16,9 +20,6 @@ try {
|
||||
}
|
||||
|
||||
try {
|
||||
if ($Directory -eq "") {
|
||||
$Directory = "$PWD"
|
||||
}
|
||||
$Files = get-childItem -path $Directory
|
||||
foreach ($File in $Files) {
|
||||
if ($File.Mode -like "d*") {
|
||||
|
@ -6,7 +6,7 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$DirTree = "")
|
||||
param($DirTree = "")
|
||||
|
||||
function VisualizeDirectory { param([string]$Directory, [int]$Depth)
|
||||
$Depth++
|
||||
|
@ -6,7 +6,7 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$MACaddress = "", [string]$IPaddress = "")
|
||||
param($MACaddress = "", $IPaddress = "")
|
||||
|
||||
function Send-WOL { param([string]$mac, [string]$ip="255.255.255.255", [int]$port=9)
|
||||
$broadcast = [Net.IPAddress]::Parse($ip)
|
||||
|
@ -6,7 +6,7 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$Text = "")
|
||||
param($Text = "")
|
||||
|
||||
Set-StrictMode -Version Latest
|
||||
|
||||
|
@ -8,10 +8,11 @@
|
||||
|
||||
param($Text = "")
|
||||
|
||||
if ($Text -eq "" ) {
|
||||
$Text = read-host "Enter the text to write"
|
||||
}
|
||||
|
||||
try {
|
||||
if ($Text -eq "" ) {
|
||||
[String]$Text = read-host "Enter text to write"
|
||||
}
|
||||
write-host -foregroundColor blue $Text
|
||||
exit 0
|
||||
} catch {
|
||||
|
@ -6,7 +6,7 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$Text = "")
|
||||
param($Text = "")
|
||||
|
||||
function BrailleA { param([int]$Row)
|
||||
switch($Row) {
|
||||
|
@ -6,12 +6,13 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$Text = "")
|
||||
param($Text = "")
|
||||
|
||||
if ($Text -eq "" ) {
|
||||
$Text = read-host "Enter the text to write"
|
||||
}
|
||||
|
||||
try {
|
||||
if ($Text -eq "" ) {
|
||||
[string]$Text = read-host "Enter text to write"
|
||||
}
|
||||
write-host -foregroundColor green $Text
|
||||
exit 0
|
||||
} catch {
|
||||
|
@ -6,14 +6,15 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$Text = "")
|
||||
param($Text = "")
|
||||
|
||||
if ($Text -eq "" ) {
|
||||
$Text = read-host "Enter the text to write"
|
||||
}
|
||||
|
||||
try {
|
||||
$Time = get-date -format "yyyy-MM-ddTHH:mm:ssZ" -asUTC
|
||||
$User = $(whoami)
|
||||
if ($Text -eq "" ) {
|
||||
[string]$Text = read-host "Enter text to write"
|
||||
}
|
||||
$Line = "$Time,$User,$Text"
|
||||
|
||||
$PathToRepo=(get-item $MyInvocation.MyCommand.Path).directory.parent
|
||||
|
@ -6,10 +6,7 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$Text = "", [int]$Speed = 60) # 60 ms pause
|
||||
if ($Text -eq "") {
|
||||
$Text = "PowerShell is powerful! PowerShell is cross-platform! PowerShell is open-source! PowerShell is easy to learn! Powershell is fully documented"
|
||||
}
|
||||
param($Text = "PowerShell is powerful! PowerShell is cross-platform! PowerShell is open-source! PowerShell is easy to learn! Powershell is fully documented", [int]$Speed = 60) # 60 ms pause
|
||||
|
||||
function StartMarquee { param([string]$text)
|
||||
$Length = $text.Length
|
||||
|
@ -6,7 +6,7 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$Text = "", [int]$OneTimeUnit = 100) # in milliseconds
|
||||
param($Text = "", [int]$OneTimeUnit = 100) # in milliseconds
|
||||
|
||||
function gap { param([int]$Length)
|
||||
for ([int]$i = 1; $i -lt $Length; $i++) {
|
||||
|
@ -6,15 +6,11 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$Text = "")
|
||||
param($Text = "")
|
||||
|
||||
try {
|
||||
if ($Text -eq "" ) {
|
||||
[string]$Text = read-host "Enter text to write"
|
||||
}
|
||||
write-host -foregroundcolor red $Text
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
if ($Text -eq "" ) {
|
||||
$Text = read-host "Enter the text to write"
|
||||
}
|
||||
|
||||
write-host -foregroundcolor red $Text
|
||||
exit 0
|
||||
|
@ -6,7 +6,7 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$Text = "")
|
||||
param($Text = "")
|
||||
|
||||
function ROT13 { param([string]$Text)
|
||||
$Text.ToCharArray() | ForEach-Object {
|
||||
|
@ -6,11 +6,7 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$Text = "", [int]$Speed = 250) # in milliseconds
|
||||
|
||||
if ($Text -eq "" ) {
|
||||
$Text = "`nHello World`n-----------`nPowerShell is cross-platform`nPowerShell is open-source`nPowerShell is easy to learn`nPowerShell is fully documented`n`nThanks for watching`n`n:-)`n`n"
|
||||
}
|
||||
param($Text = "`nHello World`n-----------`nPowerShell is cross-platform`nPowerShell is open-source`nPowerShell is easy to learn`nPowerShell is fully documented`n`nThanks for watching`n`n:-)`n`n", [int]$Speed = 250) # in milliseconds
|
||||
|
||||
try {
|
||||
$Random = New-Object System.Random
|
||||
|
@ -6,12 +6,13 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$Text = "")
|
||||
param($Text = "")
|
||||
|
||||
if ($Text -eq "" ) {
|
||||
$Text = read-host "Enter the text to write"
|
||||
}
|
||||
|
||||
try {
|
||||
if ($Text -eq "" ) {
|
||||
[string]$Text = read-host "Enter text to write"
|
||||
}
|
||||
write-output $Text.ToUpper()
|
||||
exit 0
|
||||
} catch {
|
||||
|
@ -6,12 +6,13 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$Text = "")
|
||||
param($Text = "")
|
||||
|
||||
if ($Text -eq "" ) {
|
||||
$Text = read-host "Enter the text to write"
|
||||
}
|
||||
|
||||
try {
|
||||
if ($Text -eq "" ) {
|
||||
[String]$Text = read-host "Enter text to write"
|
||||
}
|
||||
[char[]]$TextArray = $Text
|
||||
foreach($Char in $TextArray) {
|
||||
write-output $Char
|
||||
|
@ -8,11 +8,11 @@
|
||||
|
||||
param($Directory = "")
|
||||
|
||||
try {
|
||||
if ($Directory -eq "" ) {
|
||||
$Directory = read-host "Enter path to directory to zip"
|
||||
}
|
||||
if ($Directory -eq "" ) {
|
||||
$Directory = read-host "Enter the path to the directory to zip"
|
||||
}
|
||||
|
||||
try {
|
||||
compress-archive -path $Directory -destinationPath $Directory.zip
|
||||
|
||||
write-host -foregroundColor green "Done - created zip archive $($Directory).zip"
|
||||
|
Loading…
Reference in New Issue
Block a user