Add enable-god-mode.ps1

This commit is contained in:
Markus Fleschutz 2021-03-22 18:37:33 +01:00
parent 690c28a4e9
commit 5af77ba065
3 changed files with 26 additions and 0 deletions

View File

@ -33,6 +33,7 @@ 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
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)
encrypt-file.ps1, encrypts the given file
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)

1 Script Description
33 display-time.ps1 displays the current time for 10 seconds by default
34 download.ps1 downloads the file/directory from the given URL
35 enable-crash-dumps.ps1 enables the writing of crash dumps
36 enable-god-mode.ps1 enables the god mode (adds a new icon to the desktop)
37 encrypt-file.ps1 encrypts the given file
38 fetch-repo.ps1 fetches updates for the current/given Git repository (including submodules)
39 fetch-repos.ps1 fetches updates for all Git repositories under the current/given directory (including submodules)

View File

@ -64,6 +64,7 @@ Collection of PowerShell Scripts
* [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

24
Scripts/enable-god-mode.ps1 Executable file
View File

@ -0,0 +1,24 @@
#!/bin/powershell
<#
.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
#>
#Requires -RunAsAdministrator
try {
$godmodeSplat = @{
Path = "$env:USERPROFILEDesktop"
Name = "GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}"
ItemType = 'Directory'
}
new-item @godmodeSplat
write-host -foregroundColor green "OK - see the new desktop icon"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}