cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to get a MEGA user windows domain

agiovannetti
Super Contributor

This code:

aUser.GetProp("Windows Login")

 returns a Windows Login of a MEGA user but, how can I get his domain? 

Thanks

3 Replies

Hello agiovannetti,

The only data stored in MEGA from the directory is the SID. You can retrieve this data with the MetaAttribute : ~BjVrTrj()W00[Identifiant Windows]

A simple getprop will return the windows login:

print GetObjectFromId("~u2X)RulTHrMN[User]").GetProp("~BjVrTrj()W00[Identifiant Windows]")

-> BPT

If you ask for the "Physical" value you will get the SID:

GetObjectFromId("~u2X)RulTHrMN[User]").GetProp("~BjVrTrj()W00[Identifiant Windows]", "Physical")

-> S-1-5-21-1977685876-263807513-471813405-4398

These are the only data officialy available with MEGA API. But you can try to get more data from the SID with Windows API:


strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set objAccount = objWMIService.Get _
("Win32_SID.SID='" & GetObjectFromId("~u2X)RulTHrMN[User]").GetProp("~BjVrTrj()W00[Identifiant Windows]", "Physical") & "'")
print objAccount.AccountName
print objAccount.ReferencedDomainName

-> BPT
-> NTAS

Hello Jerome,

in which attribute MegaUser stores identifier of active directory ?

 

jhorber
MEGA
MEGA

Hello agiovanetti

 

In MEGA a technical identifier of active directory (ex: "S-1-5-21-1977685876-266805523-491813205-1144") is stored on the user object. However it does not enable to read clearly the Windows domain (ex: domain01).

As far as I know, there is not API script provided by MEGA to do this.

 

I recommend you look in languages for standard API function to convert this ID into a human readble value

See  for example: http://serverfault.com/questions/405940/how-do-i-get-the-active-directory-user-id

Jerome