We help IT Professionals succeed at work.

Script to login to Active Directory Domain

114 Views
Last Modified: 2015-11-07
Script to login to Active Directory Domain

I have an application XYZ, it is LDAP aware. I mean users login to the application using their Active Directory domain user name and pasword.

I want to create a domain user account for instance Test, with password never expires, I need to make a script that simulates login to the domain, then schedule the script to run once every other 5 minutes.

Any help will be very much apprecitade.

Thanks
Comment
Watch Question

CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
I guess if I can get to the share, that means I can login

net use \\serverX\share /user:test /password:test
example
net use \\serverX\C$ /user:test /password:test

well , now if it is not successful, I need to make a message Popup Saying " Login to ServerX has failed" if it is successful... I do not need to see the message.
CERTIFIED EXPERT

Commented:
Yes, if you can access the share, then login was successful.

If the connection can not be established with the provided login data, Windows will bring up its own message. Why do you want a different one?

Maybe you can describe a little bit about the purpose you are trying to accomplish. That would maybe help to provide an answer.

Author

Commented:
the computer where the script is going to run and the computer where the Message should be displayed are 2 different computers but in the same Network.

Let's say the script runs on Computer1 to access share on ComputerX if it is not successful then the message should be displayed on computer2 (which is in the NOC)
Small Business IT Consultant
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
This is an example of a Script that I have not tested yet. It could be that the sysntax is wrong.

I am at the console of Computer1 and running this script:

net use \\ComputerX\Sharename /user:test /password:test





 is not successful then  I need the message to be displayed on computerx (which is in the NOC) and not on the computer1 where I am running the script.

Is it clear ?

Thanks
Lionel MMSmall Business IT Consultant
CERTIFIED EXPERT

Commented:
I know of no way to do that. Only thing I can think of is for you to run a scheduled task on computer x and then if net use \\ComputerX\Sharename /user:test /password:test fails to do an errorlevel and to then msg that computerx. You could also put net use \\ComputerX\Sharename /user:test /password:test into a script on computer1 and if it errors out to then msg computerx

Author

Commented:
Ok..Can you provide the correct Syntax, please ?

Author

Commented:
This worked for me in Command prompt
net use X: \\computerx /user:test password
The command completed successfully.

however if I run this :
net use X: /delete
then
net use X: \\computerx /user:test password


I get :
The current directory is invalid.

Author

Commented:
disregard this:
however if I run this :
 net use X: /delete
 then
 net use X: \\computerx /user:test password

Author

Commented:
This is when it is "Successful"
What I need is when it is not successful   to display the message

I guess the script needs to be run through Windows Host Scripting language, so that it will test if the command completed successfuly it will not pop up the message, but if the message is different than "the command completed successfuly" it will pop the message.
Lionel MMSmall Business IT Consultant
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Thanks

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.