mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-07-04 14:40:05 +02:00
Compare commits
324 Commits
Author | SHA1 | Date | |
---|---|---|---|
1008477d9d | |||
164cc3ba80 | |||
7c41820f13 | |||
d12a27ace0 | |||
489b0608e2 | |||
8947cbed1f | |||
2f53d5c1d6 | |||
042f45439d | |||
b098205d9c | |||
f12b44fb48 | |||
bc7ed352fa | |||
9c7a29cc8c | |||
5d76870f03 | |||
b9351c40c2 | |||
a378f3ae47 | |||
9bd33214b1 | |||
cd34307547 | |||
b73da7c2f7 | |||
53efcf0fc8 | |||
2345cc14c8 | |||
478d62aa89 | |||
cfaa7b48da | |||
b29648cd42 | |||
dc01730a4e | |||
c927d7263c | |||
0f9dcffc68 | |||
e2188fa160 | |||
dc7dd8d410 | |||
3ea4432a38 | |||
6f5af190c9 | |||
8dff4e1012 | |||
be5d5b88a1 | |||
be825c1787 | |||
96ff3574c2 | |||
1a30fef459 | |||
40d9935794 | |||
c9582b8209 | |||
a9de7630da | |||
f1d3bc31ec | |||
44414a6135 | |||
1f87722c2e | |||
c5bb8480f7 | |||
d01aa17c1f | |||
b24f7f9b5e | |||
8afe073e7e | |||
ea2c047548 | |||
c46fed2d97 | |||
c58b33b7d8 | |||
6406e4360b | |||
1a2abfaf61 | |||
f37ada4a70 | |||
67845aaf95 | |||
9791fe0c78 | |||
07fdba4d1d | |||
6b66cb1b6c | |||
1cc59bdce8 | |||
d9ab4a2fbc | |||
1a9fdfb337 | |||
855251d922 | |||
450869a593 | |||
7ab2795778 | |||
5706a11bdd | |||
df4db74657 | |||
b90f8cc67a | |||
f156c432e0 | |||
26bdaf68f5 | |||
d735015fb8 | |||
f170bc831c | |||
0c50ee42d5 | |||
0317186fc7 | |||
ee93d55dc1 | |||
0c543d5fd7 | |||
8f5b4a7337 | |||
59a7e492fe | |||
94455bb7c5 | |||
e99cf0d32b | |||
e98cae2a85 | |||
506e9b334d | |||
2041a385fa | |||
96635e4911 | |||
01dfa3b83c | |||
c556e36e69 | |||
91bd47182f | |||
2e22ac6c62 | |||
6daa6a19ca | |||
dec2cddd39 | |||
ea29869403 | |||
89a44fc88f | |||
df0696bdfb | |||
505b981eb6 | |||
fdd695f136 | |||
296ed2a05a | |||
63d5f5c796 | |||
6e6348ce7b | |||
c16b33c558 | |||
abebe6146b | |||
f228fb49e5 | |||
d1afd6d3c4 | |||
32693adfb8 | |||
02bea3708f | |||
5807a52423 | |||
5526385a7b | |||
4130f3657d | |||
7a918d799e | |||
acd26206a0 | |||
e9dd4329b0 | |||
bb5e5d4b82 | |||
f8eaf73614 | |||
5eaef30837 | |||
cb6679392b | |||
27899b0a2c | |||
9ac2dfad35 | |||
139e7a4dd9 | |||
6678dea5f7 | |||
b078b794e3 | |||
7e476ca1cb | |||
42512ee54a | |||
8e1a552dc2 | |||
f83042c654 | |||
7ffe1aae95 | |||
e273ec2d9e | |||
fbad5259f7 | |||
41ccb7867b | |||
139ceab42f | |||
fbec2c8587 | |||
567a0a4e69 | |||
6f9eb23523 | |||
f78a9390cb | |||
9aa997ebf5 | |||
370fe6c7dc | |||
76e6cc1118 | |||
2030dc3820 | |||
bea6e65d49 | |||
9e1c96d46f | |||
a67bff3cc8 | |||
52d81a2bed | |||
ef5367ed53 | |||
357ae2cea9 | |||
46f7fd7b9c | |||
f43dc498e4 | |||
8fe002a867 | |||
4de2d69d8f | |||
5694bced66 | |||
66131f8157 | |||
c9d8fb3947 | |||
f4ccf7806f | |||
50cabecd57 | |||
c0d474a674 | |||
a7206cb353 | |||
a65be7a067 | |||
1542765c41 | |||
24fffac7b8 | |||
e9c4c6415f | |||
55f9c2e19f | |||
df7cbfab55 | |||
e0a8a3b53b | |||
2b7b6fdf1a | |||
edb2bc56e6 | |||
a829a7c92d | |||
6e5d0d05cb | |||
a2a0c914fe | |||
f9a479b0f9 | |||
980a169bfc | |||
e3c9ab459e | |||
f8ca4ed78b | |||
392bfe11f8 | |||
2e5ee3f7eb | |||
62741a1fba | |||
c5fa0b574d | |||
e1951f0089 | |||
24707fbaca | |||
46b4b6b34f | |||
00d65402a9 | |||
505c5e35f3 | |||
992afad02c | |||
231e9431da | |||
093bcf7c26 | |||
6ec26b78b7 | |||
1d0cae88bb | |||
330fb1366a | |||
2536c282bb | |||
d3e82db87a | |||
38f7ddb157 | |||
a73e6d9885 | |||
99197dfc29 | |||
27aeeb9806 | |||
b351e570d9 | |||
e0204a009b | |||
bb5bb64827 | |||
f18ff005f6 | |||
39d253adf3 | |||
2ae727019b | |||
b2e571ec15 | |||
1907062856 | |||
154a753707 | |||
381c3b850f | |||
6cf41e4221 | |||
c65d4455e6 | |||
777fe6d09e | |||
1841a8a931 | |||
ee7fd35b75 | |||
2d7eb6f5a4 | |||
7b5ac5313b | |||
951242b201 | |||
009949ee76 | |||
958265793c | |||
ae17cdef1f | |||
590eedbb19 | |||
e393ceb329 | |||
31d4d2bf2d | |||
c4626a57ff | |||
663a487e0c | |||
52e3ea66a3 | |||
d10466f01c | |||
cfbad6f2d7 | |||
f8b4a31a5e | |||
fae4bad30f | |||
dba5880e41 | |||
e113db34f4 | |||
20c1d4beec | |||
d0e2939a73 | |||
49d81b01f2 | |||
f02f1e726b | |||
b1c3295c48 | |||
4cd9a5a4e2 | |||
5e1daeea5d | |||
25dd316328 | |||
2a743d6e63 | |||
3dddcf947b | |||
67f114831d | |||
3a0daeb85a | |||
d3b6934da7 | |||
4a4c074c83 | |||
b4ba271ff2 | |||
c297f70046 | |||
dbea806772 | |||
3e4abf7b30 | |||
a0fd0c984f | |||
8313e34cc1 | |||
896e424b28 | |||
19d0788e32 | |||
2d54d2216b | |||
6abed7f4a3 | |||
6fdc479d96 | |||
0d3f421d3a | |||
4d952583fd | |||
40081477db | |||
3acf39c851 | |||
565c45febe | |||
8f59a7fd0f | |||
1db1f5a0ec | |||
39fe061102 | |||
f7baec4716 | |||
6efc805a7d | |||
5d372fc184 | |||
8590dbcc55 | |||
5af77ba065 | |||
690c28a4e9 | |||
0813763857 | |||
4f95388537 | |||
424629ef94 | |||
6a0e3eb002 | |||
1fc4d5af0e | |||
85d3137b14 | |||
296886b362 | |||
2a2320603c | |||
c0f1301ac4 | |||
311b5571a3 | |||
9fad979652 | |||
60351adce2 | |||
5603555d48 | |||
d572bf467c | |||
bbc19d1116 | |||
447973357a | |||
e29e0c1c14 | |||
81098b2627 | |||
34d0066163 | |||
54d9084c0e | |||
673779a2b9 | |||
dd5b74feed | |||
556beb2e9e | |||
757694029c | |||
480dc16e64 | |||
83aa3ab77f | |||
8d6f38ff40 | |||
153bdabaec | |||
be123b5af8 | |||
17d4943291 | |||
73f0adffe6 | |||
5cb182921c | |||
a13800df86 | |||
cbfec35915 | |||
c2f7e55177 | |||
b2a3d9c052 | |||
a234770e97 | |||
1231ba7f26 | |||
de1b241593 | |||
242da20345 | |||
27e4dfb3da | |||
b8042d7368 | |||
ffabb1c8c6 | |||
ae5e4440c3 | |||
3ce85ad903 | |||
3485a5c4b8 | |||
c1376ed2bb | |||
8826b75506 | |||
925e0a1d35 | |||
7eea75db52 | |||
3af684d749 | |||
8b608c57a2 | |||
01df13393a | |||
d32de25b58 | |||
026b81cb9a | |||
71d4dff132 | |||
df7587b122 | |||
26087b76ae | |||
6fdea381c3 | |||
9d4b5a7b18 | |||
6fa8ed3a78 | |||
68711177c5 | |||
db26503982 | |||
d221ab23bd | |||
4ae46363dd | |||
b42a8ecf70 |
31
Data/Abbr/Aviation.csv
Normal file
31
Data/Abbr/Aviation.csv
Normal file
@ -0,0 +1,31 @@
|
||||
Abbr,Description
|
||||
AB,Air Base
|
||||
AC,Aircraft
|
||||
ACAS,Airborne Collision Avoidance System
|
||||
AF,Air Field
|
||||
AFM,Aircraft Flight Manual
|
||||
AIP,Aeronautical Information Publication
|
||||
AMAN,Arrival Manager
|
||||
AOA,Angle of Attack
|
||||
AOM,Airplane Operating Manual
|
||||
AOR,Area of Responsibility
|
||||
AFIS,Aerodrome Flight Information Service
|
||||
AFM,Airplane Flight Manual
|
||||
AGL,Above Ground Level
|
||||
AIP,Aeronautical Information Publication
|
||||
ANSP,Air Navigation Service Provider
|
||||
ATA,Actual Time of Arrival
|
||||
ATIS,Automatic Terminal Information Service
|
||||
ATO,Air Traffic Organization
|
||||
BAF,Belgian Air Force
|
||||
CAAC,Civil Aviation Administration of China
|
||||
CAAS,Civil Aviation Authorization of Singapore
|
||||
CANSO,Civil Air Navigation Services Organization (founded 1996, located in Amsterdam)
|
||||
CAS,Calibrated Airspeed
|
||||
CAT,Category of aircraft
|
||||
CAVOK,Ceiling And Visibility OK
|
||||
COG,Center of Gravity
|
||||
CRDA,Converging Runway Display Aid
|
||||
CTA,Controlled Time of Arrival
|
||||
CTOT,Calculated Take-Off Time
|
||||
IAS,Indicated Air Speed
|
Can't render this file because it has a wrong number of fields in line 23.
|
5843
Data/Abbr/Misc.csv
Normal file
5843
Data/Abbr/Misc.csv
Normal file
File diff suppressed because it is too large
Load Diff
185
Data/ISO639-1-language-codes.csv
Normal file
185
Data/ISO639-1-language-codes.csv
Normal file
@ -0,0 +1,185 @@
|
||||
alpha2,English
|
||||
aa,Afar
|
||||
ab,Abkhazian
|
||||
ae,Avestan
|
||||
af,Afrikaans
|
||||
ak,Akan
|
||||
am,Amharic
|
||||
an,Aragonese
|
||||
ar,Arabic
|
||||
as,Assamese
|
||||
av,Avaric
|
||||
ay,Aymara
|
||||
az,Azerbaijani
|
||||
ba,Bashkir
|
||||
be,Belarusian
|
||||
bg,Bulgarian
|
||||
bh,Bihari languages
|
||||
bi,Bislama
|
||||
bm,Bambara
|
||||
bn,Bengali
|
||||
bo,Tibetan
|
||||
br,Breton
|
||||
bs,Bosnian
|
||||
ca,Catalan; Valencian
|
||||
ce,Chechen
|
||||
ch,Chamorro
|
||||
co,Corsican
|
||||
cr,Cree
|
||||
cs,Czech
|
||||
cu,Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic
|
||||
cv,Chuvash
|
||||
cy,Welsh
|
||||
da,Danish
|
||||
de,German
|
||||
dv,Divehi; Dhivehi; Maldivian
|
||||
dz,Dzongkha
|
||||
ee,Ewe
|
||||
el,"Greek, Modern (1453-)"
|
||||
en,English
|
||||
eo,Esperanto
|
||||
es,Spanish; Castilian
|
||||
et,Estonian
|
||||
eu,Basque
|
||||
fa,Persian
|
||||
ff,Fulah
|
||||
fi,Finnish
|
||||
fj,Fijian
|
||||
fo,Faroese
|
||||
fr,French
|
||||
fy,Western Frisian
|
||||
ga,Irish
|
||||
gd,Gaelic; Scottish Gaelic
|
||||
gl,Galician
|
||||
gn,Guarani
|
||||
gu,Gujarati
|
||||
gv,Manx
|
||||
ha,Hausa
|
||||
he,Hebrew
|
||||
hi,Hindi
|
||||
ho,Hiri Motu
|
||||
hr,Croatian
|
||||
ht,Haitian; Haitian Creole
|
||||
hu,Hungarian
|
||||
hy,Armenian
|
||||
hz,Herero
|
||||
ia,Interlingua (International Auxiliary Language Association)
|
||||
id,Indonesian
|
||||
ie,Interlingue; Occidental
|
||||
ig,Igbo
|
||||
ii,Sichuan Yi; Nuosu
|
||||
ik,Inupiaq
|
||||
io,Ido
|
||||
is,Icelandic
|
||||
it,Italian
|
||||
iu,Inuktitut
|
||||
ja,Japanese
|
||||
jv,Javanese
|
||||
ka,Georgian
|
||||
kg,Kongo
|
||||
ki,Kikuyu; Gikuyu
|
||||
kj,Kuanyama; Kwanyama
|
||||
kk,Kazakh
|
||||
kl,Kalaallisut; Greenlandic
|
||||
km,Central Khmer
|
||||
kn,Kannada
|
||||
ko,Korean
|
||||
kr,Kanuri
|
||||
ks,Kashmiri
|
||||
ku,Kurdish
|
||||
kv,Komi
|
||||
kw,Cornish
|
||||
ky,Kirghiz; Kyrgyz
|
||||
la,Latin
|
||||
lb,Luxembourgish; Letzeburgesch
|
||||
lg,Ganda
|
||||
li,Limburgan; Limburger; Limburgish
|
||||
ln,Lingala
|
||||
lo,Lao
|
||||
lt,Lithuanian
|
||||
lu,Luba-Katanga
|
||||
lv,Latvian
|
||||
mg,Malagasy
|
||||
mh,Marshallese
|
||||
mi,Maori
|
||||
mk,Macedonian
|
||||
ml,Malayalam
|
||||
mn,Mongolian
|
||||
mr,Marathi
|
||||
ms,Malay
|
||||
mt,Maltese
|
||||
my,Burmese
|
||||
na,Nauru
|
||||
nb,"Bokmål, Norwegian; Norwegian Bokmål"
|
||||
nd,"Ndebele, North; North Ndebele"
|
||||
ne,Nepali
|
||||
ng,Ndonga
|
||||
nl,Dutch; Flemish
|
||||
nn,"Norwegian Nynorsk; Nynorsk, Norwegian"
|
||||
no,Norwegian
|
||||
nr,"Ndebele, South; South Ndebele"
|
||||
nv,Navajo; Navaho
|
||||
ny,Chichewa; Chewa; Nyanja
|
||||
oc,Occitan (post 1500)
|
||||
oj,Ojibwa
|
||||
om,Oromo
|
||||
or,Oriya
|
||||
os,Ossetian; Ossetic
|
||||
pa,Panjabi; Punjabi
|
||||
pi,Pali
|
||||
pl,Polish
|
||||
ps,Pushto; Pashto
|
||||
pt,Portuguese
|
||||
qu,Quechua
|
||||
rm,Romansh
|
||||
rn,Rundi
|
||||
ro,Romanian; Moldavian; Moldovan
|
||||
ru,Russian
|
||||
rw,Kinyarwanda
|
||||
sa,Sanskrit
|
||||
sc,Sardinian
|
||||
sd,Sindhi
|
||||
se,Northern Sami
|
||||
sg,Sango
|
||||
si,Sinhala; Sinhalese
|
||||
sk,Slovak
|
||||
sl,Slovenian
|
||||
sm,Samoan
|
||||
sn,Shona
|
||||
so,Somali
|
||||
sq,Albanian
|
||||
sr,Serbian
|
||||
ss,Swati
|
||||
st,"Sotho, Southern"
|
||||
su,Sundanese
|
||||
sv,Swedish
|
||||
sw,Swahili
|
||||
ta,Tamil
|
||||
te,Telugu
|
||||
tg,Tajik
|
||||
th,Thai
|
||||
ti,Tigrinya
|
||||
tk,Turkmen
|
||||
tl,Tagalog
|
||||
tn,Tswana
|
||||
to,Tonga (Tonga Islands)
|
||||
tr,Turkish
|
||||
ts,Tsonga
|
||||
tt,Tatar
|
||||
tw,Twi
|
||||
ty,Tahitian
|
||||
ug,Uighur; Uyghur
|
||||
uk,Ukrainian
|
||||
ur,Urdu
|
||||
uz,Uzbek
|
||||
ve,Venda
|
||||
vi,Vietnamese
|
||||
vo,Volapük
|
||||
wa,Walloon
|
||||
wo,Wolof
|
||||
xh,Xhosa
|
||||
yi,Yiddish
|
||||
yo,Yoruba
|
||||
za,Zhuang; Chuang
|
||||
zh,Chinese
|
||||
zu,Zulu
|
|
@ -12,7 +12,6 @@ all-in.de
|
||||
allgaeuer-zeitung.de
|
||||
alternate.de
|
||||
api.dropboxapi.com
|
||||
api.intelsa.intel.com
|
||||
api.met.no
|
||||
api1.origin.com
|
||||
arc.msn.com
|
||||
|
|
@ -1,4 +1,5 @@
|
||||
URL,Directory
|
||||
"https://github.com/abishekvashok/cmatrix", "cmatrix"
|
||||
"https://github.com/commonmark/cmark", "cmark"
|
||||
"https://github.com/elastic/elasticsearch", "elasticsearch"
|
||||
"https://github.com/fleschutz/CWTS", "CWTS"
|
||||
@ -6,6 +7,7 @@ URL,Directory
|
||||
"https://github.com/fleschutz/LSS", "LSS"
|
||||
"https://github.com/fleschutz/base256unicode", "base256unicode"
|
||||
"https://github.com/grafana/grafana", "grafana"
|
||||
"https://github.com/llvm/llvm-project", "llvm"
|
||||
"https://github.com/smartmontools/smartmontools", "smartmontools"
|
||||
"https://github.com/synesthesiam/voice2json", "voice2json"
|
||||
"https://github.com/TinyCC/tinycc", "tinycc"
|
|
@ -1,2 +0,0 @@
|
||||
Time,User,Text
|
||||
2020-12-24T09:24:30Z,mf,Hello World
|
|
117
Data/scripts.csv
117
Data/scripts.csv
@ -1,13 +1,42 @@
|
||||
Script,Description
|
||||
add-firewall-rules.ps1, adds firewall rules to the given executables (requires admin rights)
|
||||
add-firewall-rules.ps1, adds firewall rules to the given executables (needs admin rights)
|
||||
add-memo.ps1, adds the given memo text to $HOME/Memos.csv
|
||||
build-repo.ps1, builds the current/given Git repository
|
||||
build-repos.ps1, builds all Git repositories under the current/given directory
|
||||
cd-desktop.ps1, go to the user's desktop folder
|
||||
cd-docs.ps1, go to the user's documents folder
|
||||
cd-downloads.ps1, go to the user's downloads folder
|
||||
cd-dropbox.ps1, go to the user's Dropbox folder
|
||||
cd-home.ps1, go to the user's home folder
|
||||
cd-music.ps1, go to the user's music folder
|
||||
cd-onedrive.ps1, go to the user's OneDrive folder
|
||||
cd-pics.ps1, go to the user's pictures folder
|
||||
cd-recycle-bin.ps1, go to the user's recycle bin folder
|
||||
cd-repos.ps1, go to the user's Git repositories folder
|
||||
cd-root.ps1, go to the root directory (C: on Windows)
|
||||
cd-scripts.ps1, go to the PowerShell Scripts folder
|
||||
cd-up.ps1, go one directory level up
|
||||
cd-up2.ps1, go two directory levels up
|
||||
cd-up3.ps1, go three directory levels up
|
||||
cd-up4.ps1, go four directory levels up
|
||||
cd-videos.ps1, go to the user's videos folder
|
||||
check-cpu-temp.ps1, checks the CPU temperature
|
||||
check-dns-resolution.ps1, checks the DNS resolution with frequently used domain names
|
||||
check-drive-space.ps1, checks the given drive for free space left
|
||||
check-file-system.ps1, checks the validity of the file system (needs admin rights)
|
||||
check-health.ps1, checks the system health
|
||||
check-ipv4-address.ps1, checks the given IPv4 address for validity
|
||||
check-ipv6-address.ps1, checks the given IPv6 address for validity
|
||||
check-mac-address.ps1, checks the given MAC address for validity
|
||||
check-ping.ps1, checks the ping latency to the internet
|
||||
check-swap-space.ps1, checks the swap space for free space left
|
||||
check-symlinks.ps1, checks every symlink in the given directory tree
|
||||
check-weather.ps1, checks the current weather for critical values
|
||||
check-windows-system-files.ps1, checks the validity of the Windows system files
|
||||
check-xml-file.ps1, checks the given XML file for validity
|
||||
clean-branch.ps1, cleans the current Git branch (including submodules) from generated files
|
||||
cherry-picker.ps1, cherry-picks a Git commit into multiple branches
|
||||
clean-repo.ps1, cleans the current/given Git repository from untracked files (including submodules)
|
||||
clear-recycle-bin.ps1, removes the content of the recycle bin folder (can not be undo!)
|
||||
clone-repos.ps1, clones well-known Git repositories
|
||||
close-calculator.ps1, closes the calculator program gracefully
|
||||
close-chrome.ps1, closes Google Chrome gracefully
|
||||
@ -20,54 +49,82 @@ close-thunderbird.ps1, closes Mozilla Thunderbird gracefully
|
||||
close-vlc.ps1, closes the VLC media player gracefully
|
||||
close-windows-terminal.ps1, closes Windows Terminal gracefully
|
||||
configure-git.ps1, sets up the Git user configuration
|
||||
convert-csv2txt.ps1, converts the given CSV file into a text list
|
||||
convert-mysql2csv.ps1, converts the MySQL database table to a CSV file
|
||||
convert-sql2csv.ps1, converts the SQL database table to a CSV file
|
||||
convert-txt2wav.ps1, converts text into a audio .WAV file
|
||||
create-branch.ps1, creates a new branch in the current/given Git repository
|
||||
create-shortcut.ps1, creates a shortcut
|
||||
create-symlink.ps1, creates a symbolic link
|
||||
csv-to-text.ps1, converts the given CSV file into a text list
|
||||
create-tag.ps1, creates a new tag in the current/given Git repository
|
||||
daily-tasks.sh, execute PowerShell scripts automatically as daily tasks (Linux only)
|
||||
decrypt-file.ps1, decrypts the given file
|
||||
display-time.ps1, displays the current time for 10 seconds by default
|
||||
download.ps1, downloads the file/directory from the given URL
|
||||
download-dir.ps1, downloads a directory tree from the given URL
|
||||
download-file.ps1, downloads a file from the given URL
|
||||
edit.ps1, edits the given file with the built-in text editor
|
||||
enable-crash-dumps.ps1, enables the writing of crash dumps
|
||||
enable-god-mode.ps1, enables the god mode (adds a new icon to the desktop)
|
||||
enable-ssh-client.ps1, enables the SSH client (needs admin rights)
|
||||
enable-ssh-server.ps1, enables the SSH server (needs admin rights)
|
||||
encrypt-file.ps1, encrypts the given file
|
||||
fetch-repos.ps1, fetches all Git repositories under the current/given directory (including submodules)
|
||||
fetch-repo.ps1, fetches updates for the current/given Git repository (including submodules)
|
||||
fetch-repos.ps1, fetches updates for all Git repositories under the current/given directory (including submodules)
|
||||
generate-qrcode.ps1, generates a QR code
|
||||
go-downloads.ps1, go to the user's downloads folder
|
||||
go-home.ps1, go to the user's home folder
|
||||
go-music.ps1, go to the user's music folder
|
||||
go-scripts.ps1, go to the PowerShell Scripts folder
|
||||
hibernate.ps1, enables hibernate mode for the local computer (requires admin rights)
|
||||
hibernate.ps1, enables hibernate mode for the local computer (needs admin rights)
|
||||
inspect-exe.ps1, prints basic information of the given executable file
|
||||
install-google-chrome.ps1, installs the Google Chrome browser
|
||||
introduce-powershell.ps1, introduces PowerShell to new users
|
||||
list-aliases.ps1, lists all PowerShell aliases
|
||||
list-anagrams.ps1, lists all anagrams of the given word
|
||||
list-automatic-variables.ps1, lists the automatic variables of PowerShell
|
||||
list-branches.ps1, lists the branches of the current/given Git repository
|
||||
list-current-timezone.ps1, lists the current time zone details
|
||||
list-branches.ps1, lists all branches in the current/given Git repository
|
||||
list-cheat-sheet.ps1, lists the PowerShell cheat sheet
|
||||
list-city-weather.ps1, lists the current weather of cities worldwide (east to west)
|
||||
list-commits.ps1, lists all commits in the current/given Git repository
|
||||
list-clipboard.ps1, lists the contents of the clipboard
|
||||
list-credits.ps1, shows the credits
|
||||
list-dir.ps1, lists the directory content (formatted in columns)
|
||||
list-dir-tree.ps1, lists the directory tree content
|
||||
list-drives.ps1, lists all drives
|
||||
list-environment-variables.ps1, lists all environment variables
|
||||
list-emojis.ps1, lists the emojis of Unicode 13.0
|
||||
list-empty-dirs.ps1, lists empty subfolders within the given directory tree
|
||||
list-empty-files.ps1, lists empty files within the given directory tree
|
||||
list-files.ps1, lists all files in the given folder and also in every subfolder
|
||||
list-formatted.ps1, lists the current working directory formatted in columns
|
||||
list-fritzbox-calls.ps1, lists the FRITZ!Box calls
|
||||
list-fritzbox-devices.ps1, lists FRITZ!Box's known devices
|
||||
list-hidden-files.ps1, lists hidden files within the given directory tree
|
||||
list-installed-apps.ps1, lists the installed Windows Store apps
|
||||
list-installed-software.ps1, lists the installed software (except Windows Store apps)
|
||||
list-logbook.ps1, lists the content of the logbook
|
||||
list-latest-tag.ps1, lists the latest tag on the current branch in a Git repository
|
||||
list-memos.ps1, lists the memos at $HOME/Memos.csv
|
||||
list-unused-files.ps1, lists unused files in a directory tree
|
||||
list-cmdlets.ps1, lists the PowerShell cmdlets
|
||||
list-earthquakes.ps1, lists earthquakes with magnitude >= 6.0 for the last 30 days
|
||||
list-modules.ps1, lists the PowerShell modules
|
||||
list-mysql-tables.ps1, lists the MySQL server tables
|
||||
list-network-shares.ps1, lists the network shares of the local computer
|
||||
list-news.ps1, lists the latest news
|
||||
list-os-releases.ps1, lists OS releases and download URL
|
||||
list-os-releases.ps1, lists operating system releases and download URL
|
||||
list-os-updates.ps1, lists operating system updates
|
||||
list-printers.ps1, lists all printer known to the computer
|
||||
list-processes.ps1, lists the local computer processes
|
||||
list-profiles.ps1, lists your PowerShell profiles
|
||||
list-random-passwords.ps1, prints a list of random passwords
|
||||
list-random-pins.ps1, prints a list of random PIN's
|
||||
list-recycle-bin.ps1, lists the content of the recycle bin folder
|
||||
list-scripts.ps1, lists all PowerShell scripts in this repository
|
||||
list-services.ps1, lists the services on the local computer
|
||||
list-sql-tables.ps1, lists the SQL server tables
|
||||
list-system-info.ps1, lists system information on the local computer
|
||||
list-tags.ps1, lists all tags in the current/given Git repository
|
||||
list-tasks.ps1, lists all Windows scheduler tasks
|
||||
list-timezone.ps1, lists the current time zone details
|
||||
list-timezones.ps1, lists all time zones available
|
||||
list-user-groups.ps1, lists the user groups on the local computer
|
||||
list-weather.ps1, lists the hourly weather
|
||||
list-workdir.ps1, lists the current working directory
|
||||
locate-city.ps1, prints the geographic location of the given city
|
||||
locate-ipaddress.ps1, prints the geographic location of the given IP address
|
||||
locate-zip-code.ps1, prints the geographic location of the given zip-code
|
||||
@ -79,18 +136,24 @@ next-joke.ps1], gets the next random Juck Norris joke
|
||||
open-browser.ps1, starts the default Web browser
|
||||
open-calculator.ps1, starts the calculator program
|
||||
open-email-client.ps1, starts the default email client
|
||||
open-file-explorer.ps1, starts the Microsoft File Explorer
|
||||
open-recycle-bin.ps1, starts the File Explorer with the recycle bin folder
|
||||
play-beep.ps1, plays a beep sound
|
||||
play-files.ps1, plays the given audio files
|
||||
play-mission-impossible.ps1, plays the Mission Impossible theme
|
||||
play-m3u.ps1, plays the given playlist (M3U file format)
|
||||
play-mp3.ps1, plays the given sound file (MP3 file format)
|
||||
play-super-mario.ps1, plays the Super Mario Intro
|
||||
play-the-imperial-march.ps1, plays the Imperial March (Star Wars)
|
||||
poweroff.ps1, halts the local computer (requires admin rights)
|
||||
poweroff.ps1, halts the local computer (needs admin rights)
|
||||
pull-repo.ps1, pulls updates for the current/given Git repository (including submodules)
|
||||
pull-repos.ps1, pulls updates for all Git repositories under the current/given directory (including submodules)
|
||||
query-smart-data.ps1, queries the S.M.A.R.T. data of your HDD/SSD's and saves it to the current/given directory
|
||||
new-email.ps1, starts the default email client to write a new email
|
||||
reboot.ps1, reboots the local computer (requires admin rights)
|
||||
reboot.ps1, reboots the local computer (needs admin rights)
|
||||
reboot-fritzbox.ps1, reboots the FRITZ!box device
|
||||
remove-empty-dirs.ps1, removes empty subfolders within the given directory tree
|
||||
search-filename.ps1, searches the directory tree for filenames by given pattern
|
||||
search-files.ps1, searches the given pattern in the given files
|
||||
scan-ports.ps1, scans the network for open/closed ports
|
||||
send-email.ps1, sends an email message
|
||||
@ -101,9 +164,9 @@ set-timer.ps1, sets a timer for a countdown
|
||||
set-wallpaper.ps1, sets the given image as wallpaper
|
||||
SHA1.ps1, prints the SHA1 checksum of the given file
|
||||
SHA256.ps1, prints the SHA256 checksum of the given file
|
||||
show-dir-tree.ps1, visualizes the given/current directory tree
|
||||
simulate-matrix.ps1, simulates the Matrix (fun)
|
||||
simulate-presence.ps1, simulates the human presence against burglars
|
||||
speak-countdown.ps1, starts a countdown by text-to-speech (TTS)
|
||||
speak-date.ps1, speaks the current date by text-to-speech (TTS)
|
||||
speak-english.ps1, speaks the given text with an English text-to-speech (TTS) voice
|
||||
speak-epub.ps1, speaks the content of the given Epub file by text-to-speech (TTS)
|
||||
@ -113,29 +176,29 @@ speak-joke.ps1, speaks the next joke by text-to-speech (TTS)
|
||||
speak-test.ps1, performs a speak test by text-to-speech (TTS)
|
||||
speak-text.ps1, speaks the given text by text-to-speech (TTS)
|
||||
speak-time.ps1, speaks the current time by text-to-speech (TTS)
|
||||
switch-branch.ps1, switches the current Git repository to the given branch (including submodules)
|
||||
switch-branch.ps1, switches the branch in the current/given Git repository (including submodules)
|
||||
switch-shelly1.ps1, switches a Shelly1 device in the local network
|
||||
sync-repo.ps1, synchronizes a Git repository by push & pull (including submodules)
|
||||
take-screenshot.ps1, takes a single screenshot
|
||||
take-screenshots.ps1, takes multiple screenshots
|
||||
train-dns-cache.ps1, trains the DNS cache with frequently used domain names
|
||||
translate-file.ps1, translates the given text file into another language
|
||||
translate-files.ps1, translates the given text files into any supported language
|
||||
translate-text.ps1, translates the given text into other languages
|
||||
turn-volume-up.ps1, turns the audio volume up (+10% by default)
|
||||
turn-volume-down.ps1, turns the audio volume down (-10% by default)
|
||||
txt2wav.ps1, converts text into a audio .WAV file
|
||||
unmute-audio.ps1, unmutes audio
|
||||
update-repos.ps1, updates all Git repositories under the current/given directory (including submodules)
|
||||
upload-file.ps1, uploads the local file to the given FTP server
|
||||
voice-control.ps1, executes the PowerShell scripts by voice
|
||||
weather.ps1, prints the current weather forecast
|
||||
weather-alert.ps1, checks the current weather for critical values
|
||||
weather-report.ps1, prints the local weather report
|
||||
weather-worldwide.ps1, prints the current weather of cities worldwide
|
||||
wakeup.ps1, sends a magic packet to the given computer, waking him up
|
||||
weather.ps1, prints the current weather forecast
|
||||
weather-report.ps1, prints the local weather report
|
||||
what-is.ps1, prints a description of the given abbreviation
|
||||
write-animated.ps1, writes animated text
|
||||
write-big.ps1, writes the given text in big letters
|
||||
write-blue.ps1, writes the given text in a blue foreground color
|
||||
write-braille.ps1, writes the given text in Braille
|
||||
write-green.ps1, writes the given text in a green foreground color
|
||||
write-logbook.ps1, writes the given text to the logbook
|
||||
write-lowercase.ps1, writes the given text in lowercase letters
|
||||
write-marquee.ps1, writes the given text as marquee
|
||||
write-morse-code.ps1, writes the given text in Morse code
|
||||
write-motd.ps1, writes the message of the day (MOTD)
|
||||
|
Can't render this file because it has a wrong number of fields in line 192.
|
58
Misc/FAQ.md
58
Misc/FAQ.md
@ -1,54 +1,52 @@
|
||||
PowerShell Scripts FAQ
|
||||
======================
|
||||
PowerShell FAQ
|
||||
==============
|
||||
|
||||
What is PowerShell?
|
||||
-------------------
|
||||
PowerShell is a task automation and configuration management framework from Microsoft, consisting of a command-line shell and associated scripting language.
|
||||
|
||||
Why use PowerShell?
|
||||
-------------------
|
||||
* **it's powerful**: fully control your computer
|
||||
* **it's cross-platform**: available for Linux, Mac OS and Windows
|
||||
* **it's open-source**: see the Github repository at https://github.com/PowerShell/PowerShell
|
||||
* **it's open-source and free**: see the Github repository at https://github.com/PowerShell/PowerShell
|
||||
* **it's easy to learn**: see the tutorial at https://www.guru99.com/powershell-tutorial.html
|
||||
* **it's fully documented**: see the official docs at https://docs.microsoft.com/en-us/powershell/
|
||||
|
||||
How to get PowerShell?
|
||||
----------------------
|
||||
* **Windows 7 and newer** do provide PowerShell by default. However, script execution is **not allowed by default** (execution policy is "restricted"). To enable this, enter as administrator:
|
||||
* **On Windows 7 and newer** PowerShell is provided by default. However, script execution is **not allowed by default** (execution policy is "restricted"). To enable this, enter as administrator:
|
||||
```
|
||||
$ Set-ExecutionPolicy RemoteSigned
|
||||
```
|
||||
* **On CentOS, Debian, Docker, Fedora, macOS, openSUSE, Red Hat, Ubuntu** visit https://github.com/PowerShell/PowerShell for installation.
|
||||
* **Want to use Snaps?** Install the PowerShell snap by executing:
|
||||
```
|
||||
$ snap install PowerShell
|
||||
$ ln -s /snap/bin/powershell /bin/powershell
|
||||
$ ln -s /snap/bin/pwsh /usr/bin/pwsh
|
||||
```
|
||||
* **On CentOS, Debian, Docker, Fedora, macOS, openSUSE, Red Hat, Ubuntu** visit https://github.com/PowerShell/PowerShell for installation.
|
||||
|
||||
|
||||
How to get the PowerShell Scripts?
|
||||
----------------------------------
|
||||
Git users do execute:
|
||||
```
|
||||
$ git clone https://github.com/fleschutz/PowerShell
|
||||
```
|
||||
* Git users execute: `$ git clone https://github.com/fleschutz/PowerShell`
|
||||
* otherwise download it from: https://github.com/fleschutz/PowerShell/archive/master.zip
|
||||
|
||||
otherwise simply download it from:
|
||||
|
||||
https://github.com/fleschutz/PowerShell/archive/master.zip
|
||||
Some Scripts show gibberish characters. How to fix that?
|
||||
--------------------------------------------------------
|
||||
The PowerShell scripts support Unicode input & output! Use a modern console supporting UTF-8 such as Windows Terminal.
|
||||
|
||||
|
||||
How to Configure PowerShell as Default Shell?
|
||||
---------------------------------------------
|
||||
* **Linux:** make sure PowerShell is installed, then execute: `chsh -s /bin/powershell <username>`
|
||||
* **Windows:** no need to, PowerShell is the default shell
|
||||
How to set PowerShell as Default Shell on Linux?
|
||||
------------------------------------------------
|
||||
Make sure PowerShell is installed, then execute: `chsh -s /usr/bin/pwsh <username>`. In case you experience an "invalid shell" error, add "/usr/bin/pwsh" to /etc/shells.
|
||||
|
||||
|
||||
How to add the Scripts to the Search Path?
|
||||
------------------------------------------
|
||||
Want to use the PowerShell scripts everywhere on the command-line? Then you need to add the Scripts/ subfolder to the search path:
|
||||
|
||||
* **Bash or sh:** edit .profile in your home directory and add the line: PATH="$PATH:/path/to/PowerShell/Scripts"
|
||||
* **Windows:** open the environment variables dialogue and add the full path to Scripts/ to the system environment variable "Path"
|
||||
* **On Linux using Bash:** edit .profile in your home directory and add the line: PATH="$PATH:/path/to/PowerShell/Scripts"
|
||||
* **On Windows:** open the environment variables dialogue and add the full path to Scripts/ to the system environment variable "Path"
|
||||
|
||||
|
||||
How to use PowerShell in Context Menus?
|
||||
@ -57,22 +55,22 @@ How to use PowerShell in Context Menus?
|
||||
* to disable this execute `Remove_ps1_from_New_context_menu.reg` in subfolder [Misc/](Misc)
|
||||
|
||||
|
||||
How to edit PowerShell Scripts?
|
||||
-------------------------------
|
||||
* use your favorite text editor
|
||||
* use Visual Studio Code (available for free) - providing syntax highlighting, on-the-fly problem checking and an integrated PowerShell Console.
|
||||
|
||||
How to edit the PowerShell Scripts?
|
||||
-----------------------------------
|
||||
* use *PowerShell ISE* (Integrated Scripting Environment) to write, test and debug scripts (available for free on Windows only).
|
||||
* use *Visual Studio Code* supporting syntax highlighting, on-the-fly problem checking and an integrated PowerShell Console (available for free on Linux, Mac OS and Windows).
|
||||
* or simply use your *favorite text editor*
|
||||
|
||||
How to write good PowerShell Scripts?
|
||||
-------------------------------------
|
||||
Each PowerShell script should follow the 10 golden rules:
|
||||
Good PowerShell scripts are user-friendly and platform-independant. As a guideline follow these rules, please:
|
||||
|
||||
1. the filename should be named `<verb>-<object>.ps1`
|
||||
2. the first line reads `#!/bin/powershell` (to support Linux)
|
||||
3. the script has execute file permissions: chmod a+rx <file> (to support Linux)
|
||||
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)
|
||||
3. the script has execute file permissions: chmod a+rx <file> (for Linux support)
|
||||
4. 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. prefer command-line options, else ask the user
|
||||
6. prefer command-line options, else ask the user for help
|
||||
7. 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. on error call write-error with keyword "ERROR:" (to support log parsers) and exit the error code (mostly 1)
|
||||
|
151
README.md
151
README.md
@ -1,17 +1,22 @@
|
||||
Collection of PowerShell Scripts
|
||||
================================
|
||||
Mega Collection of PowerShell Scripts
|
||||
=====================================
|
||||
|
||||
**This repository contains 140+ useful and cross-platform PowerShell scripts in the [Scripts/ folder](Scripts/) - to be used by command-line interface (CLI), for remote control (RC), by context menu, by voice control, by automation software like Jenkins, automatically as daily tasks, or simply to learn PowerShell. See the [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.**
|
||||
|
||||
Scripts for Audio & Voice 🔊
|
||||
---------------------------
|
||||
**NOTE:** the scripts support Unicode input & output! Please use a modern console supporting UTF-8 such as Windows Terminal
|
||||
|
||||
🔊 PowerShell Scripts for Audio & Voice
|
||||
----------------------------------------
|
||||
* [convert-txt2wav.ps1](Scripts/convert-txt2wav.ps1) - converts text to a .WAV audio file
|
||||
* [mute-audio.ps1](Scripts/mute-audio.ps1) - mutes audio
|
||||
* [play-beep.ps1](Scripts/play-beep.ps1) - plays a beep sound
|
||||
* [play-files.ps1](Scripts/play-files.ps1) - plays the given audio files
|
||||
* [play-mission-impossible.ps1](Scripts/play-mission-impossible.ps1) - plays the Mission Impossible theme
|
||||
* [play-m3u.ps1](Scripts/play-m3u.ps1) - plays the given playlist (M3U file format)
|
||||
* [play-mp3.ps1](Scripts/play-mp3.ps1) - plays the given sound file (MP3 file format)
|
||||
* [play-super-mario.ps1](Scripts/play-super-mario.ps1) - plays the Super Mario Intro
|
||||
* [play-the-imperial-march.ps1](Scripts/play-the-imperial-march.ps1) - plays the Imperial March (Star Wars)
|
||||
* [speak-countdown.ps1](Scripts/speak-countdown.ps1) - starts a countdown by text-to-speech (TTS)
|
||||
* [speak-date.ps1](Scripts/speak-date.ps1) - speaks the current date by text-to-speech (TTS)
|
||||
* [speak-english.ps1](Scripts/speak-english.ps1) - speaks the given text with an English text-to-speech (TTS) voice
|
||||
* [speak-epub.ps1](Scripts/speak-epub.ps1) - speaks the content of the given Epub file by text-to-speech (TTS)
|
||||
@ -21,34 +26,46 @@ Scripts for Audio & Voice 🔊
|
||||
* [speak-test.ps1](Scripts/speak-test.ps1) - performs a speak test by text-to-speech (TTS)
|
||||
* [speak-text.ps1](Scripts/speak-text.ps1) - speaks the given text by text-to-speech (TTS)
|
||||
* [speak-time.ps1](Scripts/speak-time.ps1) - speaks the current time by text-to-speech (TTS)
|
||||
* [txt2wav.ps1](Scripts/txt2wav.ps1) - converts text into a audio .WAV file
|
||||
* [turn-volume-up.ps1](Scripts/turn-volume-up.ps1) - turns the audio volume up (+10% by default)
|
||||
* [turn-volume-down.ps1](Scripts/turn-volume-down.ps1) - turns the audio volume down (-10% by default)
|
||||
* [unmute-audio.ps1](Scripts/unmute-audio.ps1) - unmutes audio
|
||||
* [voice-control.ps1](Scripts/voice-control.ps1) - executes the PowerShell scripts by voice
|
||||
|
||||
Scripts for Computer Management ⚙️
|
||||
---------------------------------
|
||||
* [add-firewall-rules.ps1](Scripts/add-firewall-rules.ps1) - adds firewall rules for the given executables (requires admin rights)
|
||||
⚙️ PowerShell Scripts for Computer Management
|
||||
----------------------------------------------
|
||||
* [add-firewall-rules.ps1](Scripts/add-firewall-rules.ps1) - adds firewall rules for the given executables (needs admin rights)
|
||||
* [check-cpu-temp.ps1](Scripts/check-cpu-temp.ps1) - checks the CPU temperature
|
||||
* [check-dns-resolution.ps1](Scripts/check-dns-resolution.ps1) - checks the DNS resolution with frequently used domain names
|
||||
* [check-drive-space.ps1](Scripts/check-drive-space.ps1) - checks the given drive for free space left
|
||||
* [check-windows-system-files.ps1](Scripts/check-windows-system-files.ps1) - checks the validity of the Windows system files
|
||||
* [check-file-system.ps1](Scripts/check-file-system.ps1) - checks the validity of the file system (needs admin rights)
|
||||
* [check-health.ps1](Scripts/check-health.ps1) - checks the system health
|
||||
* [check-ping.ps1](Scripts/check-ping.ps1) - checks the ping latency to the internet
|
||||
* [check-swap-space.ps1](Scripts/check-swap-space.ps1) - checks the swap space for free space left
|
||||
* [check-windows-system-files.ps1](Scripts/check-windows-system-files.ps1) - checks the validity of the Windows system files (needs admin rights)
|
||||
* [enable-crash-dumps.ps1](Scripts/enable-crash-dumps.ps1) - enables the writing of crash dumps
|
||||
* [hibernate.ps1](Scripts/hibernate.ps1) - enables hibernate mode for the local computer (requires admin rights)
|
||||
* [enable-ssh-client.ps1](Scripts/enable-ssh-client.ps1) - enables the SSH client (needs admin rights)
|
||||
* [enable-ssh-server.ps1](Scripts/enable-ssh-server.ps1) - enables the SSH server (needs admin rights)
|
||||
* [hibernate.ps1](Scripts/hibernate.ps1) - enables hibernate mode for the local computer (needs admin rights)
|
||||
* [install-google-chrome.ps1](Scripts/install-google-chrome.ps1) - installs the Google Chrome browser
|
||||
* [list-drives.ps1](Scripts/list-drives.ps1) - lists all drives
|
||||
* [list-network-shares.ps1](Scripts/list-network-shares.ps1) - lists the network shares of the local computer
|
||||
* [list-current-timezone.ps1](Scripts/list-current-timezone.ps1) - lists the current time zone details
|
||||
* [list-installed-apps.ps1](Scripts/list-installed-apps.ps1) - lists the installed Windows Store apps
|
||||
* [list-installed-software.ps1](Scripts/list-installed-software.ps1) - lists the installed software (except Windows Store apps)
|
||||
* [list-printers.ps1](Scripts/list-printers.ps1) - lists all printer known to the computer
|
||||
* [list-processes.ps1](Scripts/list-processes.ps1) - lists the local computer processes
|
||||
* [list-services.ps1](Scripts/list-services.ps1) - lists the services on the local computer
|
||||
* [list-system-info.ps1](Scripts/list-system-info.ps1) - lists system information on the local computer
|
||||
* [list-tasks.ps1](Scripts/list-tasks.ps1) - lists all Windows scheduler tasks
|
||||
* [list-timezone.ps1](Scripts/list-timezone.ps1) - lists the current time zone details
|
||||
* [list-timezones.ps1](Scripts/list-timezones.ps1) - lists all time zones available
|
||||
* [list-user-groups.ps1](Scripts/list-user-groups.ps1) - lists the user groups on the local computer
|
||||
* [poweroff.ps1](Scripts/poweroff.ps1) - halts the local computer (requires admin rights)
|
||||
* [poweroff.ps1](Scripts/poweroff.ps1) - halts the local computer (needs admin rights)
|
||||
* [query-smart-data.ps1](Scripts/query-smart-data.ps1) - queries the S.M.A.R.T. data of your HDD/SSD's
|
||||
* [reboot.ps1](Scripts/reboot.ps1) - reboots the local computer (requires admin rights)
|
||||
* [reboot.ps1](Scripts/reboot.ps1) - reboots the local computer (needs admin rights)
|
||||
* [wakeup.ps1](Scripts/wakeup.ps1) - sends a magic packet to the given computer, waking him up
|
||||
|
||||
Scripts for the Desktop 💻
|
||||
-------------------------
|
||||
💻 PowerShell Scripts for the Desktop
|
||||
--------------------------------------
|
||||
* [close-calculator.ps1](Scripts/close-calculator.ps1) - closes the calculator program gracefully
|
||||
* [close-chrome.ps1](Scripts/close-chrome.ps1) - closes Google Chrome gracefully
|
||||
* [close-cortana.ps1](Scripts/close-cortana.ps1) - closes Cortana gracefully
|
||||
@ -59,82 +76,130 @@ Scripts for the Desktop 💻
|
||||
* [close-thunderbird.ps1](Scripts/close-thunderbird.ps1) - closes Mozilla Thunderbird gracefully
|
||||
* [close-vlc.ps1](Scripts/close-vlc.ps1) - closes the VLC media player gracefully
|
||||
* [close-windows-terminal.ps1](Scripts/close-windows-terminal.ps1) - closes Windows Terminal gracefully
|
||||
* [enable-god-mode.ps1](Scripts/enable-god-mode.ps1) - enables the god mode (adds a new icon to the desktop)
|
||||
* [list-clipboard.ps1](Scripts/list-clipboard.ps1) - lists the contents of the clipboard
|
||||
* [new-email.ps1](Scripts/new-email.ps1) - starts the default email client to write a new email
|
||||
* [open-browser.ps1](Scripts/open-browser.ps1) - starts the default Web browser
|
||||
* [open-calculator.ps1](Scripts/open-calculator.ps1) - starts the calculator program
|
||||
* [open-email-client.ps1](Scripts/open-browser.ps1) - starts the default email client
|
||||
* [open-file-explorer.ps1](Scripts/open-file-explorer.ps1) - starts the File Explorer
|
||||
* [open-recycle-bin.ps1](Scripts/open-recycle-bin.ps1) - starts the File Explorer with the recycle bin folder
|
||||
* [set-wallpaper.ps1](Scripts/set-wallpaper.ps1) - sets the given image as wallpaper
|
||||
* [take-screenshot.ps1](Scripts/take-screenshot.ps1) - takes a single screenshot
|
||||
* [take-screenshots.ps1](Scripts/take-screenshots.ps1) - takes multiple screenshots (every minute by default)
|
||||
|
||||
Scripts for Files & Folders 📁
|
||||
-----------------------------
|
||||
📁 PowerShell Scripts for Files & Folders
|
||||
------------------------------------------
|
||||
* [clear-recycle-bin.ps1](Scripts/clear-recycle-bin.ps1) - removes the content of the recycle bin folder (can not be undo!)
|
||||
* [cd-desktop.ps1](Scripts/cd-desktop.ps1) - go to the user's desktop folder
|
||||
* [cd-docs.ps1](Scripts/cd-docs.ps1) - go to the user's documents folder
|
||||
* [cd-downloads.ps1](Scripts/cd-downloads.ps1) - go to the user's downloads folder
|
||||
* [cd-dropbox.ps1](Scripts/cd-dropbox.ps1) - go to the user's Dropbox folder
|
||||
* [cd-home.ps1](Scripts/cd-home.ps1) - go to the user's home folder
|
||||
* [cd-music.ps1](Scripts/cd-music.ps1) - go to the user's music folder
|
||||
* [cd-onedrive.ps1](Scripts/cd-onedrive.ps1) - go to the user's OneDrive folder
|
||||
* [cd-pics.ps1](Scripts/cd-pics.ps1) - go to the user's pictures folder
|
||||
* [cd-recycle-bin.ps1](Scripts/cd-recycle-bin.ps1) - go to the user's recycle bin folder
|
||||
* [cd-repos.ps1](Scripts/cd-repos.ps1) - go to the user's Git repositories folder
|
||||
* [cd-root.ps1](Scripts/cd-root.ps1) - go to the root directory (C:\ on Windows)
|
||||
* [cd-scripts.ps1](Scripts/cd-scripts.ps1) - go to the PowerShell Scripts folder
|
||||
* [cd-up.ps1](Scripts/cd-up.ps1) - go one directory level up
|
||||
* [cd-up2.ps1](Scripts/cd-up2.ps1) - go two directory levels up
|
||||
* [cd-up3.ps1](Scripts/cd-up3.ps1) - go three directory levels up
|
||||
* [cd-up4.ps1](Scripts/cd-up4.ps1) - go four directory levels up
|
||||
* [cd-videos.ps1](Scripts/cd-videos.ps1) - go to the user's videos folder
|
||||
* [check-symlinks.ps1](Scripts/check-symlinks.ps1) - checks every symlink in the given directory tree
|
||||
* [check-xml-file.ps1](Scripts/check-xml-file.ps1) - checks the given XML file for validity
|
||||
* [create-shortcut.ps1](Scripts/create-shortcut.ps1) - creates a shortcut
|
||||
* [create-symlink.ps1](Scripts/create-symlink.ps1) - creates a symbolic link
|
||||
* [decrypt-file.ps1](Scripts/decrypt-file.ps1) - encrypts the given file
|
||||
* [download-dir.ps1](Scripts/download-dir.ps1) - downloads a directory tree from the given URL
|
||||
* [download-file.ps1](Scripts/download-file.ps1) - downloads a file from the given URL
|
||||
* [edit.ps1](Scripts/edit.ps1) - edits the given file with the built-in text editor
|
||||
* [encrypt-file.ps1](Scripts/encrypt-file.ps1) - encrypts the given file
|
||||
* [go-downloads.ps1](Scripts/go-downloads.ps1) - go to the user's downloads folder
|
||||
* [go-home.ps1](Scripts/go-home.ps1) - go to the user's home folder
|
||||
* [go-music.ps1](Scripts/go-music.ps1) - go to the user's music folder
|
||||
* [go-scripts.ps1](Scripts/go-scripts.ps1) - go to the PowerShell Scripts folder
|
||||
* [inspect-exe.ps1](Scripts/inspect-exe.ps1) - prints basic information of the given executable file
|
||||
* [list-dir.ps1](Scripts/list-dir.ps1) - lists the directory content (formatted in columns)
|
||||
* [list-dir-tree.ps1](Scripts/list-dir-tree.ps1) - lists the directory tree content
|
||||
* [list-empty-dirs.ps1](Scripts/list-empty-dirs.ps1) - lists empty subfolders within the given directory tree
|
||||
* [list-empty-files.ps1](Scripts/list-empty-files.ps1) - lists empty files within the given directory tree
|
||||
* [list-files.ps1](Scripts/list-files.ps1) - lists all files in the given folder and also in every subfolder
|
||||
* [list-formatted.ps1](Scripts/list-formatted.ps1) - lists the current working directory formatted in columns
|
||||
* [list-hidden-files.ps1](Scripts/list-hidden-files.ps1) - lists hidden files within the given directory tree
|
||||
* [list-recycle-bin.ps1](Scripts/list-recycle-bin.ps1) - lists the content of the recycle bin folder
|
||||
* [list-unused-files.ps1](Scripts/list-unused-files.ps1) - lists unused files in a directory tree
|
||||
* [list-workdir.ps1](Scripts/list-workdir.ps1) - lists the current working directory
|
||||
* [make-install.ps1](Scripts/make-install.ps1) - installs built executables and libs to the installation directory
|
||||
* [MD5.ps1](Scripts/MD5.ps1) - prints the MD5 checksum of the given file
|
||||
* [remove-empty-dirs.ps1](Scripts/remove-empty-dirs.ps1) - removes empty subfolders within the given directory tree
|
||||
* [search-filename.ps1](Scripts/search-filename.ps1) - searches the directory tree for filenames by given pattern
|
||||
* [search-files.ps1](Scripts/search-files.ps1) - searches the given pattern in the given files
|
||||
* [SHA1.ps1](Scripts/SHA1.ps1) - prints the SHA1 checksum of the given file
|
||||
* [SHA256.ps1](Scripts/SHA256.ps1) - prints the SHA256 checksum of the given file
|
||||
* [show-dir-tree.ps1](Scripts/show-dir-tree.ps1) - visualizes the given/current directory tree
|
||||
* [upload-file.ps1](Scripts/zip-dir.ps1) - uploads the local file to the given FTP server
|
||||
* [zip-dir.ps1](Scripts/zip-dir.ps1) - creates a zip archive of the given directory
|
||||
|
||||
Scripts for Git 📝
|
||||
-----------------
|
||||
* [clean-branch.ps1](Scripts/clean-branch.ps1) - cleans the current Git branch (including submodules) from generated files
|
||||
📝 PowerShell Scripts for Git
|
||||
------------------------------
|
||||
* [build-repo.ps1](Scripts/build-repo.ps1) - builds the current/given Git repository
|
||||
* [build-repos.ps1](Scripts/build-repos.ps1) - builds all Git repositories under the current/given directory
|
||||
* [cherry-picker.ps1](Scripts/cherry-picker.ps1) - cherry-picks a Git commit into multiple branches
|
||||
* [clean-repo.ps1](Scripts/clean-repo.ps1) - cleans the current/given Git repository from untracked files (including submodules)
|
||||
* [clone-repos.ps1](Scripts/clone-repos.ps1) - clones well-known Git repositories
|
||||
* [configure-git.ps1](Scripts/configure-git.ps1) - sets up the Git user configuration
|
||||
* [fetch-repos.ps1](Scripts/fetch-repos.ps1) - fetches all Git repositories under the current/given directory (including submodules)
|
||||
* [list-branches.ps1](Scripts/list-branches.ps1) - lists the branches of the current/given Git repository
|
||||
* [switch-branch.ps1](Scripts/switch-branch.ps1) - switches the current Git repository to the given branch (including submodules)
|
||||
* [update-repos.ps1](Scripts/update-repos.ps1) - updates all Git repositories under the current/given directory (including submodules)
|
||||
* [create-branch.ps1](Scripts/create-branch.ps1) - creates a new branch in the current/given Git repository
|
||||
* [create-tag.ps1](Scripts/create-tag.ps1) - creates a new tag in the current/given Git repository
|
||||
* [fetch-repo.ps1](Scripts/fetch-repo.ps1) - fetches updates for the current/given Git repository (including submodules)
|
||||
* [fetch-repos.ps1](Scripts/fetch-repos.ps1) - fetches updates for all Git repositories under the current/given directory (including submodules)
|
||||
* [list-branches.ps1](Scripts/list-branches.ps1) - lists all branches in the current/given Git repository
|
||||
* [list-commits.ps1](Scripts/list-commits.ps1) - lists all commits in the current/given Git repository
|
||||
* [list-latest-tag.ps1](Scripts/list-latest-tag.ps1) - lists the latest tag on the current branch in a Git repository
|
||||
* [list-tags.ps1](Scripts/list-tags.ps1) - lists all tags in the current/given Git repository
|
||||
* [pull-repo.ps1](Scripts/pull-repo.ps1) - pulls updates for the current/given Git repository (including submodules)
|
||||
* [pull-repos.ps1](Scripts/pull-repos.ps1) - pulls updates for all Git repositories under the current/given directory (including submodules)
|
||||
* [switch-branch.ps1](Scripts/switch-branch.ps1) - switches the branch in the current/given Git repository (including submodules)
|
||||
* [sync-repo.ps1](Scripts/sync-repo.ps1) - synchronizes a Git repository by push & pull (including submodules)
|
||||
|
||||
Scripts for PowerShell 🔎
|
||||
🔎 Scripts for PowerShell
|
||||
------------------------
|
||||
* [daily-tasks.sh](Scripts/daily-tasks.sh) - execute PowerShell scripts automatically as daily tasks (Linux only)
|
||||
* [introduce-powershell.sh](Scripts/introduce-powershell.sh) - introduces PowerShell to new users
|
||||
* [list-aliases.ps1](Scripts/list-aliases.ps1) - lists all PowerShell aliases
|
||||
* [list-automatic-variables.ps1](Scripts/list-automatic-variables.ps1) - lists the automatic variables of PowerShell
|
||||
* [list-cheat-sheet.ps1](Scripts/list-cheat-sheet.ps1) - lists the PowerShell cheat sheet
|
||||
* [list-cmdlets.ps1](Scripts/list-cmdlets.ps1) - lists the PowerShell cmdlets
|
||||
* [list-modules.ps1](Scripts/list-modules.ps1) - lists the PowerShell modules
|
||||
* [list-profiles.ps1](Scripts/list-profiles.ps1) - lists your PowerShell profiles
|
||||
* [list-scripts.ps1](Scripts/list-scripts.ps1) - lists all PowerShell scripts in this repository
|
||||
* [set-profile.ps1](Scripts/set-profile.ps1) - updates your PowerShell user profile
|
||||
|
||||
Various Scripts 🛒
|
||||
-----------------
|
||||
🛒 Various PowerShell Scripts
|
||||
------------------------------
|
||||
* [add-memo.ps1](Scripts/add-memo.ps1) - adds the given memo text to $HOME/Memos.csv
|
||||
* [check-ipv4-address.ps1](Scripts/check-ipv4-address.ps1) - checks the given IPv4 address for validity
|
||||
* [check-ipv6-address.ps1](Scripts/check-ipv6-address.ps1) - checks the given IPv6 address for validity
|
||||
* [check-mac-address.ps1](Scripts/check-mac-address.ps1) - checks the given MAC address for validity
|
||||
* [csv-to-text.ps1](Scripts/csv-to-text.ps1) - converts the given CSV file into a text list
|
||||
* [check-weather.ps1](Scripts/check-weather.ps1) - checks the current weather for critical values
|
||||
* [convert-csv2txt.ps1](Scripts/convert-csv2txt.ps1) - converts the given CSV file to a text list
|
||||
* [convert-mysql2csv.ps1](Scripts/convert-mysql2csv.ps1) - converts the MySQL database table to a CSV file
|
||||
* [convert-sql2csv.ps1](Scripts/convert-sql2csv.ps1) - converts the SQL database table to a CSV file
|
||||
* [display-time.ps1](Scripts/display-time.ps1) - displays the current time for 10 seconds by default
|
||||
* [download.ps1](Scripts/download.ps1) - downloads the file/directory from the given URL
|
||||
* [generate-qrcode.ps1](Scripts/generate-qrcode.ps1) - generates a QR code
|
||||
* [list-anagrams.ps1](Scripts/list-anagrams.ps1) - lists all anagrams of the given word
|
||||
* [list-city-weather.ps1](Scripts/list-city-weather.ps1) - lists the current weather of cities worldwide (west to east)
|
||||
* [list-credits.ps1](Scripts/list-credits.ps1) - shows the credits
|
||||
* [list-environment-variables.ps1](Scripts/list-environment-variables.ps1) - lists all environment variables
|
||||
* [list-emojis.ps1](Scripts/list-emojis.ps1) - lists the emojis of Unicode 13.0
|
||||
* [list-fritzbox-calls.ps1](Scripts/list-fritzbox-calls.ps1) - lists the FRITZ!Box calls
|
||||
* [list-fritzbox-devices.ps1](Scripts/list-fritzbox-devices.ps1) - lists FRITZ!Box's known devices
|
||||
* [list-logbook.ps1](Scripts/list-logbook.ps1) - lists the content of the logbook
|
||||
* [list-earthquakes.ps1](Scripts/list-earthquakes.ps1) - lists earthquakes with magnitude >= 6.0 for the last 30 days
|
||||
* [list-memos.ps1](Scripts/list-memos.ps1) - lists the memos at $HOME/Memos.csv
|
||||
* [list-mysql-tables.ps1](Scripts/list-mysql-tables.ps1) - lists the MySQL server tables
|
||||
* [list-news.ps1](Scripts/list-news.ps1) - lists the latest news
|
||||
* [list-os-releases.ps1](Scripts/list-os-releases.ps1) - lists OS releases and download URL
|
||||
* [list-os-releases.ps1](Scripts/list-os-releases.ps1) - lists operating system releases and download URL
|
||||
* [list-os-updates.ps1](Scripts/list-os-updates.ps1) - lists operating system updates
|
||||
* [list-random-passwords.ps1](Scripts/list-random-passwords.ps1) - prints a list of random passwords
|
||||
* [list-random-pins.ps1](Scripts/list-random-pins.ps1) - prints a list of random PIN's
|
||||
* [list-sql-tables.ps1](Scripts/list-sql-tables.ps1) - lists the SQL server tables
|
||||
* [list-weather.ps1](Scripts/list-weather.ps1) - lists the hourly weather
|
||||
* [locate-city.ps1](Scripts/locate-city.ps1) - prints the geographic location of the given city
|
||||
* [locate-ipaddress.ps1](Scripts/locate-ipaddress.ps1) - prints the geographic location of the given IP address
|
||||
* [locate-zip-code.ps1](Scripts/locate-zip-code.ps1) - prints the geographic location of the given zip-code
|
||||
@ -149,18 +214,18 @@ Various Scripts 🛒
|
||||
* [simulate-matrix.ps1](Scripts/simulate-matrix.ps1) - simulates the Matrix (fun)
|
||||
* [simulate-presence.ps1](Scripts/simulate-presence.ps1) - simulates the human presence against burglars
|
||||
* [switch-shelly1.ps1](Scripts/switch-shelly1.ps1) - switches a Shelly1 device in the local network
|
||||
* [train-dns-cache.ps1](Scripts/train-dns-cache.ps1) - trains the DNS cache with frequently used domain names
|
||||
* [translate-text.ps1](Scripts/translate-text.ps1) - translates the given text into other languages
|
||||
* [translate-file.ps1](Scripts/translate-file.ps1) - translates the given text file into other languages
|
||||
* [translate-files.ps1](Scripts/translate-files.ps1) - translates the given text files into any supported language
|
||||
* [translate-text.ps1](Scripts/translate-text.ps1) - translates the given text in English into other languages
|
||||
* [weather.ps1](Scripts/weather.ps1) - prints the current weather forecast
|
||||
* [weather-alert.ps1](Scripts/weather-alert.ps1) - checks the current weather for critical values
|
||||
* [weather-report.ps1](Scripts/weather-report.ps1) - prints the local weather report
|
||||
* [weather-worldwide.ps1](Scripts/weather-worldwide.ps1) - prints the current weather of cities worldwide
|
||||
* [what-is.ps1](Scripts/what-is.ps1) - prints a description of the given abbreviation
|
||||
* [write-animated.ps1](Scripts/write-animated.ps1) - writes animated text
|
||||
* [write-big.ps1](Scripts/write-big.ps1) - writes the given text in big letters
|
||||
* [write-blue.ps1](Scripts/write-blue.ps1) - writes the given text in a blue foreground color
|
||||
* [write-braille.ps1](Scripts/write-braille.ps1) - writes the given text in Braille
|
||||
* [write-green.ps1](Scripts/write-green.ps1) - writes the given text in a green foreground color
|
||||
* [write-logbook.ps1](Scripts/write-logbook.ps1) - writes the given text to the logbook
|
||||
* [write-lowercase.ps1](Scripts/write-lowercase.ps1) - writes the given text in lowercase letters
|
||||
* [write-marquee.ps1](Scripts/write-marquee.ps1) - writes the given text as marquee
|
||||
* [write-morse-code.ps1](Scripts/write-morse-code.ps1) - writes the given text in Morse code
|
||||
* [write-motd.ps1](Scripts/write-motd.ps1) - writes the message of the day (MOTD)
|
||||
|
@ -1,22 +1,18 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./MD5.ps1 [<file>]
|
||||
.DESCRIPTION prints the MD5 checksum of the given file
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
.SYNTAX MD5.ps1 [<file>]
|
||||
.DESCRIPTION prints the MD5 checksum of the given file
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($File = "")
|
||||
|
||||
if ($File -eq "" ) {
|
||||
$File = read-host "Enter path to file"
|
||||
}
|
||||
if ($File -eq "" ) { $File = read-host "Enter path to file" }
|
||||
|
||||
try {
|
||||
$Result = get-filehash $File -algorithm MD5
|
||||
write-output "MD5 hash is" $Result.Hash
|
||||
"MD5 hash is" $Result.Hash
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
|
@ -1,22 +1,18 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./SHA1.ps1 [<file>]
|
||||
.DESCRIPTION prints the SHA1 checksum of the given file
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
.SYNTAX SHA1.ps1 [<file>]
|
||||
.DESCRIPTION prints the SHA1 checksum of the given file
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($File = "")
|
||||
|
||||
if ($File -eq "" ) {
|
||||
$File = read-host "Enter the filename"
|
||||
}
|
||||
if ($File -eq "" ) { $File = read-host "Enter the filename" }
|
||||
|
||||
try {
|
||||
$Result = get-filehash $File -algorithm SHA1
|
||||
write-output "SHA1 hash is" $Result.Hash
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
|
@ -1,22 +1,18 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./SHA256.ps1 [<file>]
|
||||
.DESCRIPTION prints the SHA256 checksum of the given file
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
.SYNTAX SHA256.ps1 [<file>]
|
||||
.DESCRIPTION prints the SHA256 checksum of the given file
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($File = "")
|
||||
|
||||
if ($File -eq "" ) {
|
||||
$File = read-host "Enter the filename"
|
||||
}
|
||||
if ($File -eq "" ) { $File = read-host "Enter the filename" }
|
||||
|
||||
try {
|
||||
$Result = get-filehash $File -algorithm SHA256
|
||||
write-output "SHA256 hash is:" $Result.Hash
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./add-firewall-rules.ps1 [<path-to-executables>]
|
||||
.DESCRIPTION adds firewall rules for the given executables, administrator rights are required
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
.SYNTAX add-firewall-rules.ps1 [<path-to-executables>]
|
||||
.DESCRIPTION adds firewall rules for the given executables, administrator rights are required
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
#Requires -RunAsAdministrator
|
||||
@ -49,6 +48,6 @@ try {
|
||||
Start-Process powershell -Verb runAs -ArgumentList "-command & {$command} $arg"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
|
27
Scripts/add-memo.ps1
Executable file
27
Scripts/add-memo.ps1
Executable file
@ -0,0 +1,27 @@
|
||||
<#
|
||||
.SYNTAX add-memo.ps1 [<text>]
|
||||
.DESCRIPTION adds the given memo text to $HOME/Memos.csv
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($Text = "")
|
||||
if ($Text -eq "" ) { $Text = read-host "Enter the memo text to add" }
|
||||
|
||||
try {
|
||||
$Path = "$HOME/Memos.csv"
|
||||
$Time = get-date -format "yyyy-MM-ddTHH:mm:ssZ" -asUTC
|
||||
$User = $(whoami)
|
||||
$Line = "$Time,$User,$Text"
|
||||
|
||||
if (-not(test-path "$Path")) {
|
||||
write-output "Time,User,Text" > "$Path"
|
||||
}
|
||||
write-output $Line >> "$Path"
|
||||
|
||||
"✔️ added to 📄$Path"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
@ -1,9 +1,8 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./alert.ps1 [<message>]
|
||||
.DESCRIPTION handle and escalate the given alert message
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
.SYNTAX alert.ps1 [<message>]
|
||||
.DESCRIPTION handle and escalate the given alert message
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($Message = "")
|
||||
@ -19,6 +18,6 @@ try {
|
||||
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
|
86
Scripts/build-repo.ps1
Executable file
86
Scripts/build-repo.ps1
Executable file
@ -0,0 +1,86 @@
|
||||
<#
|
||||
.SYNTAX build-repo.ps1 [<repo-dir>]
|
||||
.DESCRIPTION builds a Git repository (supporting cmake,configure,autogen,Imakefile,Makefile)
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($RepoDir = "$PWD")
|
||||
|
||||
try {
|
||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
$RepoDir = resolve-path "$RepoDir"
|
||||
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||
|
||||
if (test-path "$RepoDir/CMakeLists.txt") {
|
||||
"⏳ Building 📂$RepoDir using CMakeLists.txt ..."
|
||||
if (-not(test-path "$RepoDir/BuildFiles/" -pathType container)) {
|
||||
& mkdir "$RepoDir/BuildFiles/"
|
||||
}
|
||||
|
||||
set-location "$RepoDir/BuildFiles/"
|
||||
& cmake ..
|
||||
if ($lastExitCode -ne "0") { throw "Executing 'cmake ..' has failed" }
|
||||
|
||||
& make -j4
|
||||
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
|
||||
|
||||
set-location ".."
|
||||
|
||||
} elseif (test-path "$RepoDir/configure") {
|
||||
"⏳ Building 📂$RepoDir using 'configure' ..."
|
||||
set-location "$RepoDir/"
|
||||
|
||||
& ./configure
|
||||
if ($lastExitCode -ne "0") { throw "Executing 'configure' has failed" }
|
||||
|
||||
& make -j4
|
||||
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
|
||||
|
||||
} elseif (test-path "$RepoDir/autogen.sh") {
|
||||
"⏳ Building 📂$RepoDir using 'autogen.sh' ..."
|
||||
set-location "$RepoDir/"
|
||||
|
||||
& ./autogen.sh
|
||||
if ($lastExitCode -ne "0") { throw "Script 'autogen.sh' has failed" }
|
||||
|
||||
& make -j4
|
||||
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
|
||||
|
||||
} elseif (test-path "$RepoDir/Imakefile") {
|
||||
"⏳ Building 📂$RepoDir using Imakefile ..."
|
||||
set-location "$RepoDir/"
|
||||
|
||||
& xmkmf
|
||||
if ($lastExitCode -ne "0") { throw "Executing 'xmkmf' has failed" }
|
||||
|
||||
& make -j4
|
||||
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
|
||||
|
||||
} elseif (test-path "$RepoDir/Makefile") {
|
||||
"⏳ Building 📂$RepoDir using Makefile..."
|
||||
set-location "$RepoDir/"
|
||||
|
||||
& make -j4
|
||||
if ($lastExitCode -ne "0") { throw "Executing 'make -j4' has failed" }
|
||||
|
||||
} elseif (test-path "$RepoDir/attower/src/build/DevBuild/build.bat") {
|
||||
"⏳ Building 📂$RepoDir using build.bat ..."
|
||||
set-location "$RepoDir/attower/src/build/DevBuild/"
|
||||
|
||||
& ./build.bat build-all-release
|
||||
if ($lastExitCode -ne "0") { throw "Script 'build.bat' returned error(s)" }
|
||||
|
||||
} else {
|
||||
write-warning "Sorry, no rule found to build 📂$RepoDir"
|
||||
exit 0
|
||||
}
|
||||
|
||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||
"✔️ built Git repository 📂$RepoDir in $Elapsed sec."
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
28
Scripts/build-repos.ps1
Executable file
28
Scripts/build-repos.ps1
Executable file
@ -0,0 +1,28 @@
|
||||
<#
|
||||
.SYNTAX build-repos.ps1 [<parent-dir>]
|
||||
.DESCRIPTION builds all Git repositories under the current/given directory
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($ParentDir = "$PWD")
|
||||
|
||||
try {
|
||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
if (-not(test-path "$ParentDir" -pathType container)) { throw "Can't access directory: $ParentDir" }
|
||||
set-location $ParentDir
|
||||
|
||||
[int]$Count = 0
|
||||
get-childItem $ParentDir -attributes Directory | foreach-object {
|
||||
& "$PSScriptRoot/build-repo.ps1" "$($_.FullName)"
|
||||
$Count++
|
||||
}
|
||||
|
||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||
write-host -foregroundColor green "✔️ built $Count Git repositories at $ParentDir in $Elapsed sec."
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
15
Scripts/cd-desktop.ps1
Executable file
15
Scripts/cd-desktop.ps1
Executable file
@ -0,0 +1,15 @@
|
||||
<#
|
||||
.SYNTAX cd-desktop.ps1
|
||||
.DESCRIPTION go to the user's desktop folder
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
$TargetDir = resolve-path "$HOME/Desktop"
|
||||
if (-not(test-path "$TargetDir" -pathType container)) {
|
||||
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
|
||||
exit 1
|
||||
}
|
||||
set-location "$TargetDir"
|
||||
"📂$TargetDir"
|
||||
exit 0
|
15
Scripts/cd-docs.ps1
Executable file
15
Scripts/cd-docs.ps1
Executable file
@ -0,0 +1,15 @@
|
||||
<#
|
||||
.SYNTAX cd-docs.ps1
|
||||
.DESCRIPTION go to the user's documents folder
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
$TargetDir = resolve-path "$HOME/Documents"
|
||||
if (-not(test-path "$TargetDir" -pathType container)) {
|
||||
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
|
||||
exit 1
|
||||
}
|
||||
set-location "$TargetDir"
|
||||
"📂$TargetDir"
|
||||
exit 0
|
15
Scripts/cd-downloads.ps1
Executable file
15
Scripts/cd-downloads.ps1
Executable file
@ -0,0 +1,15 @@
|
||||
<#
|
||||
.SYNTAX cd-downloads.ps1
|
||||
.DESCRIPTION go to the user's downloads folder
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
$TargetDir = resolve-path "$HOME/Downloads"
|
||||
if (-not(test-path "$TargetDir" -pathType container)) {
|
||||
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
|
||||
exit 1
|
||||
}
|
||||
set-location "$TargetDir"
|
||||
"📂$TargetDir"
|
||||
exit 0
|
15
Scripts/cd-dropbox.ps1
Executable file
15
Scripts/cd-dropbox.ps1
Executable file
@ -0,0 +1,15 @@
|
||||
<#
|
||||
.SYNTAX cd-dropbox.ps1
|
||||
.DESCRIPTION go to the user's Dropbox folder
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
$TargetDir = resolve-path "$HOME/Dropbox"
|
||||
if (-not(test-path "$TargetDir" -pathType container)) {
|
||||
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
|
||||
exit 1
|
||||
}
|
||||
set-location "$TargetDir"
|
||||
"📂$TargetDir"
|
||||
exit 0
|
15
Scripts/cd-home.ps1
Executable file
15
Scripts/cd-home.ps1
Executable file
@ -0,0 +1,15 @@
|
||||
<#
|
||||
.SYNTAX cd-home.ps1
|
||||
.DESCRIPTION go to the user's home folder
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
$TargetDir = resolve-path "$HOME"
|
||||
if (-not(test-path "$TargetDir" -pathType container)) {
|
||||
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
|
||||
exit 1
|
||||
}
|
||||
set-location "$TargetDir"
|
||||
"📂$TargetDir"
|
||||
exit 0
|
15
Scripts/cd-music.ps1
Executable file
15
Scripts/cd-music.ps1
Executable file
@ -0,0 +1,15 @@
|
||||
<#
|
||||
.SYNTAX cd-music.ps1
|
||||
.DESCRIPTION go to the user's music folder
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
$TargetDir = resolve-path "$HOME/Music"
|
||||
if (-not(test-path "$TargetDir" -pathType container)) {
|
||||
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
|
||||
exit 1
|
||||
}
|
||||
set-location "$TargetDir"
|
||||
"📂$TargetDir"
|
||||
exit 0
|
15
Scripts/cd-onedrive.ps1
Normal file
15
Scripts/cd-onedrive.ps1
Normal file
@ -0,0 +1,15 @@
|
||||
<#
|
||||
.SYNTAX cd-onedrive.ps1
|
||||
.DESCRIPTION go to the user's OneDrive folder
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
$TargetDir = resolve-path "$HOME/OneDrive"
|
||||
if (-not(test-path "$TargetDir" -pathType container)) {
|
||||
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
|
||||
exit 1
|
||||
}
|
||||
set-location "$TargetDir"
|
||||
"📂$TargetDir"
|
||||
exit 0
|
15
Scripts/cd-pics.ps1
Executable file
15
Scripts/cd-pics.ps1
Executable file
@ -0,0 +1,15 @@
|
||||
<#
|
||||
.SYNTAX cd-pics.ps1
|
||||
.DESCRIPTION go to the user's pictures folder
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
$TargetDir = resolve-path "$HOME/Pictures"
|
||||
if (-not(test-path "$TargetDir" -pathType container)) {
|
||||
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
|
||||
exit 1
|
||||
}
|
||||
set-location "$TargetDir"
|
||||
"📂$TargetDir"
|
||||
exit 0
|
21
Scripts/cd-recycle-bin.ps1
Normal file
21
Scripts/cd-recycle-bin.ps1
Normal file
@ -0,0 +1,21 @@
|
||||
<#
|
||||
.SYNTAX cd-recycle-bin.ps1
|
||||
.DESCRIPTION go to the user's recycle bin folder
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
function Get-CurrentUserSID { [CmdletBinding()] param()
|
||||
Add-Type -AssemblyName System.DirectoryServices.AccountManagement
|
||||
return ([System.DirectoryServices.AccountManagement.UserPrincipal]::Current).SID.Value
|
||||
}
|
||||
|
||||
|
||||
$TargetDir = 'C:\$Recycle.Bin\' + "$(Get-CurrentUserSID)"
|
||||
if (-not(test-path "$TargetDir" -pathType container)) {
|
||||
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
|
||||
exit 1
|
||||
}
|
||||
set-location "$TargetDir"
|
||||
"📂$TargetDir"
|
||||
exit 0
|
15
Scripts/cd-repos.ps1
Normal file
15
Scripts/cd-repos.ps1
Normal file
@ -0,0 +1,15 @@
|
||||
<#
|
||||
.SYNTAX cd-repos.ps1
|
||||
.DESCRIPTION go to the user's Git repositories folder
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
$TargetDir = resolve-path "$HOME/Repos"
|
||||
if (-not(test-path "$TargetDir" -pathType container)) {
|
||||
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
|
||||
exit 1
|
||||
}
|
||||
set-location "$TargetDir"
|
||||
"📂$TargetDir"
|
||||
exit 0
|
19
Scripts/cd-root.ps1
Executable file
19
Scripts/cd-root.ps1
Executable file
@ -0,0 +1,19 @@
|
||||
<#
|
||||
.SYNTAX cd-root.ps1
|
||||
.DESCRIPTION go to the root directory (C: on Windows)
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
if ($IsLinux) {
|
||||
$TargetDir = resolve-path "/"
|
||||
} else {
|
||||
$TargetDir = resolve-path "C:/"
|
||||
}
|
||||
if (-not(test-path "$TargetDir" -pathType container)) {
|
||||
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
|
||||
exit 1
|
||||
}
|
||||
set-location "$TargetDir"
|
||||
"📂$TargetDir"
|
||||
exit 0
|
15
Scripts/cd-scripts.ps1
Executable file
15
Scripts/cd-scripts.ps1
Executable file
@ -0,0 +1,15 @@
|
||||
<#
|
||||
.SYNTAX cd-scripts.ps1
|
||||
.DESCRIPTION go to the PowerShell Scripts folder
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
$TargetDir = resolve-path "$PSScriptRoot"
|
||||
if (-not(test-path "$TargetDir" -pathType container)) {
|
||||
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
|
||||
exit 1
|
||||
}
|
||||
set-location "$TargetDir"
|
||||
"📂$TargetDir"
|
||||
exit 0
|
15
Scripts/cd-up.ps1
Executable file
15
Scripts/cd-up.ps1
Executable file
@ -0,0 +1,15 @@
|
||||
<#
|
||||
.SYNTAX cd-up.ps1
|
||||
.DESCRIPTION go one directory level up
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
$TargetDir = resolve-path ".."
|
||||
if (-not(test-path "$TargetDir" -pathType container)) {
|
||||
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
|
||||
exit 1
|
||||
}
|
||||
set-location "$TargetDir"
|
||||
"📂$TargetDir"
|
||||
exit 0
|
15
Scripts/cd-up2.ps1
Normal file
15
Scripts/cd-up2.ps1
Normal file
@ -0,0 +1,15 @@
|
||||
<#
|
||||
.SYNTAX cd-up2.ps1
|
||||
.DESCRIPTION go two directory levels up
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
$TargetDir = resolve-path "../.."
|
||||
if (-not(test-path "$TargetDir" -pathType container)) {
|
||||
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
|
||||
exit 1
|
||||
}
|
||||
set-location "$TargetDir"
|
||||
"📂$TargetDir"
|
||||
exit 0
|
15
Scripts/cd-up3.ps1
Normal file
15
Scripts/cd-up3.ps1
Normal file
@ -0,0 +1,15 @@
|
||||
<#
|
||||
.SYNTAX cd-up3.ps1
|
||||
.DESCRIPTION go three directory levels up
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
$TargetDir = resolve-path "../../.."
|
||||
if (-not(test-path "$TargetDir" -pathType container)) {
|
||||
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
|
||||
exit 1
|
||||
}
|
||||
set-location "$TargetDir"
|
||||
"📂$TargetDir"
|
||||
exit 0
|
15
Scripts/cd-up4.ps1
Normal file
15
Scripts/cd-up4.ps1
Normal file
@ -0,0 +1,15 @@
|
||||
<#
|
||||
.SYNTAX cd-up4.ps1
|
||||
.DESCRIPTION go four directory levels up
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
$TargetDir = resolve-path "../../../.."
|
||||
if (-not(test-path "$TargetDir" -pathType container)) {
|
||||
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
|
||||
exit 1
|
||||
}
|
||||
set-location "$TargetDir"
|
||||
"📂$TargetDir"
|
||||
exit 0
|
15
Scripts/cd-videos.ps1
Executable file
15
Scripts/cd-videos.ps1
Executable file
@ -0,0 +1,15 @@
|
||||
<#
|
||||
.SYNTAX cd-videos.ps1
|
||||
.DESCRIPTION go to the user's videos folder
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
$TargetDir = resolve-path "$HOME/Videos"
|
||||
if (-not(test-path "$TargetDir" -pathType container)) {
|
||||
write-warning "Sorry, there is no folder 📂$TargetDir (yet)"
|
||||
exit 1
|
||||
}
|
||||
set-location "$TargetDir"
|
||||
"📂$TargetDir"
|
||||
exit 0
|
34
Scripts/check-cpu-temp.ps1
Executable file
34
Scripts/check-cpu-temp.ps1
Executable file
@ -0,0 +1,34 @@
|
||||
<#
|
||||
.SYNTAX check-cpu-temp.ps1
|
||||
.DESCRIPTION checks the CPU temperature
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
try {
|
||||
if (test-path "/sys/class/thermal/thermal_zone0/temp") {
|
||||
[int]$IntTemp = get-content "/sys/class/thermal/thermal_zone0/temp"
|
||||
$Temp = [math]::round($IntTemp / 1000.0, 1)
|
||||
} else {
|
||||
write-warning "Sorry, no CPU temperature available"
|
||||
exit 0
|
||||
}
|
||||
|
||||
if ($Temp -gt "80") {
|
||||
write-error "FAIL - $Temp °C CPU temperature is too high!"
|
||||
exit 1
|
||||
} elseif ($Temp -lt "-20") {
|
||||
write-error "FAIL - $Temp °C CPU temperature is too low!"
|
||||
exit 1
|
||||
} elseif ($Temp -gt "50") {
|
||||
write-warning "$Temp °C CPU temperature is quite high"
|
||||
} elseif ($Temp -lt "0") {
|
||||
write-warning "$Temp °C CPU temperature is quite low"
|
||||
} else {
|
||||
"✔️ $Temp °C CPU temperature"
|
||||
}
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
32
Scripts/check-dns-resolution.ps1
Executable file
32
Scripts/check-dns-resolution.ps1
Executable file
@ -0,0 +1,32 @@
|
||||
<#
|
||||
.SYNTAX check-dns-resolution.ps1
|
||||
.DESCRIPTION checks the DNS resolution with frequently used domain names
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
try {
|
||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
write-progress "Reading Data/domain-names.csv..."
|
||||
|
||||
$PathToRepo = "$PSScriptRoot/.."
|
||||
$Table = import-csv "$PathToRepo/Data/domain-names.csv"
|
||||
|
||||
foreach($Row in $Table) {
|
||||
write-progress "Resolving $($Row.Domain) ..."
|
||||
if ($IsLinux) {
|
||||
$Ignore = nslookup $Row.Domain
|
||||
} else {
|
||||
$Ignore = resolve-dnsName $Row.Domain
|
||||
}
|
||||
}
|
||||
$Count = $Table.Length
|
||||
|
||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||
$Average = [math]::round($Count / $Elapsed, 1)
|
||||
"✔️ $Average domains/s ($Count domains resolved in $Elapsed sec.)"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
@ -1,28 +1,27 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./check-drive-space.ps1 [<drive>] [<warning-level>]
|
||||
.DESCRIPTION checks the given drive for free space left
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
<#
|
||||
.SYNTAX check-drive-space.ps1 [<drive>] [<min-level>]
|
||||
.DESCRIPTION checks the given drive for free space left
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($Drive = "", [int]$WarningLevel = 50) # warning level in GB
|
||||
param($Drive = "", [int]$MinLevel = 50) # minimum level in GB
|
||||
|
||||
if ($Drive -eq "" ) {
|
||||
$Drive = read-host "Enter drive to check"
|
||||
}
|
||||
if ($Drive -eq "" ) { $Drive = read-host "Enter drive to check" }
|
||||
|
||||
try {
|
||||
$FreeSpace = (get-psdrive $Drive)
|
||||
[int]$FreeSpace = (($FreeSpace.free / 1024) / 1024) / 1024
|
||||
$DriveDetails = (get-psdrive $Drive)
|
||||
[int]$Free = (($DriveDetails.Free / 1024) / 1024) / 1024
|
||||
[int]$Used = (($DriveDetails.Used / 1024) / 1024) / 1024
|
||||
[int]$Total = ($Used + $Free)
|
||||
|
||||
if ($FreeSpace -lt $WarningLevel) {
|
||||
write-warning "Drive $Drive has only $FreeSpace GB free space left! (warning level is < $WarningLevel GB)"
|
||||
if ($Free -lt $MinLevel) {
|
||||
write-warning "Drive $Drive has only $Free GB left to use! ($Used GB out of $Total GB in use, minimum is $MinLevel GB)"
|
||||
exit 1
|
||||
}
|
||||
write-host -foregroundColor green "OK - drive $Drive has $FreeSpace GB free space left (warning level is < $WarningLevel GB)"
|
||||
"✔️ $Free GB left on drive $Drive ($Used GB of $Total GB used)"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
|
25
Scripts/check-file-system.ps1
Executable file
25
Scripts/check-file-system.ps1
Executable file
@ -0,0 +1,25 @@
|
||||
<#
|
||||
.SYNTAX check-file-system.ps1 [<drive>]
|
||||
.DESCRIPTION checks the validity of the file system (needs admin rights)
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
#Requires -RunAsAdministrator
|
||||
|
||||
param($Drive = "")
|
||||
|
||||
if ($Drive -eq "" ) {
|
||||
$Drive = read-host "Enter drive (letter) to check"
|
||||
}
|
||||
|
||||
try {
|
||||
$Result = repair-volume -driveLetter $Drive -scan
|
||||
if ($Result -ne "NoErrorsFound") { throw "'repair-volume' failed" }
|
||||
|
||||
write-host -foregroundColor green "✔️ file system on drive $Drive is clean"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
38
Scripts/check-health.ps1
Executable file
38
Scripts/check-health.ps1
Executable file
@ -0,0 +1,38 @@
|
||||
<#
|
||||
.SYNTAX check-health.ps1
|
||||
.DESCRIPTION checks the health of the local computer
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
$Hostname = $(hostname)
|
||||
$Healthy = 1
|
||||
"Checking health of $Hostname ..."
|
||||
|
||||
& "$PSScriptRoot/check-swap-space.ps1"
|
||||
if ($lastExitCode -ne "0") { $Healthy = 0 }
|
||||
|
||||
if ($IsLinux) {
|
||||
& "$PSScriptRoot/check-drive-space.ps1" /
|
||||
if ($lastExitCode -ne "0") { $Healthy = 0 }
|
||||
} else {
|
||||
& "$PSScriptRoot/check-drive-space.ps1" C
|
||||
if ($lastExitCode -ne "0") { $Healthy = 0 }
|
||||
}
|
||||
|
||||
& "$PSScriptRoot/check-cpu-temp.ps1"
|
||||
if ($lastExitCode -ne "0") { $Healthy = 0 }
|
||||
|
||||
& "$PSScriptRoot/check-dns-resolution.ps1"
|
||||
if ($lastExitCode -ne "0") { $Healthy = 0 }
|
||||
|
||||
& "$PSScriptRoot/check-ping.ps1"
|
||||
if ($lastExitCode -ne "0") { $Healthy = 0 }
|
||||
|
||||
if ($Healthy) {
|
||||
"✔️ $Hostname is healthy"
|
||||
exit 0
|
||||
} else {
|
||||
write-warning "$Hostname is NOT healthy"
|
||||
exit 1
|
||||
}
|
@ -1,9 +1,8 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./check-ipv4-address.ps1 [<address>]
|
||||
.DESCRIPTION checks the given IPv4 address for validity
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
.SYNTAX check-ipv4-address.ps1 [<address>]
|
||||
.DESCRIPTION checks the given IPv4 address for validity
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($Address = "")
|
||||
@ -29,6 +28,6 @@ try {
|
||||
exit 1
|
||||
}
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./check-ipv6-address.ps1 [<address>]
|
||||
.DESCRIPTION checks the given IPv6 address for validity
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
.SYNTAX check-ipv6-address.ps1 [<address>]
|
||||
.DESCRIPTION checks the given IPv6 address for validity
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($Address = "")
|
||||
@ -42,6 +41,6 @@ try {
|
||||
exit 1
|
||||
}
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
|
@ -1,10 +1,9 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./check-mac-address.ps1 [<MAC>]
|
||||
.DESCRIPTION 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
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
.SYNTAX check-mac-address.ps1 [<MAC>]
|
||||
.DESCRIPTION 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
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($MAC = "")
|
||||
@ -30,6 +29,6 @@ try {
|
||||
exit 1
|
||||
}
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
|
32
Scripts/check-ping.ps1
Executable file
32
Scripts/check-ping.ps1
Executable file
@ -0,0 +1,32 @@
|
||||
<#
|
||||
.SYNTAX check-ping.ps1
|
||||
.DESCRIPTION checks the ping latency to the internet
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
try {
|
||||
write-verbose "Sending pings to the internet ..."
|
||||
$Pings = test-connection -count 1 -computerName heise.de,cnn.com,github.com,www.microsoft.com,dropbox.com,amazon.com,google.com,bing.com,youtube.com
|
||||
|
||||
[int]$Min = 9999999
|
||||
[int]$Max = 0
|
||||
[int]$Avg = 0
|
||||
foreach($Ping in $Pings) {
|
||||
if ($IsLinux) {
|
||||
[int]$Latency = $Ping.latency
|
||||
} else {
|
||||
[int]$Latency = $Ping.ResponseTime
|
||||
}
|
||||
if ($Latency -lt $Min) { $Min = $Latency }
|
||||
if ($Latency -gt $Max) { $Max = $Latency }
|
||||
$Avg += $Latency
|
||||
}
|
||||
$Avg = $Avg / $Pings.count
|
||||
|
||||
"✔️ $Avg ms average ping latency ($Min ms min, $Max ms max)"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
38
Scripts/check-swap-space.ps1
Executable file
38
Scripts/check-swap-space.ps1
Executable file
@ -0,0 +1,38 @@
|
||||
<#
|
||||
.SYNTAX check-swap-space.ps1 [<min-level>]
|
||||
.DESCRIPTION checks the free swap space
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([int]$MinLevel = 50) # minimum level in GB
|
||||
|
||||
try {
|
||||
if ($IsLinux) {
|
||||
$Result = $(free --mega | grep Swap:)
|
||||
[int]$Total = $Result.subString(5,14)
|
||||
[int]$Used = $Result.substring(20,13)
|
||||
[int]$Free = $Result.substring(31,12)
|
||||
} else {
|
||||
$Items = get-wmiobject -class "Win32_PageFileUsage" -namespace "root\CIMV2" -computername localhost
|
||||
foreach ($Item in $Items) {
|
||||
[int]$Total = $Item.AllocatedBaseSize
|
||||
[int]$Used = $Item.CurrentUsage
|
||||
[int]$Free = ($Total - $Used)
|
||||
}
|
||||
}
|
||||
|
||||
if ($Total -eq "0") {
|
||||
write-warning "No swap space configured!"
|
||||
exit 1
|
||||
}
|
||||
if ($Free -lt $MinLevel) {
|
||||
write-warning "Swap space has only $Free GB left to use! ($Used GB out of $Total GB in use, minimum is $MinLevel GB)"
|
||||
exit 1
|
||||
}
|
||||
"✔️ $Free GB left on swap space ($Used GB of $Total GB used)"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
@ -1,9 +1,8 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./check-symlinks.ps1 [<dir-tree>]
|
||||
.DESCRIPTION checks every symlink in the given directory tree
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
.SYNTAX check-symlinks.ps1 [<dir-tree>]
|
||||
.DESCRIPTION checks every symlink in the given directory tree
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($DirTree = "")
|
||||
@ -28,9 +27,9 @@ try {
|
||||
}
|
||||
$SymlinksTotal++
|
||||
}
|
||||
write-host -foregroundColor green "Done - $SymlinksBroken out of $SymlinksTotal are broken"
|
||||
write-host -foregroundColor green "OK - found $SymlinksTotal symlinks total, $SymlinksBroken symlinks are broken"
|
||||
exit $SymlinksBroken
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
|
51
Scripts/check-weather.ps1
Executable file
51
Scripts/check-weather.ps1
Executable file
@ -0,0 +1,51 @@
|
||||
<#
|
||||
.SYNTAX check-weather.ps1 [<location>]
|
||||
.DESCRIPTION checks the weather for critical values
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($Location = "") # empty means determine automatically
|
||||
|
||||
function Check { param([int]$Value, [int]$NormalMin, [int]$NormalMax, [string]$Unit)
|
||||
if ($Value -lt $NormalMin) {
|
||||
return "$Value $Unit ! "
|
||||
}
|
||||
if ($Value -gt $NormalMax) {
|
||||
return "$Value $Unit ! "
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
try {
|
||||
$Weather = (Invoke-WebRequest http://wttr.in/${Location}?format=j1 -UserAgent "curl" ).Content | ConvertFrom-Json
|
||||
|
||||
$Temp = $Weather.current_condition.temp_C
|
||||
$Precip = $Weather.current_condition.precipMM
|
||||
$Humidity = $Weather.current_condition.humidity
|
||||
$Pressure = $Weather.current_condition.pressure
|
||||
$WindSpeed = $Weather.current_condition.windspeedKmph
|
||||
$WindDir = $Weather.current_condition.winddir16Point
|
||||
$UV = $Weather.current_condition.uvIndex
|
||||
$Visib = $Weather.current_condition.visibility
|
||||
$Clouds = $Weather.current_condition.cloudcover
|
||||
$Desc = $Weather.current_condition.weatherDesc.value
|
||||
$Area = $Weather.nearest_area.areaName.value
|
||||
$Region = $Weather.nearest_area.region.value
|
||||
"Now: $($Temp)°C $($Precip)mm $($Humidity)% $($WindSpeed)km/h from $WindDir $($Pressure)hPa UV$($UV) $($Visib)km $($Clouds)% $Desc at $Area ($Region)"
|
||||
|
||||
$Result+=Check $Weather.current_condition.windspeedKmph 0 48 "km/h"
|
||||
$Result+=Check $Weather.current_condition.visibility 1 1000 "km visibility"
|
||||
$Result+=Check $Weather.current_condition.temp_C -20 40 "°C"
|
||||
$Result+=Check $Weather.current_condition.uvIndex 0 6 "UV"
|
||||
|
||||
if ($Result -eq "") {
|
||||
"Calm weather"
|
||||
} else {
|
||||
"WEATHER ALERT: $Result"
|
||||
}
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
@ -1,9 +1,8 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./check-windows-system-files.ps1
|
||||
.DESCRIPTION checks the validity of the Windows system files (requires admin rights)
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
<#
|
||||
.SYNTAX check-windows-system-files.ps1
|
||||
.DESCRIPTION checks the validity of the Windows system files (requires admin rights)
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
#Requires -RunAsAdministrator
|
||||
@ -12,9 +11,9 @@ try {
|
||||
sfc /verifyOnly
|
||||
if ($lastExitCode -ne "0") { throw "'sfc /verifyOnly' failed" }
|
||||
|
||||
write-host -foregroundColor green "OK - Windows system files have been checked"
|
||||
write-host -foregroundColor green "✔️ checked Windows system files"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./check-xml-file [<file>]
|
||||
.DESCRIPTION checks the given XML file for validity
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
.SYNTAX check-xml-file [<file>]
|
||||
.DESCRIPTION checks the given XML file for validity
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($File = "")
|
||||
@ -33,6 +32,6 @@ try {
|
||||
write-host -foregroundColor green "OK - XML file is valid"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
|
58
Scripts/cherry-picker.ps1
Executable file
58
Scripts/cherry-picker.ps1
Executable file
@ -0,0 +1,58 @@
|
||||
<#
|
||||
.SYNTAX cherry-picker.ps1 [<commit-id>] [<commit-message>] [<branches>] [<repo-dir>]
|
||||
.DESCRIPTION cherry-picks a Git commit into multiple branches
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($CommitID = "", $CommitMessage = "", $Branches = "", $RepoDir = "$PWD")
|
||||
|
||||
if ($CommitID -eq "" ) { $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" }
|
||||
|
||||
try {
|
||||
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||
set-location "$RepoDir"
|
||||
|
||||
foreach($Branch in $Branches) {
|
||||
|
||||
"STEP: Switching to branch $Branch (git checkout)..."
|
||||
& git checkout --recurse-submodules --force $Branch
|
||||
if ($lastExitCode -ne "0") { throw "'git checkout' failed" }
|
||||
|
||||
"STEP: Updating submodules (git submodule update)..."
|
||||
& git submodule update --init --recursive
|
||||
if ($lastExitCode -ne "0") { throw "'git submodule update' failed" }
|
||||
|
||||
"STEP: Cleaning the repository (git clean -fdx)..."
|
||||
& git clean -fdx
|
||||
if ($lastExitCode -ne "0") { throw "'git clean -fdx' failed" }
|
||||
|
||||
& git submodule foreach --recursive git clean -fdx
|
||||
if ($lastExitCode -ne "0") { throw "'git clean -fdx' in submodules failed" }
|
||||
|
||||
"STEP: Pulling latest updates (git pull)..."
|
||||
& git pull --recurse-submodules
|
||||
if ($lastExitCode -ne "0") { throw "'git pull' failed" }
|
||||
|
||||
"STEP: Checking the status (git status)..."
|
||||
$Result = (git status)
|
||||
if ($lastExitCode -ne "0") { throw "'git status' failed" }
|
||||
if ("$Result" -notmatch "nothing to commit, working tree clean") { throw "Branch is NOT clean: $Result" }
|
||||
|
||||
& git cherry-pick --no-commit "$CommitID"
|
||||
if ($lastExitCode -ne "0") { throw "'git cherry-pick $CommitID' failed" }
|
||||
|
||||
& git commit -m "$CommitMessage"
|
||||
if ($lastExitCode -ne "0") { throw "'git commit' failed" }
|
||||
|
||||
& git push
|
||||
if ($lastExitCode -ne "0") { throw "'git push' failed" }
|
||||
}
|
||||
"DONE."
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./clean-branch.ps1 [<repo-dir>]
|
||||
.DESCRIPTION cleans the current Git branch including submodules from generated files (e.g. for a fresh build)
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($RepoDir = "$PWD")
|
||||
|
||||
try {
|
||||
& git --version
|
||||
} catch {
|
||||
write-error "ERROR: can't execute 'git' - make sure Git is installed and available"
|
||||
exit 1
|
||||
}
|
||||
|
||||
try {
|
||||
write-progress "Cleaning current branch in repository $RepoDir..."
|
||||
set-location $RepoDir
|
||||
|
||||
& git clean -fdx # force + recurse into dirs + don't use the standard ignore rules
|
||||
if ($lastExitCode -ne "0") { throw "'git clean -fdx' failed" }
|
||||
|
||||
& git submodule foreach --recursive git clean -fdx
|
||||
if ($lastExitCode -ne "0") { throw "'git clean -fdx' in submodules failed" }
|
||||
|
||||
write-host -foregroundColor green "OK - cleaned current branch in repository $RepoDir"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
31
Scripts/clean-repo.ps1
Executable file
31
Scripts/clean-repo.ps1
Executable file
@ -0,0 +1,31 @@
|
||||
<#
|
||||
.SYNTAX clean-repo.ps1 [<repo-dir>]
|
||||
.DESCRIPTION cleans a Git repository from untracked files (including submodules, e.g. for a fresh build)
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($RepoDir = "$PWD")
|
||||
|
||||
try {
|
||||
$RepoDir = resolve-path "$RepoDir"
|
||||
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||
set-location "$RepoDir"
|
||||
|
||||
"⏳ Cleaning Git repository 📂$RepoDir from untracked files..."
|
||||
|
||||
$Null = (git --version)
|
||||
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||
|
||||
& git clean -fdx # force + recurse into dirs + don't use the standard ignore rules
|
||||
if ($lastExitCode -ne "0") { throw "'git clean -fdx' failed" }
|
||||
|
||||
& git submodule foreach --recursive git clean -fdx
|
||||
if ($lastExitCode -ne "0") { throw "'git clean -fdx' in submodules failed" }
|
||||
|
||||
"✔️ Git repository 📂$RepoDir is clean now"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
15
Scripts/clear-recycle-bin.ps1
Executable file
15
Scripts/clear-recycle-bin.ps1
Executable file
@ -0,0 +1,15 @@
|
||||
<#
|
||||
.SYNTAX clear-recycle-bin.ps1
|
||||
.DESCRIPTION removes the content of the recycle bin folder (can not be undo!)
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
try {
|
||||
Clear-RecycleBin -Confirm:$false
|
||||
"✔️ recycle bin have been emptied"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
@ -1,39 +1,39 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./clone-repos.ps1 [<target-dir>]
|
||||
.DESCRIPTION clones well-known Git repositories into the current/given directory.
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
<#
|
||||
.SYNTAX clone-repos.ps1 [<parent-dir>]
|
||||
.DESCRIPTION clones well-known Git repositories under the current/given directory.
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($TargetDir = "$PWD")
|
||||
param($ParentDir = "$PWD")
|
||||
|
||||
try {
|
||||
& git --version
|
||||
} catch {
|
||||
write-error "ERROR: can't execute 'git' - make sure Git is installed and available"
|
||||
exit 1
|
||||
}
|
||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
try {
|
||||
$PathToRepo = "$PSScriptRoot/.."
|
||||
$Table = import-csv "$PathToRepo/Data/repos.csv"
|
||||
if (-not(test-path "$ParentDir" -pathType container)) { throw "Can't access directory: $ParentDir" }
|
||||
|
||||
set-location $TargetDir
|
||||
$Null = (git --version)
|
||||
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||
|
||||
$Table = import-csv "$PSScriptRoot/../Data/git-repositories.csv"
|
||||
|
||||
[int]$Count = 0
|
||||
foreach($Row in $Table) {
|
||||
$URL = $Row.URL
|
||||
$Directory = $Row.Directory
|
||||
write-output ""
|
||||
if (Test-Path $Directory) {
|
||||
write-output "Skipping existing $Directory ..."
|
||||
$DirName = $Row.Directory
|
||||
if (test-path "$ParentDir/$DirName" -pathType container) {
|
||||
"Skipping 📂$DirName because it exists already ..."
|
||||
continue
|
||||
}
|
||||
write-output "Cloning from $URL..."
|
||||
& git clone --recurse-submodules $URL
|
||||
"⏳ Cloning $URL to 📂$DirName ..."
|
||||
& git clone --recurse-submodules "$URL" "$ParentDir/$DirName"
|
||||
if ($lastExitCode -ne "0") { throw "'git clone $URL' failed" }
|
||||
$Count++
|
||||
}
|
||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||
"✔️ cloned $Count Git repositories at 📂$ParentDir in $Elapsed sec."
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./close-calculator.ps1
|
||||
.DESCRIPTION closes the calculator program gracefully
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
.SYNTAX close-calculator.ps1
|
||||
.DESCRIPTION closes the calculator program gracefully
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
./close-program "Calculator" "Calculator" "calc"
|
||||
& "$PSScriptRoot/close-program.ps1" "Calculator" "Calculator" "calc"
|
||||
exit 0
|
||||
|
@ -1,9 +1,9 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./close-chrome.ps1
|
||||
.DESCRIPTION closes Google Chrome gracefully
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
.SYNTAX close-chrome.ps1
|
||||
.DESCRIPTION closes Google Chrome gracefully
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
./close-program "Google Chrome" "chrome"
|
||||
& "$PSScriptRoot/close-program.ps1" "Google Chrome" "chrome" "chrome"
|
||||
exit 0
|
||||
|
@ -1,9 +1,9 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./close-cortana.ps1
|
||||
.DESCRIPTION closes Cortana gracefully
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
.SYNTAX close-cortana.ps1
|
||||
.DESCRIPTION closes Cortana gracefully
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
./close-program "Cortana" "Cortana"
|
||||
& "$PSScriptRoot/close-program.ps1" "Cortana" "Cortana" "Cortana"
|
||||
exit 0
|
||||
|
@ -1,9 +1,9 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./close-edge.ps1
|
||||
.DESCRIPTION closes Microsoft Edge gracefully
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
.SYNTAX close-edge.ps1
|
||||
.DESCRIPTION closes Microsoft Edge gracefully
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
./close-program "Microsoft Edge" "msedge"
|
||||
& "$PSScriptRoot/close-program.ps1" "Microsoft Edge" "msedge" "msedge"
|
||||
exit 0
|
||||
|
@ -1,9 +1,9 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./close-file-explorer.ps1
|
||||
.DESCRIPTION closes Microsoft File Explorer gracefully
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
.SYNTAX close-file-explorer.ps1
|
||||
.DESCRIPTION closes Microsoft File Explorer gracefully
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
./close-program "File Explorer" "explorer"
|
||||
& "$PSScriptRoot/close-program.ps1" "File Explorer" "explorer" "explorer"
|
||||
exit 0
|
||||
|
@ -1,9 +1,8 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./close-program.ps1 [<full-program-name>][<program-name>] [<program-alias-name>]
|
||||
.DESCRIPTION closes the processes of the given program gracefully
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
<#
|
||||
.SYNTAX close-program.ps1 [<full-program-name>] [<program-name>] [<program-alias-name>]
|
||||
.DESCRIPTION closes the processes of the given program gracefully
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($FullProgramName = "", $ProgramName = "", $ProgramAliasName = "")
|
||||
@ -36,9 +35,9 @@ try {
|
||||
start-sleep -milliseconds 100
|
||||
stop-process -name $ProgramName -force -errorAction 'silentlycontinue'
|
||||
}
|
||||
write-host -foregroundColor green "Done - $FullProgramName has been closed ($($Processes.Count) proc)."
|
||||
write-host -foregroundColor green "✔️ closed $FullProgramName, found ($($Processes.Count) process(es)"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./close-system-settings.ps1
|
||||
.DESCRIPTION closes the System Settings gracefully
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
.SYNTAX close-system-settings.ps1
|
||||
.DESCRIPTION closes the System Settings gracefully
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
./close-program "System Settings" "SystemSettings"
|
||||
& "$PSScriptRoot/close-program.ps1" "System Settings" "SystemSettings" "SystemSettings"
|
||||
exit 0
|
||||
|
@ -1,9 +1,9 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./close-thunderbird.ps1
|
||||
.DESCRIPTION closes Mozilla Thunderbird gracefully
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
.SYNTAX close-thunderbird.ps1
|
||||
.DESCRIPTION closes Mozilla Thunderbird gracefully
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
./close-program "Mozilla Thunderbird" "thunderbird"
|
||||
& "$PSScriptRoot/close-program.ps1" "Mozilla Thunderbird" "thunderbird" "thunderbird"
|
||||
exit 0
|
||||
|
@ -1,9 +1,9 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./close-vlc.ps1
|
||||
.DESCRIPTION closes the VLC media player gracefully
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
.SYNTAX close-vlc.ps1
|
||||
.DESCRIPTION closes the VLC media player gracefully
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
./close-program "VLC media player" "vlc"
|
||||
& "$PSScriptRoot/close-program.ps1" "VLC media player" "vlc" "vlc"
|
||||
exit 0
|
||||
|
@ -1,9 +1,9 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./close-windows-terminal.ps1
|
||||
.DESCRIPTION closes Windows Terminal gracefully
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
.SYNTAX close-windows-terminal.ps1
|
||||
.DESCRIPTION closes Windows Terminal gracefully
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
./close-program "Windows Terminal" "WindowsTerminal"
|
||||
& "$PSScriptRoot/close-program.ps1" "Windows Terminal" "WindowsTerminal" "WindowsTerminal"
|
||||
exit 0
|
||||
|
@ -1,31 +1,19 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./configure-git.ps1 [<full-name>] [<email-address>] [<favorite-editor>]
|
||||
.DESCRIPTION sets up the Git user configuration
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
<#
|
||||
.SYNTAX configure-git.ps1 [<full-name>] [<email-address>] [<favorite-editor>]
|
||||
.DESCRIPTION sets up the Git user configuration
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
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,...)"
|
||||
}
|
||||
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 {
|
||||
write-error "Can't execute 'git' - make sure Git is installed and available"
|
||||
exit 1
|
||||
}
|
||||
$Null = (git --version)
|
||||
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||
|
||||
try {
|
||||
& git config --global user.name $FullName
|
||||
& git config --global user.email $EmailAddress
|
||||
& git config --global core.editor $FavoriteEditor
|
||||
@ -34,10 +22,10 @@ try {
|
||||
& git config --global core.symlinks true
|
||||
& git config --global core.longpaths true
|
||||
& git config --global init.defaultBranch main
|
||||
write-host -foregroundColor green "Done - your Git user configuration is now:"
|
||||
write-host -foregroundColor green "✔️ your Git configuration has been saved, it's now:"
|
||||
& git config --list
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
|
21
Scripts/convert-csv2txt.ps1
Executable file
21
Scripts/convert-csv2txt.ps1
Executable file
@ -0,0 +1,21 @@
|
||||
<#
|
||||
.SYNTAX convert-csv2txt.ps1 [<csv-file>]
|
||||
.DESCRIPTION converts the given CSV file into a text list
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($Path = "")
|
||||
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) {
|
||||
write-output "* $($Row.A) $($Row.B) $($Row.C) $($Row.D) $($Row.E) $($Row.F) $($Row.G) $($Row.H)"
|
||||
}
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
24
Scripts/convert-mysql2csv.ps1
Executable file
24
Scripts/convert-mysql2csv.ps1
Executable file
@ -0,0 +1,24 @@
|
||||
<#
|
||||
.SYNTAX convert-mysql2csv.ps1 [<server>] [<database>] [<username>] [<password>] [<query>]
|
||||
.DESCRIPTION convert the MySQL database table to a CSV file
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
|
||||
param($server = "", $database = "", $username = "", $password = "", $query = "")
|
||||
if ($server -eq "") { $server = read-host "Enter the hostname/IP address of the MySQL server" }
|
||||
if ($database -eq "") { $database = read-host "Enter the database name" }
|
||||
if ($username -eq "") { $username = read-host "Enter the database username" }
|
||||
if ($password -eq "") { $password = read-host "Enter the database user password" }
|
||||
if ($query -eq "") { $query = read-host "Enter the database query" }
|
||||
|
||||
try {
|
||||
$csvfilepath = "$PSScriptRoot\mysql_table.csv"
|
||||
$result = Invoke-MySqlQuery -ConnectionString "server=$server; database=$database; user=$username; password=$password; pooling = false; convert zero datetime=True" -Sql $query -CommandTimeout 10000
|
||||
$result | Export-Csv $csvfilepath -NoTypeInformation
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
25
Scripts/convert-sql2csv.ps1
Executable file
25
Scripts/convert-sql2csv.ps1
Executable file
@ -0,0 +1,25 @@
|
||||
<#
|
||||
.SYNTAX convert-sql2csv.ps1 [<server>] [<database>] [<username>] [<password>] [<query>]
|
||||
.DESCRIPTION convert the SQL database table to a CSV file
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($server = "", $database = "", $username = "", $password = "", $query = "")
|
||||
if ($server -eq "") { $server = read-host "Enter the hostname/IP address of the SQL server" }
|
||||
if ($database -eq "") { $database = read-host "Enter the database name" }
|
||||
if ($username -eq "") { $username = read-host "Enter the database username" }
|
||||
if ($password -eq "") { $password = read-host "Enter the database user password" }
|
||||
if ($query -eq "") { $query = read-host "Enter the database query" }
|
||||
|
||||
try {
|
||||
$secpasswd = ConvertTo-SecureString $password -AsPlainText -Force
|
||||
$creds = New-Object System.Management.Automation.PSCredential ($username, $secpasswd)
|
||||
$csvfilepath = "$PSScriptRoot\sqlserver_table.csv"
|
||||
$result = Invoke-SqlServerQuery -Credential $creds -ConnectionTimeout 10000 -Database $database -Server $server -Sql $query -CommandTimeout 10000
|
||||
$result | Export-Csv $csvfilepath -NoTypeInformation
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
22
Scripts/convert-txt2wav.ps1
Executable file
22
Scripts/convert-txt2wav.ps1
Executable file
@ -0,0 +1,22 @@
|
||||
<#
|
||||
.SYNTAX convert-txt2wav.ps1 [<text>] [<wav-file>]
|
||||
.DESCRIPTION converts the given text to a .WAV audio file
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($Text = "", $WavFile = "")
|
||||
if ($Text -eq "") { $Text = read-host "Enter text to speak" }
|
||||
if ($WavFile -eq "") { $WavFile = read-host "Enter .WAV file to save to" }
|
||||
|
||||
try {
|
||||
Add-Type -AssemblyName System.Speech
|
||||
$SpeechSynthesizer = New-Object System.Speech.Synthesis.SpeechSynthesizer
|
||||
$SpeechSynthesizer.SetOutputToWaveFile($tWavFile)
|
||||
$SpeechSynthesizer.Speak($Text)
|
||||
$SpeechSynthesizer.Dispose()
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
39
Scripts/create-branch.ps1
Executable file
39
Scripts/create-branch.ps1
Executable file
@ -0,0 +1,39 @@
|
||||
<#
|
||||
.SYNTAX create-branch.ps1 [<new-branch-name>] [<repo-dir>]
|
||||
.DESCRIPTION creates and switches to a new branch in a Git repository
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($NewBranchName = "", $RepoDir = "$PWD")
|
||||
if ($NewBranchName -eq "") { $NewBranchName = read-host "Enter new branch name" }
|
||||
|
||||
try {
|
||||
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||
set-location "$RepoDir"
|
||||
|
||||
$Null = (git --version)
|
||||
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||
|
||||
$Result = (git status)
|
||||
if ($lastExitCode -ne "0") { throw "'git status' failed in $RepoDir" }
|
||||
if ("$Result" -notmatch "nothing to commit, working tree clean") { throw "Repository is NOT clean: $Result" }
|
||||
|
||||
& "$PSScriptRoot/fetch-repo.ps1"
|
||||
if ($lastExitCode -ne "0") { throw "Script 'fetch-repo.ps1' failed" }
|
||||
|
||||
& git checkout -b "$NewBranchName"
|
||||
if ($lastExitCode -ne "0") { throw "'git checkout -b $NewBranchName' failed" }
|
||||
|
||||
& git push origin "$NewBranchName"
|
||||
if ($lastExitCode -ne "0") { throw "'git push origin $NewBranchName' failed" }
|
||||
|
||||
& git submodule update --init --recursive
|
||||
if ($lastExitCode -ne "0") { throw "'git submodule update' failed" }
|
||||
|
||||
"✔️ created new branch 🌵$NewBranchName in Git repository $RepoDir"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
27
Scripts/create-shortcut.ps1
Executable file
27
Scripts/create-shortcut.ps1
Executable file
@ -0,0 +1,27 @@
|
||||
<#
|
||||
.SYNTAX create-shortcut.ps1 [<shortcut>] [<target>] [<description>]
|
||||
.DESCRIPTION creates a new shortcut
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($Shortcut = "", $Target = "", $Description)
|
||||
if ($Shortcut -eq "" ) { $Shortcut = read-host "Enter filename of shortcut" }
|
||||
if ($Target -eq "" ) { $Target = read-host "Enter path to target" }
|
||||
if ($Description -eq "" ) { $Description = read-host "Enter description" }
|
||||
|
||||
try {
|
||||
$sh = new-object -ComObject WScript.Shell
|
||||
$shortcut = $sh.CreateShortcut("$Shortcut.lnk")
|
||||
$shortcut.TargetPath = "$Target"
|
||||
$shortcut.WindowStyle = "1"
|
||||
$shortcut.IconLocation = "C:\Windows\System32\SHELL32.dll, 3"
|
||||
$shortcut.Description = "$Description"
|
||||
$shortcut.save()
|
||||
|
||||
write-host -foregroundColor green "✔️ shortcut $Shortcut created."
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
@ -1,26 +1,20 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./create-symlink.ps1 [<symlink>] [<target>]
|
||||
.DESCRIPTION creates a symbolic link
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
<#
|
||||
.SYNTAX create-symlink.ps1 [<symlink>] [<target>]
|
||||
.DESCRIPTION creates a symbolic link
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($Symlink = "", $Target = "")
|
||||
|
||||
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."
|
||||
write-host -foregroundColor green "✔️ symlink $Symlink created (pointing to $Target)"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
|
36
Scripts/create-tag.ps1
Executable file
36
Scripts/create-tag.ps1
Executable file
@ -0,0 +1,36 @@
|
||||
<#
|
||||
.SYNTAX create-tag.ps1 [<new-tag-name>] [<repo-dir>]
|
||||
.DESCRIPTION creates a new tag in the current/given Git repository
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($NewTagName = "", $RepoDir = "$PWD")
|
||||
if ($NewTagName -eq "") { $NewTagName = read-host "Enter new tag name" }
|
||||
|
||||
try {
|
||||
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||
set-location "$RepoDir"
|
||||
|
||||
$Null = (git --version)
|
||||
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||
|
||||
$Result = (git status)
|
||||
if ($lastExitCode -ne "0") { throw "'git status' failed in $RepoDir" }
|
||||
if ("$Result" -notmatch "nothing to commit, working tree clean") { throw "Repository is NOT clean: $Result" }
|
||||
|
||||
& "$PSScriptRoot/fetch-repo.ps1"
|
||||
if ($lastExitCode -ne "0") { throw "Script 'fetch-repo.ps1' failed" }
|
||||
|
||||
& git tag "$NewTagName"
|
||||
if ($lastExitCode -ne "0") { throw "Error: 'git tag $NewTagName' failed!" }
|
||||
|
||||
& git push origin "$NewTagName"
|
||||
if ($lastExitCode -ne "0") { throw "Error: 'git push origin $NewTagName' failed!" }
|
||||
|
||||
"🔖 tag $NewTagName has been created"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./csv-to-text.ps1 [<csv-file>]
|
||||
.DESCRIPTION converts the given CSV file into a text list
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([String]$Path)
|
||||
|
||||
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) {
|
||||
write-output "* $($Row.A) $($Row.B) $($Row.C) $($Row.D) $($Row.E) $($Row.F) $($Row.G) $($Row.H)"
|
||||
# write-output "* [$($Row.B)](ipfs::$($Row.A))"
|
||||
}
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
@ -12,7 +12,7 @@ HOMEDIR=/home/mf
|
||||
$HOMEDIR/PowerShell/Scripts/query-smart-data.ps1 $HOMEDIR
|
||||
# to query S.M.A.R.T. data of all your HDD's/SSD's
|
||||
|
||||
$HOMEDIR/PowerShell/Scripts/train-dns-cache.ps1
|
||||
$HOMEDIR/PowerShell/Scripts/check-dns-resolution.ps1
|
||||
# to train the DNS cache with frequently used domain names
|
||||
|
||||
exit 0
|
||||
|
@ -1,9 +1,8 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./decrypt-file.ps1 [<path>] [<password>]
|
||||
.DESCRIPTION decrypts the given file
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
.SYNTAX decrypt-file.ps1 [<path>] [<password>]
|
||||
.DESCRIPTION decrypts the given file
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$Path = "", [string]$Password = "")
|
||||
@ -164,6 +163,6 @@ try {
|
||||
write-host -foregroundColor green "Done."
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./display-time.ps1 [<seconds>]
|
||||
.DESCRIPTION displays the current time for 10 seconds by default
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
.SYNTAX display-time.ps1 [<seconds>]
|
||||
.DESCRIPTION displays the current time for 10 seconds by default
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([int]$Seconds = 10)
|
||||
@ -19,6 +18,6 @@ try {
|
||||
}
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
|
23
Scripts/download-dir.ps1
Executable file
23
Scripts/download-dir.ps1
Executable file
@ -0,0 +1,23 @@
|
||||
<#
|
||||
.SYNTAX download-dir.ps1 [<URL>]
|
||||
.DESCRIPTION downloads a directory tree from the given URL
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($URL = "")
|
||||
if ($URL -eq "") { $URL = read-host "Enter directory URL to download" }
|
||||
|
||||
try {
|
||||
& wget --version
|
||||
if ($lastExitCode -ne "0") { throw "Can't execute 'wget' - make sure wget is installed and available" }
|
||||
|
||||
& wget --mirror --convert-links --adjust-extension --page-requisites --no-parent $URL --directory-prefix . --no-verbose
|
||||
if ($lastExitCode -ne "0") { throw "Can't execute 'wget --mirror $URL'" }
|
||||
|
||||
write-host -foregroundColor green "OK - directory downloaded from $URL"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
23
Scripts/download-file.ps1
Executable file
23
Scripts/download-file.ps1
Executable file
@ -0,0 +1,23 @@
|
||||
<#
|
||||
.SYNTAX download-file.ps1 [<URL>]
|
||||
.DESCRIPTION downloads a file from the given URL
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($URL = "")
|
||||
if ($URL -eq "") { $URL = read-host "Enter file URL to download" }
|
||||
|
||||
try {
|
||||
& wget --version
|
||||
if ($lastExitCode -ne "0") { throw "Can't execute 'wget' - make sure wget is installed and available" }
|
||||
|
||||
& wget --mirror --convert-links --adjust-extension --page-requisites --no-parent $URL --directory-prefix . --no-verbose
|
||||
if ($lastExitCode -ne "0") { throw "Can't execute 'wget --mirror $URL'" }
|
||||
|
||||
write-host -foregroundColor green "OK - file downloaded from $URL"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./download.ps1 [<URL>]
|
||||
.DESCRIPTION downloads the file/directory from the given URL
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($URL = "")
|
||||
|
||||
if ($URL -eq "" ) {
|
||||
$URL = read-host "Enter URL to download"
|
||||
}
|
||||
|
||||
try {
|
||||
& wget --version
|
||||
} catch {
|
||||
write-error "Can't execute 'wget' - make sure wget is installed and available"
|
||||
exit 1
|
||||
}
|
||||
|
||||
try {
|
||||
wget --mirror --convert-links --adjust-extension --page-requisites --no-parent $URL --directory-prefix . --no-verbose
|
||||
|
||||
write-host -foregroundColor green "Done."
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
23
Scripts/edit.ps1
Executable file
23
Scripts/edit.ps1
Executable file
@ -0,0 +1,23 @@
|
||||
<#
|
||||
.SYNTAX edit.ps1 <filename>
|
||||
.DESCRIPTION starts the built-in text editor to edit the given file
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($Filename = "")
|
||||
|
||||
try {
|
||||
if ($IsLinux) {
|
||||
& vi "$Filename"
|
||||
if ($lastExitCode -ne "0") { throw "Can't execute 'vi' - make sure vi is installed and available" }
|
||||
} else {
|
||||
& notepad.exe "$Filename"
|
||||
if ($lastExitCode -ne "0") { throw "Can't execute 'notepad.exe' - make sure notepad.exe is installed and available" }
|
||||
}
|
||||
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
@ -1,9 +1,8 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./enable-crash-dumps.ps1
|
||||
.DESCRIPTION enables the writing of crash dumps
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
<#
|
||||
.SYNTAX enable-crash-dumps.ps1
|
||||
.DESCRIPTION enables the writing of crash dumps
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
##################################################################
|
||||
@ -289,3 +288,4 @@ Else
|
||||
write-host "You did not enter a valid option. Please re-run Get-Dump.ps1"
|
||||
start-sleep -s 5
|
||||
}
|
||||
exit 0
|
||||
|
21
Scripts/enable-god-mode.ps1
Executable file
21
Scripts/enable-god-mode.ps1
Executable file
@ -0,0 +1,21 @@
|
||||
<#
|
||||
.SYNTAX enable-god-mode.ps1
|
||||
.DESCRIPTION enables the god mode (adds a new icon to the desktop)
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
try {
|
||||
$GodModeSplat = @{
|
||||
Path = "$HOME\Desktop"
|
||||
Name = "GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}"
|
||||
ItemType = 'Directory'
|
||||
}
|
||||
$null = new-item @GodModeSplat
|
||||
|
||||
"✔️ new icon added to the desktop"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
18
Scripts/enable-ssh-client.ps1
Executable file
18
Scripts/enable-ssh-client.ps1
Executable file
@ -0,0 +1,18 @@
|
||||
<#
|
||||
.SYNTAX enable-ssh-client.ps1
|
||||
.DESCRIPTION enables the SSH client (needs admin rights)
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
#Requires -RunAsAdministrator
|
||||
|
||||
try {
|
||||
Add-WindowsCapability -Online -Name OpenSSH.Client*
|
||||
|
||||
write-host -foregroundColor green "OK - SSH client enabled"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
20
Scripts/enable-ssh-server.ps1
Executable file
20
Scripts/enable-ssh-server.ps1
Executable file
@ -0,0 +1,20 @@
|
||||
<#
|
||||
.SYNTAX enable-ssh-server.ps1
|
||||
.DESCRIPTION enables the SSH server (needs admin rights)
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
#Requires -RunAsAdministrator
|
||||
|
||||
try {
|
||||
Add-WindowsCapability -Online -Name OpenSSH.Server*
|
||||
Start-Service sshd
|
||||
Set-Service -Name sshd -StartupType 'Automatic'
|
||||
|
||||
write-host -foregroundColor green "OK - SSH server enabled"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
@ -1,12 +1,11 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./encrypt-file.ps1 [<path>] [<password>]
|
||||
.DESCRIPTION encrypts the given file
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
.SYNTAX encrypt-file.ps1 [<path>] [<password>]
|
||||
.DESCRIPTION encrypts the given file
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]$Path = "", [string]$Password = "")
|
||||
param($Path = "", $Password = "")
|
||||
|
||||
function EncryptFile {
|
||||
<#
|
||||
@ -149,6 +148,6 @@ try {
|
||||
write-host -foregroundColor green "Done."
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
|
79
Scripts/enter-chat.ps1
Normal file
79
Scripts/enter-chat.ps1
Normal file
@ -0,0 +1,79 @@
|
||||
# make sure you adjust this path
|
||||
# it must point to a network share where you have read and write permissions
|
||||
$ServerShare = "\\myserver\chathome"
|
||||
|
||||
function Enter-Chat
|
||||
{
|
||||
param
|
||||
(
|
||||
[Parameter(Mandatory)]
|
||||
[string]
|
||||
$ChatChannelName,
|
||||
|
||||
[string]
|
||||
$Name = $env:USERNAME,
|
||||
|
||||
[Switch]
|
||||
$ShowOldPosts,
|
||||
|
||||
$HomeShare = $ServerShare
|
||||
|
||||
)
|
||||
|
||||
if ($ShowOldPosts)
|
||||
{
|
||||
$Option = ''
|
||||
}
|
||||
else
|
||||
{
|
||||
$Option = '-Tail 0'
|
||||
}
|
||||
|
||||
$Path = Join-Path -Path $HomeShare -ChildPath "$ChatChannelName.txt"
|
||||
$exists = Test-Path -Path $Path
|
||||
if ($exists -eq $false)
|
||||
{
|
||||
$null = New-Item -Path $Path -Force -ItemType File
|
||||
}
|
||||
|
||||
$process = Start-Process -FilePath powershell -ArgumentList "-noprofile -windowstyle hidden -command Get-COntent -Path '$Path' $Option -Wait | Out-GridView -Title 'Chat: [$ChatChannelName]'" -PassThru
|
||||
|
||||
Write-Host "To exit, enter: quit"
|
||||
"[$Name entered the chat]" | Add-Content -Path $Path
|
||||
do
|
||||
{
|
||||
Write-Host "[$ChatChannelName]: " -ForegroundColor Green -NoNewline
|
||||
$inputText = Read-Host
|
||||
|
||||
$isStopCommand = 'quit','exit','stop','leave' -contains $inputText
|
||||
if ($isStopCommand -eq $false)
|
||||
{
|
||||
"[$Name] $inputText" | Add-Content -Path $Path
|
||||
}
|
||||
|
||||
|
||||
} until ($isStopCommand -eq $true)
|
||||
"[$Name left the chat]" | Add-Content -Path $Path
|
||||
|
||||
$process | Stop-Process
|
||||
}
|
||||
|
||||
|
||||
|
||||
function Get-ChatChannel
|
||||
{
|
||||
param
|
||||
(
|
||||
$HomeShare = $ServerShare
|
||||
|
||||
)
|
||||
|
||||
Get-ChildItem -Path $HomeShare -Filter *.txt -File |
|
||||
ForEach-Object {
|
||||
[PSCustomObject]@{
|
||||
ChannelName = [System.IO.Path]::GetFileNameWithoutExtension($_.Name)
|
||||
LastActive = $_.LastWriteTime
|
||||
Started = $_.CreationTime
|
||||
}
|
||||
}
|
||||
}
|
28
Scripts/fetch-repo.ps1
Executable file
28
Scripts/fetch-repo.ps1
Executable file
@ -0,0 +1,28 @@
|
||||
<#
|
||||
.SYNTAX fetch-repo.ps1 [<repo-dir>]
|
||||
.DESCRIPTION fetches updates for a local Git repository (including submodules)
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($RepoDir = "$PWD")
|
||||
|
||||
try {
|
||||
if (-not(test-path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
|
||||
set-location "$RepoDir"
|
||||
|
||||
$RepoDirName = (get-item "$RepoDir").Name
|
||||
"⏳ Fetching updates for Git repository 📂$RepoDirName ..."
|
||||
|
||||
$Null = (git --version)
|
||||
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||
|
||||
& git fetch --all --recurse-submodules --jobs=4
|
||||
if ($lastExitCode -ne "0") { throw "'git fetch' failed" }
|
||||
|
||||
"✔️ fetched Git repository 📂$RepoDirName"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
@ -1,35 +1,39 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./fetch-repos.ps1 [<parent-dir>]
|
||||
.DESCRIPTION fetches all Git repositories under the current/given directory (including submodules)
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
<#
|
||||
.SYNTAX fetch-repos.ps1 [<parent-dir>]
|
||||
.DESCRIPTION fetches updates for all Git repositories under the current/given directory (including submodules)
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($ParentDir = "$PWD")
|
||||
|
||||
try {
|
||||
$null = $(git --version)
|
||||
} catch {
|
||||
write-error "ERROR: can't execute 'git' - make sure Git is installed and available"
|
||||
exit 1
|
||||
}
|
||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||
|
||||
try {
|
||||
write-progress "Fetching repositories under $ParentDir ..."
|
||||
if (-not(test-path "$ParentDir" -pathType container)) { throw "Can't access directory: $ParentDir" }
|
||||
set-location $ParentDir
|
||||
get-childItem $ParentDir -attributes Directory | foreach-object {
|
||||
set-location $_.FullName
|
||||
|
||||
& git fetch --recurse-submodules
|
||||
if ($lastExitCode -ne "0") { throw "'git fetch --recurse-submodules' failed" }
|
||||
$Null = (git --version)
|
||||
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
|
||||
|
||||
[int]$Count = 0
|
||||
get-childItem $ParentDir -attributes Directory | foreach-object {
|
||||
"⏳ Fetching updates for Git repository 📂$($_.Name) ..."
|
||||
|
||||
set-location "$($_.FullName)"
|
||||
|
||||
& git fetch --all --recurse-submodules --jobs=4
|
||||
if ($lastExitCode -ne "0") { throw "'git fetch' failed" }
|
||||
|
||||
set-location ..
|
||||
$Count++
|
||||
}
|
||||
|
||||
write-host -foregroundColor green "OK - fetched repositories under $ParentDir"
|
||||
$ParentDirName = (get-item "$ParentDir").Name
|
||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||
"✔️ fetched updates for $Count Git repositories at 📂$ParentDirName in $Elapsed sec."
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
|
BIN
Scripts/folder.jpg
Normal file
BIN
Scripts/folder.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.0 KiB |
@ -1,19 +1,13 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./generate-qrcode.ps1 [<text>] [<image-size>]
|
||||
.DESCRIPTION generates a QR code
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
.SYNTAX generate-qrcode.ps1 [<text>] [<image-size>]
|
||||
.DESCRIPTION generates a QR code
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
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)"
|
||||
}
|
||||
if ($Text -eq "") { $Text = read-host "Enter text or URL" }
|
||||
if ($ImageSize -eq "") { $ImageSize = read-host "Enter image size (e.g. 500x500)" }
|
||||
|
||||
try {
|
||||
$ECC = "M" # can be L, M, Q, H
|
||||
@ -33,6 +27,6 @@ try {
|
||||
write-host -foregroundColor green "Done - QR code has been written to $NewFile"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
|
@ -1,15 +0,0 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./go-downloads.ps1
|
||||
.DESCRIPTION go to the user's downloads folder
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
try {
|
||||
set-location $HOME/Downloads/
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./go-home.ps1
|
||||
.DESCRIPTION go to the user's home folder
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
try {
|
||||
set-location $HOME
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./go-music.ps1
|
||||
.DESCRIPTION go to the user's music folder
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
try {
|
||||
set-location $HOME/Music/
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./go-scripts.ps1
|
||||
.DESCRIPTION go to the PowerShell Scripts folder
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
try {
|
||||
set-location $PSScriptRoot
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
@ -1,9 +1,8 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./hibernate.ps1
|
||||
.DESCRIPTION enables hibernate mode for the local computer (requires admin rights)
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
.SYNTAX hibernate.ps1
|
||||
.DESCRIPTION enables hibernate mode for the local computer (needs admin rights)
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
#Requires -RunAsAdministrator
|
||||
@ -13,6 +12,6 @@ try {
|
||||
[System.Windows.Forms.Application]::SetSuspendState("Hibernate", $false, $false);
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./inspect-exe.ps1 [<path-to-exe-file>]
|
||||
.DESCRIPTION prints basic information of the given executable file
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
.SYNTAX inspect-exe.ps1 [<path-to-exe-file>]
|
||||
.DESCRIPTION prints basic information of the given executable file
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param($PathToExe = "")
|
||||
@ -16,6 +15,6 @@ try {
|
||||
get-childitem $PathToExe | % {$_.VersionInfo} | Select *
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
|
19
Scripts/install-google-chrome.ps1
Executable file
19
Scripts/install-google-chrome.ps1
Executable file
@ -0,0 +1,19 @@
|
||||
<#
|
||||
.SYNTAX install-google-chrome.ps1
|
||||
.DESCRIPTION silently installs latest Google Chrome
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
try {
|
||||
$Path = $env:TEMP;
|
||||
$Installer = "chrome_installer.exe"
|
||||
Invoke-WebRequest "http://dl.google.com/chrome/install/latest/chrome_installer.exe" -OutFile $Path\$Installer
|
||||
Start-Process -FilePath $Path\$Installer -Args "/silent /install" -Verb RunAs -Wait
|
||||
Remove-Item $Path\$Installer
|
||||
write-host -foregroundColor green "✔️ installed Google Chrome"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
29
Scripts/introduce-powershell.ps1
Executable file
29
Scripts/introduce-powershell.ps1
Executable file
@ -0,0 +1,29 @@
|
||||
<#
|
||||
.SYNTAX introduce-powershell.ps1
|
||||
.DESCRIPTION introduces PowerShell to new users
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
try {
|
||||
& "$PSScriptRoot/write-big.ps1" "PowerShell"
|
||||
|
||||
& "$PSScriptRoot/write-animated.ps1" "Welcome to PowerShell"
|
||||
& "$PSScriptRoot/write-animated.ps1" "Feel the power of the console and scripting"
|
||||
|
||||
""
|
||||
"* Want to learn PowerShell? See the tutorials at: https://www.guru99.com/powershell-tutorial.html"
|
||||
""
|
||||
"* Need documentation? See the PowerShell docs at: https://docs.microsoft.com/en-us/powershell/"
|
||||
""
|
||||
"* Want sample scripts? See PowerShell Scripts at: https://github.com/fleschutz/PowerShell/"
|
||||
""
|
||||
|
||||
& "$PSScriptRoot/write-typewriter.ps1" "P.S. PowerShell is looking forward to execute your next command"
|
||||
""
|
||||
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Syntax: ./ipfs-publish <dir-tree>
|
||||
# Description: publishes the given directory tree to IPDS
|
||||
# Description: publishes the given directory tree to IPFS
|
||||
# Author: Markus Fleschutz
|
||||
# Source: github.com/fleschutz/PowerShell
|
||||
# License: CC0
|
||||
@ -11,18 +11,15 @@ DIR=$1
|
||||
IPFS_HASHES="IPFS_hash_list.txt"
|
||||
DF_HASHES="checksum_list.xml"
|
||||
|
||||
echo "Publishing directory tree $DIR to IPFS"
|
||||
echo "(1) Removing Thumbs.db in subfolders ..."
|
||||
echo "Publishing folder $DIR to IPFS"
|
||||
echo "(1/3) Removing Thumbs.db in subfolders ..."
|
||||
nice find "$DIR" -name Thumbs.db -exec rm -rf {} \;
|
||||
|
||||
echo "(2) Adding $DIR to IPFS ..."
|
||||
echo "(2/3) Adding $DIR to IPFS ..."
|
||||
nice ipfs add -r "$DIR" > $IPFS_HASHES
|
||||
|
||||
echo "(3) Verifying ..."
|
||||
nice ipfs pin verify
|
||||
|
||||
echo "(4) Calculating digital forensics hashes to $DF_HASHES ..."
|
||||
echo "(3/3) Calculating digital forensics hashes to $DF_HASHES ..."
|
||||
nice hashdeep -c md5,sha1,sha256 -r -d -l -j 1 "$DIR" > $DF_HASHES
|
||||
|
||||
echo "DONE - to publish the content execute: ipfs name publish <HASH>"
|
||||
echo "OK - to publish the content execute: ipfs name publish <HASH>"
|
||||
exit 0
|
||||
|
@ -6,14 +6,19 @@
|
||||
# Source: github.com/fleschutz/PowerShell
|
||||
# License: CC0
|
||||
|
||||
HOSTNAME="`hostname`"
|
||||
ipfs init --profile server
|
||||
|
||||
ipfs config Addresses.API /ip4/0.0.0.0/tcp/5001
|
||||
ipfs config Addresses.Gateway /ip4/0.0.0.0/tcp/8765
|
||||
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://pi:5001", "http://127.0.0.1:5001", "https://webui.ipfs.io"]'
|
||||
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://raspi:5001", "http://127.0.0.1:5001", "https://webui.ipfs.io"]'
|
||||
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "GET", "POST"]'
|
||||
|
||||
echo "NOTE: Make sure port 4001 for IPv4/v6 is open by your router!"
|
||||
ipfs daemon --enable-pubsub-experiment &
|
||||
while true; do
|
||||
ipfs daemon
|
||||
echo "IPFS server has stopped, restarting ..."
|
||||
sleep 1
|
||||
done
|
||||
exit 0
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user