Skip to content

Instantly share code, notes, and snippets.

@Ad5001
Created July 16, 2016 12:47
Show Gist options
  • Save Ad5001/cd7656d0427357b0527bf76aa15a764b to your computer and use it in GitHub Desktop.
Save Ad5001/cd7656d0427357b0527bf76aa15a764b to your computer and use it in GitHub Desktop.
Troll persons on your windows computer witha simple script !
# How to use ? Open the powershell then copy paste this code and press Enter ! You will get infinite notification with an annoying sound xD
# To stop this script, simply stop the "Windows PowersShell" Process !
$t = '[DllImport("user32.dll")] public static extern bool ShowWindow(int handle, int state);'
add-type -name win -member $t -namespace native
[native.win]::ShowWindow(([System.Diagnostics.Process]::GetCurrentProcess() | Get-Process).MainWindowHandle, 0)
while($i -lt 9999) {
$i++
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null
[Windows.UI.Notifications.ToastNotification, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null
[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] | Out-Null
$APP_ID = 'Troll'
$template = @"
<toast launch="app-defined-string">
<visual>
<binding template="ToastText02">
<text id="1">Troll</text>
<text id="2">You just got trolled :p</text>
</binding>
</visual>
</toast>
"@
$xml = New-Object Windows.Data.Xml.Dom.XmlDocument
$xml.LoadXml($template)
$toast = New-Object Windows.UI.Notifications.ToastNotification $xml
[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($APP_ID).Show($toast)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment