You can use the BlockInput API.

Done in Visual Studio 2003
VB Code:
  1. Private Declare Function BlockInput Lib "user32" (ByVal fBlock As Long) As Long
  2.     Private WithEvents timer1 As New Timer
  3.  
  4.     Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  5.         timer1.Interval = 5000
  6.         timer1.Start()
  7.         BlockInput(True)
  8.     End Sub
  9.  
  10.     Private Sub timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles timer1.Tick
  11.         BlockInput(False)
  12.         timer1.Stop()
  13.     End Sub

As far as executing the code remotely, you're on your own. We don't make programs that can be used for exploitation or annoyance.

Besides, if you've done client/server programming before, you should be able to figure this one out on your own.