Author: joe

Recover Off-Screen Windows

  • Use ALT-TAB to switch to the off-screen application.
  • Press ALT-SPACE to bring up the system menu (you won’t see it because it is off screen)
  • Press R to select the “Restore” menu choice to ensure the windows isn’t is maximized (you can not move it if it is maximized)
  • Press ALT-SPACE again, then M to select the “Move” menu choice.
  • Press one of the arrow keys to initiate the movement.
  • Now just use the mouse to place the window where you want.

Remotely Enable Remote Desktop

Remote Desktop (aka Terminal Service) is disabled by default in Windows 7.  If you have administrator access to the computers on your domain, you can remotely enable it by doing the following:

Step 1: Open ports in the Windows firewall

There is no native way to change the settings of a remote Windows firewall. However, you can use PsExec from SysInternals to disable it or change some rules.

If you download the app and drop it into your c:\ drive, you can run this command and get command line access for that remote box.

c:\psexec \\remote_machine_name cmd

Once you have that command line open, you can run this command to disable the firewall:

netsh advfirewall set currentprofile state off

Alternatively you can run this command to allow only Remote Desktop while still leaving the rest of the firewall as is:

netsh advfirewall firewall set rule group=”remote desktop” new enable=Yes

Step 2: Start the Remote Registry service

Load up the Services MMC (Control Panel > Administrative Tools > Services), right click on “Services (Local)” and choose “Connect to another computer”. Enter the name of your remote machine and connect to it. You should now be able to find the “Remote Registry” service and start it.

Depending on your environment, this may already be running, but I have found it generally isn’t on fresh computers.

Step 3: Change a registry setting to enable Remote Desktop

It’s time to make use of the Remote Registry and actually enable RDP. Load up regedit and go toFile > Connect Network Registry. Enter the name of your remote computer and connect to it. Navigate to HKEY_LOCAL_MACHINE > System > CurrentControlSet > Control > Terminal Server. Change the value of “fDenyTSConnections” to “0″.

Step 4: Start the Remote Desktop service

Go back to the Services MMC you used in Step 2. Find the service “Remote Desktop Services” and start it (or restart if it is already running).

Simple wait routine in VB.NET

Public Class Form1

  Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
HoldYourpants(2) ‘ wait 2 seconds
HoldYourWater(2) ‘ more efficient code

  End Sub

  Public Sub HoldYourPants(ByVal PauseTime As Integer)
    Dim Start As Double
    Start = Microsoft.VisualBasic.Timer ‘ Set start time.

    Do While Microsoft.VisualBasic.Timer < Start + PauseTime
      Application.DoEvents()
    Loop
  End Sub

  Public Sub HoldYourWater(ByVal Seconds As Integer)
    System.Threading.Thread.Sleep(Seconds * 1000)
  End Sub

End Class

Read MAC Addresses in VB.NET

The following code is a working example for determining the MAC address of your network card.

Imports System.Net.NetworkInformation

Public Class Form1
  Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    MessageBox.Show(getMacAddress)
    End
  End Sub

  Function getMacAddress()
    Dim nics() As NetworkInterface = NetworkInterface.GetAllNetworkInterfaces()
    Return nics(1).GetPhysicalAddress.ToString
  End Function

End Class