Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to use command-line commands to log in a domain?

Posted on 2009-06-30
8
Medium Priority
?
2,284 Views
Last Modified: 2012-06-27
I have some users in Sales department visiting several different sister companies in our group. Each sister company has their own domain. When they visit, they want to use the local resources such as printers, scanners, network drivers, etc. I want to know if there is a way of loging to a domain by using command-line commands so I can plug them in the login script. With this, they will be able to login to the local domain whichever company they visit.
Thanks.
0
Comment
Question by:Castlewood
[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
  • 3
  • 3
  • 2
8 Comments
 
LVL 6

Expert Comment

by:brasslan
ID: 24747918
net use t: \\server\common /user:chris 12345

That will map the local T: drive to the common share on the server using the username chris and password 12345

You can also change the username to the format "domain\user"  eg microsoft\bill will use the username bill on the Windows domain microsoft.

If you just simply want to login to a server, but not map a drive, then just leave out the drive letter and that will process the initial login.
0
 
LVL 71

Expert Comment

by:Qlemo
ID: 24748105
I don't think the above mentioned approach will suffice, as you need to use the same server name and at least one common share in all domains, and it does not allow for usage of domain resources, only for that single server.

If you make sure the local account is replicated into all domains (including the same password), you shouldn't have any problems browsing the local domain and using its resources. The laptop users will stay local, but whenever they access the domain, they will do with the domain account with same name.

It could be necessary to have the laptop be part of the local domain - that would be difficult, as you can only have ONE domain membership.

(I assumed those users are accessing domain resources with their own laptop on travelling.)
0
 

Author Comment

by:Castlewood
ID: 24749597
Qlemo, the domains are not under the same tree so there is no replication between. You are correct that those users are accessing domain resources with their own laptop on travelling. When they turn power on and login to their own laptops it is their "home" domain they log into using the user's profile. I think the question is more like: can they log in to multiple domains? If yes, how and what commands to use in user's login script?  

We currently use "net use". It seems cumbersome since there are so many resources to share. If they can log into the local domain by a command, it will be really awesome.

Can Net Use be used to share for an entire domain's resources, instead of just per server? If not, Net Use is not sufficient, since it is the command we currently use.
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 71

Expert Comment

by:Qlemo
ID: 24749694
Net use can't do that. It authorizes against a single server only, not the domain.

With "replication" I ment a manual way of duplicating related accounts to all domains. Which makes only sense if you have no account changes (including passwords), or a connection between all domains (at least at a single point of access).

You cannot be member of more than one domain at any time. You can change the logon domain, but I do not know (as I never tried) if that is really feasible with changing domains. The reg key for login domain is
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ WindowsNT\CurrentVersion\Winlogon\DefaultDomain
You can try to change that and if it would work. The laptop will have to be member of the domain, I reckon. This is something you have to do once for each laptop in each domain.

0
 
LVL 6

Expert Comment

by:brasslan
ID: 24749841
I agree with Qlemo that you can only join one domain.  And since these domains are separate and not under the same tree, there is no way to log in to multiple domains.

If I had this problem, I would have setup a more complicated login script that would detect which network I'm on, then run the appropriate login commands to login to the individual servers that had the needed network resources.

But I didn't know that you could replicate local user accounts across a domain like Qlemo suggested.  If that isn't too hard, then it might prove to be a better solution.
0
 
LVL 6

Accepted Solution

by:
brasslan earned 1000 total points
ID: 24749883
Oops, I was really slow in posting my last post and didn't see Qlemo's last note...

You can't change your registry to login to another domain.  You need more than a user account to login from a windows computer, you also need a computer account listed in the active directory on the domain as well.  As you know, after deleting a computer from Active Directory Users and Computers, no one can login to the domain from that PC anymore.
0
 

Author Comment

by:Castlewood
ID: 24750358
Wait, does a computer need to join the domain before the user using this computer can login to this domain ??
0
 
LVL 71

Assisted Solution

by:Qlemo
Qlemo earned 1000 total points
ID: 24752814
Only on a member computer you can login in using the domain account. However, if the domain account and the local account are the same (and using the same password), it should work, but it could also be necessary to login on each server providing the domain user.

We use that kind of login on most workstations (local login, domain login data = local login data), and for access between the workstations you have to give explicit domain login (sometimes).
0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Loops Section Overview

610 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