Link to home
Start Free TrialLog in
Avatar of jdhackett
jdhackettFlag for Ireland

asked on

Advice on writing a logon program

I need to write a program that will launch when a user logs in to their pc. The basic functionality will be to connect the user to the appropiate terminal server. I will be reading the server name from ADP, for that user. Then using the mstsc command with the appropiate server name in the parameters. I have the VB2005 code for all that.
Now, I know the code I need to write. I'm just wondering the best way to do it.
As far as I know, I'll have to run an install program on each pc. There is no way to make an exe?
So, I'd like to make the program as small as possible. Is a Console project smaller that the standard windows project?
Or is there a better way I'm not thinking of?
Keep in mind I wish to stick with VB.net - I don't want to know that there is a better solution in C# or something. :)

Thanks


Avatar of RobSampson
RobSampson
Flag of Australia image

Hi, if you've got the VB2005 code for doing this, can't you just create an Executable file from the IDE?

If it's just one form, it should be very small, and not have an impact on your login time....

Regards,

Rob.
Avatar of jdhackett

ASKER

How do I create an executable file? I thought you had to do the whole publish/install thing?
ASKER CERTIFIED SOLUTION
Avatar of RobSampson
RobSampson
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi, did my suggestion help you to build an EXE for your application?

Regards,

Rob.
Yep, it did.
However, there is one more problem.
My program starts like this:
Dim stUserName As String = SplitString(My.User.Name)
Which breaks the name part out, and from there I get the info from active directory. The exe works fine on the local drive of any pc. However, if I put it on the server, which is mapped as the V drive, I get
an 'Index out of bounds' message. I changed the exe to msgbox My.User.Name and it returns an empty string when run on any network drive. That is, it works fine if the exe if on the pc, but not I put it on any mapped drive.
Any idea why this would happen?

Just to update on this. I now My functions don't work in console apps. Even though I have a from in this case, I decided to use try using
Dim stUserName As String = System.Environment.UserName
instead, but now I get permssions error later in the code:
Request for the permission of type 'System.DirectoryServices.DirectoryServicesPermission, System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' failed.

Again, this only happens if exe is run from network drive.
I don't know much about .NET I'm afraid. I would suggest you would be off posting a new question for this new error....maybe some more familiar experts can help....

I did find this, but I'm not sure it will help "across the board"....
http://geekswithblogs.net/timh/archive/2006/03/08/71714.aspx

Regards,

Rob.
Thanks. Since that linked solution means configuring .Net on each pc, I'll just set the script to copy the Exe to the C drive. Probably best way to go anyway.