Two questions:
The issue I'm running into is w/ several vCenters and several different domains now. The script I use captures the username from events and uses that to search for their e-mail address. Problem now is that some people have multiple accounts on multiple domains, so only one will have a valid email associated.
Since I'm running script under context of one domain, I can no longer simply just parse out the username w/ the get-aduser cmdlet. Soooo, yeah, that's where I'm at. Any thoughts/ideas?
1) +1, but in a new property please. Otherwise a lot of existing scripts will fail :smileydevil:
2) Does this help ?
From the Name and DNSRoot you should be able to compose the full DNS name
Get-ADDomain | Select Name,NetBIOSName,DistinguishedName,DNSRoot
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
1) +1, but in a new property please. Otherwise a lot of existing scripts will fail :smileydevil:
2) Does this help ?
From the Name and DNSRoot you should be able to compose the full DNS name
Get-ADDomain | Select Name,NetBIOSName,DistinguishedName,DNSRoot
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Ahh, yeah. That looks like it will work. I'm able to pass that cmdlet the netbios name and get the domain information I'm looking for. Thanks LucD!
So it would look something like this:
get-aduser -server (get-addomain NETBIOSNAME).infrastructuremaster "usernameinthatdomain"
Not sure if you can do this cross-forest, but you can always do a remote session
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
it appears to work as long as a trust is in place. Luckily for my scenario, there is one, so this'll work as a stop gap for me.