Solved

VBA login script

Posted on 2011-03-18
13
796 Views
Last Modified: 2012-05-11
I'm looking for a vba login script to authenticat a windows xp home to a windows server 2003.
I know that a batch file like bellow will do it. I just want to try a vba script.
---------------------------------
net use \\192.168.10.200\DataFile /user:myusername mypassword
---------------------------------

thank you
0
Comment
Question by:MnInShdw
  • 5
  • 4
  • 4
13 Comments
 
LVL 11

Expert Comment

by:Tasmant
Comment Utility
You can try this:
Set oNet = CreateObject("WScript.Network")
oNet.MapNetworkDrive "H:", "\\192.168.10.200\DataFile", True, "MyUsername","MyPassword"

Open in new window

0
 
LVL 11

Expert Comment

by:Tasmant
Comment Utility
you need to save this to a .vbs file
0
 
LVL 1

Author Comment

by:MnInShdw
Comment Utility
I don't need to map any network drive.
Just authentication with the server. (if possible)

thank you
0
 
LVL 11

Expert Comment

by:Tasmant
Comment Utility
it depends on what you want to do with your code.
not all functions provide a way to authenticate, and most of the time you will use your current credentials (ie the current username and password you entered at logon screen).
based on your current credentials, a negotiation for authentication will be done transparently between your computer and the server (Kerberos or NTLM) in AD domains.
so if you need more help to supply alternate credentials in your script, you need to post some part of your code in order to know what is your need and be able to see if any part of your code can be improved with what you need.
for the moment we cannot help you more.

you should add VB Script zone if you want more experts to see this topic.
0
 
LVL 1

Author Comment

by:MnInShdw
Comment Utility
Here's the situation;

I've been asked to add a windows xp home to a network.
This network contains a windows server 2003 as the server and a lot of windows XPs as clients.
Active Directory (Domain) is not set up. The server is used just as a simple file server.
Each time this windows xp home accesses a shared folder on the server, a login dialog box is poped up which asks for a username and a password.
Because windows xp home hasn't "Remember Password" checkbox, the users of this PC has to input the password and the username to be able to access the shared folder.

I use a batch file that runs from startup to authenticate this machine with the server. In this way the login dialog box won't pop up.
this is the batch file that I use:
---------------------------------
net use \\192.168.10.200\DataFile /user:myusername mypassword
---------------------------------

I was just looking for a vba script to do the same task.
Each time the windows xp home reboots, this vba script will be run and atuthenticate it with the server.


I hope I'm clear enough.

Many Thanks.

0
 
LVL 11

Expert Comment

by:Tasmant
Comment Utility
but you already do the job with your batch, what would you like to change?
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 11

Expert Comment

by:Tasmant
Comment Utility
what do you believe the vba will do much more than a batch ?
0
 
LVL 1

Author Comment

by:MnInShdw
Comment Utility
1- I learn a little bit about vba
2- it's just a test
3- a batch file will bring up cmd for a second, but running a vba script won't bring up(show) any ugly black screen.

 
0
 
LVL 21
Comment Utility
You can hide the "ugly black screen"
0
 
LVL 21

Accepted Solution

by:
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP earned 500 total points
Comment Utility
Oops ... forgot the example:

here is a VBS scriptexampl:

RunHiiden.vbs
CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False

Open in new window

0
 
LVL 21
Comment Utility
IIRC,  set up the name user name and password on with the XP Home and the server. I think this will do automatic authentication.
0
 
LVL 1

Author Closing Comment

by:MnInShdw
Comment Utility
I have no idea what this IIRC is.
Any kind of information about it is much appreciated.

Million thanks for your help.

By the way, as you suggested I added another question in VB section to find out if VB is able to [b]only[/b] do the authentication or not.

you may want to reply there too.
http://www.experts-exchange.com/Programming/Languages/Q_26897561.html

Once again thanks for your time and help.
0
 
LVL 21
Comment Utility
FYI: IIRC = If I Remember Correctly
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Numerous times I have been asked this questions that what is it that makes my machine log on so slow, there have been cases where computers took 23 minute exactly after taking password and getting to the desktop. Interesting thing was the fact th…
Setting up a Microsoft WSUS update system is free relatively speaking if you have hard disk space and processor capacity.   However, WSUS can be a blessing and a curse. For example, there is nothing worse than approving updates and they just have…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

762 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now