Solved

VBA login script

Posted on 2011-03-18
13
800 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 4
13 Comments
 
LVL 11

Expert Comment

by:Tasmant
ID: 35166766
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
ID: 35166771
you need to save this to a .vbs file
0
 
LVL 1

Author Comment

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

thank you
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
LVL 11

Expert Comment

by:Tasmant
ID: 35166955
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
ID: 35167124
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
ID: 35167155
but you already do the job with your batch, what would you like to change?
0
 
LVL 11

Expert Comment

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

Author Comment

by:MnInShdw
ID: 35167194
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
ID: 35167973
You can hide the "ugly black screen"
0
 
LVL 21

Accepted Solution

by:
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP earned 500 total points
ID: 35167987
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
ID: 35168011
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
ID: 35169949
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
ID: 35169976
FYI: IIRC = If I Remember Correctly
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Screen Mirroring 7 89
Questions about DHCP migration 5 104
Hyper-V won't start Server 2003 as a guest OS 7 100
Adding 2008 R2 server to 2003 domain:  2003 DC to 2008 R2 DC 6 28
The HP utility "HP Lights-Out Online Configuration Utility for Windows Server 2003/2008" could be of great use when it comes to remotely configure a HP servers ILO WITHOUT rebooting the server. We would only need to create and run scripts using thi…
Learn about cloud computing and its benefits for small business owners.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

749 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