Solved

Server Authentication with VBA

Posted on 2011-03-18
7
826 Views
Last Modified: 2012-05-11
Can vba be used to authenticate a machine with a server?
This script will be run after login to an account in windows xp home (startup folder) to
authenticate the machine to a windows server 2003 server. (in a workgroup. not a domain)

this is an example that do the same thing with a batch file.
net use \\192.168.10.200\DataFile /user:myusername mypassword
Is VBA able to do the same thing?

1

I don't need to add a mapped network drive. So I can't use scripts like following
Set oNet = CreateObject("WScript.Network")
oNet.MapNetworkDrive "H:", "\\192.168.10.200\DataFile", True, "MyUsername","MyPassword"


2

I don't want to run a batch file from VBA to authenticate the machine (like the following script).
Dim oShell
Set oShell = WScript.CreateObject ("WScript.Shell")
oShell.run "net use \\192.168.100.220\Public /user:myusername mypassword" , 0, False
Set oShell = Nothing


I need to know if VBA is able to authenticate a PC without adding a mapped network drive.
Any kind of help is much appreciated.


0
Comment
Question by:MnInShdw
7 Comments
 
LVL 21
ID: 35170094
AFAIK you will have to do something that requires you to log in.

There might be some API call that will perform an operation that will cause the authentication process to be required where you can pass the user name and password.  
0
 
LVL 1

Author Comment

by:MnInShdw
ID: 35170481
Sorry, but I don't understand what you mean. some sample codes or a little bit more explanation is much appreciated.
0
 
LVL 1

Accepted Solution

by:
crystal_Tech earned 500 total points
ID: 35180666
User Name and password must be set on the server 2003
Using INET component
In my case its working perfectly

 Dim ThisUrl As String
    ThisUrl = "192.168.10.200"
   
    Inet1.RemoteHost = ThisUrl
    Inet1.AccessType = icDirect
    Inet1.Protocol = icFTP
    Inet1.RemotePort = 21
   
    Inet1.URL = ThisUrl
    Inet1.UserName = "************"
    Inet1.Password = "*************"

0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 1

Author Comment

by:MnInShdw
ID: 35198161
I'm receiving an error on line 4.
Unrecognized Object 'Inet1'
error code: 800A01A8


thank you
0
 
LVL 1

Expert Comment

by:crystal_Tech
ID: 35341605

i dont know about vba but in vb6 inet component you can get from
Projects > Components > Microsoft Internet Transfer Control 6.0
and you can get it

Place this component to your vb form
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 35735832
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question