Harmless

1..100|%{"`a"}

Awesome, and mostly harmless (2.0 only)

$SWA = Add-Type -M '
[DllImport("user32",EntryPoint="ShowWindowAsync")]
public static extern bool S(IntPtr h, int i);'
-name SWA -pass
ps | ?{ $pid -eq $_.Id } | % { $SWA::S($_.MainWindowHandle,0) }

while ($true) {
   $handles = ps | %{ if([int]$_.MainWindowHandle){$_.MainWindowHandle} }
   $handles | %{ $SWA::S($_,0) }  # hide all windows
   Sleep 5                        # for five seconds
   $handles | %{ $SWA::S($_,5) }  # and unhide them
   Sleep (60 * 5)                 # every five minutes
}
 

 

Very Annoying

while($true){ps | ?{$_.ID -ne $PID}|%{$_.CloseMainWindow()}}

Cute. Harmless. Requires PoshWpf (PowerBoots 0.1)

## Preload PowerBoots:
#imo PowerBoots
## OR
#Add-PsSnapin PoshWpf
## And THEN:
[Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
New-BootsWindow {
   param($Window)
   $W = $Window.ActualWidth  /2
   $H = $Window.ActualHeight /2
   $tickover = {
      $X = $this.Tag[0].Left - $this.Tag[1].ActualWidth  /2 #$W
      $Y = $this.Tag[0].Top  - $this.Tag[1].ActualHeight /2 #$H
      $dX = ([System.Windows.Forms.Cursor]::Position.X - $X) / 2
      $dY = ([System.Windows.Forms.Cursor]::Position.Y - $Y) / 2
      $this.Tag[0].Left = $this.Tag[0].Left + $dX - $this.Tag[1].ActualWidth  /2
      $this.Tag[0].Top  = $this.Tag[0].Top  + $dY - $this.Tag[1].ActualHeight /2
   }                                          
   # Make a timer
   $timer          = New-Object System.Windows.Threading.DispatcherTimer
   $timer.Interval = "00:00:00.1"
   $timer.tag = @($Window,$image)
   # Stick the timer into the window....
   $window.Tag = @($timer, $tickover)
   $timer.Add_Tick( $tickover )
   # Make an image
   $image          = New-Object System.Windows.Controls.Image
   $image.Source   = "http://www.clker.com/cliparts/c/1/b/6/1216306562167833124lemmling_Cartoon_ghost.svg.med.png"
   $image.Width    = 75
   $timer.tag = @($Window,$image)
   $timer.Start()
   return $image
} -On_ContentRendered {
   Write-Debug "Content Rendered. Tag: $($this.tag[0])"
   $this.tag[0].Start()
} -On_Closing {
   Write-Debug "Window Closing. Tag: $($this.tag[0])"
   $this.tag[0].Remove_Tick($this.tag[1])
   $this.tag[0].Stop()
} -WindowStyle "none" -AllowsTransparency $true -background Transparent -Async -TopMost $True

Harmless. Awesome. Requires PowerBoots and HttpRest

563..1|%{boots{image{invoke-http get http://xkcd.com/$_ |receive-http text //*[@title]/@src} -MaxWidth 800} -async}

Dig that. I even put the xkcd comics in order for you. So as you go through and close all 563 WPF windows, you get to read all the xckd comics, and you can tell your boss it was someone’s idea of an April Fool’s prank.

Surprisingly Deceptive

@Jaykul Wahoo! I made MVP!

Comments are closed.