Link to home
Start Free TrialLog in
Avatar of jskfan
jskfanFlag for Cyprus

asked on

Script to login to Active Directory Domain

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
SOLUTION
Avatar of Member_2_3654191
Member_2_3654191
Flag of Germany 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
Avatar of jskfan

ASKER

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.
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.
Avatar of jskfan

ASKER

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)
ASKER CERTIFIED SOLUTION
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
Avatar of jskfan

ASKER

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
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
Avatar of jskfan

ASKER

Ok..Can you provide the correct Syntax, please ?
Avatar of jskfan

ASKER

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.
Avatar of jskfan

ASKER

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

ASKER

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.
SOLUTION
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
Avatar of jskfan

ASKER

Thanks