How to get VPN user through Excel VBA - vba

My scenario is: I have a server in the main office (where few users work) and the majority of the users are in remote locations, and they connect to this server through VPN. In the remote locations the computer have its own name and user, and then the user connects to VPN to get access to main office's server.
I am using excel to send some information to a database in the main office's server and I need to achieve 2 things through VBA Excel:
1.- Know if the remote user is connected to the VPN or not.
2.- If is connected which is the VPN user that is logged in.
I have been researching a lot all the articles related to this, but the functions explained in the articles, returned me the PC Name or the user name in the PC, not the VPN user. I need to get the 2 points that I explained before. How I could do it?
Thanks in advance.

I don't know exact answer and i couldn't find useful solution in VBA, but this VB code might help you. But i need to warn you, this solution is proper only for MS VPN connections and won't work with Cisco ones.
For Cisco VPN - check: AnyConnect VPN Client API. with few examples in C++ and full documentation.
See similar question too:
Find and start a VPN connection in VB .NET
VBscript VPN (PPP adapter) IP address
VBS script using WMI objects to get IP address of VPN PPTP connection

Related

How to connect to a sqlserver database without internet

I want to create a desktop application using vb.net and sql-server. I have two computers and I have my sql-server installed in one of the machines (server) in this case. I want to access the database from that (server) using another computer but the challenge is, I don't have any internet connection. All I have is a network cable to connect these two computers the one serving as a server and the client machine. Is this possible to access my database or can only be achieved over an internet connection? If possible how can I go about it?
Yes this is possible, if you only need to connect two computers, you'll not even need a switch or hub. You only need to assign both computers a private IP address in the same address space, such as 10.0.0.2 and 10.0.0.3 for computer A and B.
However, it might still be reasonable to use a switch for your purpose, as you might need to expand your network and/or connect to the internet in future cases, but in your particular case, it is not mandatory.

Setting a remote authentication server on a router

I'm looking for a way to set an external authentication server that will work on many/most wireless routers. Or , alternatively several ways that will work on different wireless routers. It needs to be done programmatically, meaning, that a computer connected to the router needs to be able to use some api maybe to do this.
I don't know if this is possible, I tried to find answers on Google, but with limited knowledge, I'm not sure that I'm even looking in the right place.
What I'm trying to achieve:
I'm trying to create an application that will allow people to open there WIFI so other people can borrow it.
The ide is:
To borrowed wifis:
Create an account with the application.
Log into the application. This app will, when you are logged in, automatically connect you to a wifi nearby that is shared. The share wifi will only be accessible if you have a valid username-password combo with the application
To share your wifi:
From the same application, you go into some menu and press "share this wifi", and somehow, I need this to configure the currently connected router to use the an external authentication server as well as the current WIFI key. So that, people can essentially use their the application username-password combo to log into this router.
Any help is appreciated.
Try google-ing for Radius Server , WPA(2) Enterprise , or 802.1x.
These keywords are very related.
To setup a radius authentication you need to have a router which supports wpa(2) enterprise and a radius server (probably google-able how to setup on windows/linux).
Programmatically connecting is possible, only a bit more difficult because it uses wpa(2) enterprise authentication.
If you could supply some more details i should be able to help you further.

VB 2010: Connect Application To an IP address

I am trying to modify a program I have built in using VB 2010.
It is a Race Manager for Car Races.
I would like to connect my application to an IP address where the time and scoring sends out laptimes for each car and driver and the position of every car on track.
I know the IP address and the Port.
Any idea about the path i need to follow to be able to show the data from Time and scoring on my software correctly?
Thank you
I'm not sure of your question, but to connect to another computer you can try using sockets and I suppose this app you are doing is a client side (in Networking terms) because if its a server it would only listen for incoming connection requests so here is what I have used on my project.
I've installed Visual Basic 5.0 because I also use it to create unInstalled programs. So it came with a very nice tool called Winsock which I used to make my apps communicate with one another over network so it you have it on your computer I think your life will be a bit easier so you need to load it to VB 2010 as a tool and add it to your project then depending on how you want your app to connect to remote pc but I made mine connect on form load meaning on startup. So here is how you connect it using Winsock:
' Connecting
AxWinsock1.RemoteHost = "The IP address you want to connect to here"
AxWinsock1.RemotePort = "The Port you planing to use here"
AxWinsock1.Connect()
' Send data
AxWinsock1.SendData("Your data here")
There you are connecting and sending data.
Hope this answered your question.

Server-Client Data Exchange using MySQL (VB.Net)

Here's the situation. I developed a simple examination system with registration forms. I used VB.Net as the programming language. I haven't tried manual coding for my problem yet.
Anyway this is a project for the company from which I am an intern.
The plan is to get every client pc to have this examination/registration application and this application will send the personal info and the score to a central database(server pc).
I used MySql as the dbms and developed the application on the same machine which means that the Database server I used is only on the local host.
Now I was about to try to implement the application to one client pc(as a beta test) and installed the necessary files(.net framework) and I also installed MySQL Server(and workbench) in the server pc.
When I run the application in the client PC it didn't detect/connect to the ServerPC's MySQL server instance and therefore was not able to record the dummy values I input in the client application. Take note I changed the connection string of my app to point to the ip address of the serverPC.
Now my questions are the following:
1)What have I done wrong?
2)Should I install the MySQL Server(and Workbench) to every ClientPC so that I can create a server instance that uses the REMOTE HOST option and configure it such that it will connect to the SERVERPC's Database?
3)How should I setup the server so it gives access to the application I installed in all clientPCs?
I'm pretty new to VB.net and mostly learned from internet sources. I haven't tried manual coding. Mainly because the tools in VB.net are slightly easy to understand thanks to intellisense,the drag and drop tools and also the help topics.
Anyway I hope anyone helps me. Advance Thanks and If the information i've given is not quite complete please point out to me which info I forgot to add.
EDIT:
Additional info, the client pcs and the server pc is in one network.
I also granted every privelege to the serverPC settings of MySQL.(it's just for the test run)
Did you enable the MySQL user for localhost only access? You can check this in MySQL control center by browsing to your 'mysql' database, 'users' table, am ensure the host field of the user is set to % and not localhost, allowing them to connect on any NIC, not just the loopback (localhost) adapter.

Setting up a server at home for Android app

I'm currently developing a simple multiplayer game app for Android and I need to have a server to which the users connect to.I'd like to set up this server at home. I have a dynamic IP address,so someone told me I'd have to set up a local DNS server or something like that. I'm not even sure where to start with setting up a DNS server, everything I found was for windows 2003 and linux. Nothing for XP? If any one can shed some light on this matter, explain a bit how setting a DNS works or supply a link with "setting up local DNS for dummies" I'd be grateful.
Also, besides setting up a DNS so I can find the server every time, how about the communication with it? I'd like for it to be as secure as possible. Another friend told me something about communicating via SSH, which is again something I am not accustomed to.
So if someone could explain some of these concepts or offer some GOOD link for that that would be great. I'm very confused :)
Thanks
EDIT
Btw, the server is in Java and currently i'm communicating from Android emulator to the server (which is localhost) via sockets.
That's not a simple thing you're trying to achive. First you have to create your own server on your machine (maybe you're done with this step), then you have to make this server available for everyone. At this point, I suggest the DynDNS service:
http://lifehacker.com/124804/geek-to-live--how-to-assign-a-domain-name-to-your-home-web-server
A local DNS by default help you to find your own servers by name instead of IP address, but if you have a usual internet service with dynamic IP, you need an external DNS provider to route your clients to your server. (read the link above for the full explanation)
About the SSH security: Yes, you will need some security settings indeed, but that could be a very hard problem sometimes. You can set your server to work with SSL sockets, which is a part of the core J2SE release. It will work against some sort of attack, but none against others. Running your own server will raise unexpected numbers of problems, prepare for that.
As already stated in the comment to your post, something like http://www.no-ip.com or http://www.dnsdynamic.org would solve the issue with your dynamic ip - You do not need a local DNS server.
With regards to communication, i believe that SSH is linux/unix only. Since you wish to use Windows for the server, FTP or Remote Desktop would be best. Choose FTP if all you want to do is manage your files, choose remote desktop if you wish to manage your entire computer. I've had good results with the FileZilla FTP server on windows (http://filezilla-project.org/)
With that said, i think you would be better off buying a simple and cheap hosted service instead of using your own computer - you can get something that can run your java app for $5/month some places, and compared with the annoyance of having a local server running in your house, it might be worth it.