I've got an user A who is connected to a Workgroup. From this Workgroup, now, I want to connect, with the console, to the user "john" who belongs to an active directory (MYAD)
Though I try :
runas /netonly /user:john\MYAD cmd.exe
It works... But the env. variable USERDOMAIN still gives me the name of the workgroup (And of course the USERNAME is not good too, USERDNSDOMAIN is missing)
I'm a little unclear what you're asking for here. If you're looking to join a domain with another user's security context the
netdom.exe
tool (installed on Windows Server but will work on Windows 7), with the/UserD
and/PasswordD
arguments will allow you to provide a credential for the domain join.The behavior you're seeing with the
/netonly
argument onrunas
, with respect to the environment, is by-design. That argument allows you to control the credential used when making connections to remote machines, but doesn't make any kind of material change to the local user's security token, profile, environment, etc.