Tuesday, October 15, 2013

Messing around with my new (free) Surface RT

So I recently received a Surface RT tablet, which was free courtesy of Microsof's slow service.  I have to say that at first I liked the device, then I hated the device, and then I loved the device.  So my experience is a roller coaster.  However, one great thing about this tablet is that it runs a full blown version of Windows.  Before you roll your eyes, it means that I can run a command prompt and write shell scripts on this little gadget.  That is pretty cool for a person like me.

So here are some things that I have done so far:

My Nokia 928 has an app for tethering (TetherX).

Tether-X for WP8 download: http://bit.ly/tether

It works by connecting to a hosted network created on the target pc and then starting a proxy server.  The target pc then uses this proxy server to connect to the internet via the phone.  Clever.

Quick setup video: http://bit.ly/tetheringvideo

However, this requires some rather cumbersome command line foo and internet explorer settings changes to work.  So what I did was to write a couple of batch files on my surface for starting the hosted network, then waiting for the phone to connect (I know my phone's MAC address) and setting IE's proxy settings to the phone's IP automatically.  This way all I have to do is connect my phone, start proxy server on it, and launch IE on my Surface RT.

My second project was to be able to share files via WiFi from the Surface RT to my laptop.  To do this, I again created a hosted network on my RT (even though you cannot do it from the network settings page, netsh works just fine via command line).  I then enabled sharing on my surface and voila!  My laptop can now connect to the network and share files via the shared directories on the Surface RT.

After this process, I am totally sure why Surface RT is not doing well with consumers.  Configuring it is hard and its potential is really only apparent to folks that can handle the command line.  However, for folks like me, this thing is FUN.

Naturally, here are my scripts:

tether.bat
@echo off
netsh wlan set hosted mode=allow ssid=tetherx key=mypasswordgoeshere

netsh wlan start hosted
set IP=null
set MAC=re-mo-ve-d1-23-45
set PORT=8080

REM for /f "tokens=3" %%a in ('reg query HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SharedAccess\Parameters /v ScopeAddress') do set host=%%a
echo | set /p dummy=Waiting for connection
:while
for /f %%a in ('arp -a ^| find "%MAC%"') do set IP=%%a
if %IP%==null (
  echo | set /p dummy=.
  ping 127.0.0.1 > NUL
  goto :while
)
echo !
echo Connected %IP%
ping 127.0.0.1 > NUL

reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /f /v ProxyServer /t REG_SZ /d %IP%:%PORT%
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /f /v MigrateProxy /t REG_DWORD /d 0x1
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /f /v ProxyHttp1.1 /t REG_DWORD /d 0x0
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /f /v ProxyEnable /t REG_DWORD /d 0x1
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /f /v ProxyOverride /t REG_SZ /d "<local>"


tetherx_off.bat
@echo off
netsh wlan stop hosted
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /f /v ProxyEnable /t REG_DWORD /d 0x0


hosted.bat
@echo off
netsh wlan set hosted mode=allow ssid=MYSSID key=mypasswordgoeshere
netsh wlan start hosted


hostedstop.bat
@echo off
netsh wlan stop hosted

2 comments:

  1. It is good concept but seems very complicated for the non tech peoples to perform.

    Thanks
    Silvester Norman

    Changing MAC Address

    ReplyDelete
    Replies
    1. Well, I think TetherX is the only tethering app for WP8 so I know of no other way of doing it and avoid the ridiculous $20+ dollar charge Verizon wants for a tethering plan.

      Delete