You want to connect your Windows 7 phone with your Cisco VPN. Maybe you want to sync our Mail with a server that lies on the other side of a firewalll. maybe you want to access a local web server. There is no Cisco Software I know of, that will connect your Windows phone directly via VPN, but you can use the shared network and wireless hostednetwork features from Windows 7.
Here is how you do it:
1. follow the instructions here:
then copy the code below into a .vbs file and run it. You probably have to rename your connections in con and con2.
'this script: runs itself with elvated rights; starts the internet connection sharing feature of windows with the two configured networks (public and VPN)
' to allow your WINDOWS 7 PHONE to finally enter your cisco vpn
'Originally from http://www.autoitscript.com/forum/topic/28897-switch-ics/
'Changed to VBS, added arguments and fixed for private/public networkds by Dror Gluska 2012-06-25
'Dror Gluska (2012) - http://uhurumkate.blogspot.co.il/
'http://www.winhelponline.com/articles/185/1/VBScripts-and-UAC-elevation.html
option explicit
dim con
dim con2
dim objShell
con="Cisco AnyConnect VPN Client Connection"
con2="Drahtlosnetzwerkverbindung 2"
Set objShell = CreateObject("Shell.Application")
dim wsh
set wsh = WScript.CreateObject("WScript.shell")
If WScript.Arguments.length =0 Then
'Pass a bogus argument with leading blank space, say [ uac]
objShell.ShellExecute "wscript.exe", Chr(34) & _
WScript.ScriptFullName & Chr(34) & " uac", "", "runas", 1
Else
'reset internet sharing to allow cisco vpn to connect, needed if the last attempt failed
wsh.run "cmd /c netsh wlan stop hostednetwork"
EnableDisableICS con,con2, false
'connect with anyconnect now
objShell.ShellExecute "C:\Program Files (x86)\Cisco\Cisco AnyConnect VPN Client\vpnui.exe"
wsh.run "cmd /c netsh wlan start hostednetwork"
MsgBox "Click AFTER VPN was established"
'now enable internet sharing
EnableDisableICS con,con2, true
dim i
dim e
For i=1 To 100
e=InputBox("write 'exit' to disable internet sharing")
If e="exit" Then Exit For
Next
'cleanup
EnableDisableICS con,con2, false
wsh.run "cmd /c netsh wlan stop hostednetwork"
End If
function EnableDisableICS(sPublicConnectionName, sPrivateConnectionName, bEnable)
dim bFound
bFound = FALSE
dim oNetSharingManager, oConnectionCollection, oItem, EveryConnection, objNCProps
set oNetSharingManager = Wscript.CreateObject("HNetCfg.HNetShare.1")
if (IsObject(oNetSharingManager)) = FALSE then
Wscript.Echo("Unable to get the HNetCfg.HnetShare.1 object.")
Exit function
End if
if (IsNull(oNetSharingManager.SharingInstalled) = TRUE) then
Wscript.Echo( "Sharing is not available on this platform.")
Exit function
End if
set oConnectionCollection = oNetSharingManager.EnumEveryConnection
for each oItem In oConnectionCollection
set EveryConnection = oNetSharingManager.INetSharingConfigurationForINetConnection (oItem)
set objNCProps = oNetSharingManager.NetConnectionProps (oItem)
If objNCProps.name = sPrivateConnectionName Then
bFound = True
'Wscript.Echo("Setting ICS Private to " & bEnable & " on connection: " & objNCProps.name)
If bEnable Then
EveryConnection.EnableSharing (1)
Else
EveryConnection.DisableSharing
End if
End if
Next
set oConnectionCollection = oNetSharingManager.EnumEveryConnection
for each oItem In oConnectionCollection
set EveryConnection = oNetSharingManager.INetSharingConfigurationForINetConnection (oItem)
set objNCProps = oNetSharingManager.NetConnectionProps (oItem)
If objNCProps.name = sPublicConnectionName Then
bFound = True
'Wscript.Echo("Setting ICS Public to " & bEnable & " on connection: " & objNCProps.name)
If bEnable Then
EveryConnection.EnableSharing (0)
Else
EveryConnection.DisableSharing
End if
End if
next
If Not bFound Then
Wscript.Echo("Unable to find the connection " & sPublicConnectionName)
End if
end function