Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - find email address

Reply
 
Old 09-30-2008   #1 (permalink)
AHartman


 
 

find email address

I have a sql table that has employee names but has there full name like

Rice, Jim A.


Is there a way to read AD to get there Smtp email address and update that
Sql table?





My System SpecsSystem Spec
Old 10-01-2008   #2 (permalink)
Jason


 
 

Re: find email address

I get the email address from AD for an email lookup script I use like this:
function send-htmlemail ([string]$GLOBAL:user) {
$user = get-qaduser $user
$usermail = $user.email
....
...
..
}

This way, I can type in the User name or ID and get the email address.

-Jason

"Jacob Saaby Nielsen" wrote:
Quote:

> Hey,
>
> sure you can.
>
> You can choose one of two ways, at least with Quest's AD commandlets.
>
> This is one way of getting the primary e-mail address:
>
> Get-QADObject -SizeLimit 0 | where {$_.Email -ne $null} | select name, email
>
> If you're looking for all the users e-mail addresses (users may have more
> than one registered to them),
> then you can use this:
>
> Get-QADObject -SizeLimit 0 -IncludedProperties ProxyAddresses | where
> {$_.proxyaddresses -ne $null} | select name, proxyaddresses
>
> That, however, returns a whole collection of e-mail addresses per object,
> where SMTP is the primary e-mail
> address, and the smtp ones are the secondary ones.
>
> There's an even faster way of doing it though. But it's a bit quirky
> (haven't had time to find out why, but my
> experience is that it is...)
>
> This is how you get all of the users email addresses via the same cmdlet,
> but using an LDAP query instead:
>
> Get-QADObject -SizeLimit 0 -ldapfilter '(ProxyAddresses=*)' | where
> {$_.EmailAddresses -ne $null} | select name, EmailAddresses
>
> And, if you just need the primary email address:
>
> Get-QADObject -SizeLimit 0 -ldapfilter '(mail=*)' | where {$_.Email -ne
> $null} | Select Name, Email
>
> Whichever you decide to use is fine. They provide the same output (afaik).
> But the LDAP query is faster.
>
> Remember that the Get-QADobject returns ALL types of objects. If you're just
> looking for users, either use
> the -Type parameter (-Type user/group/publicfolder), or use the Get-QADuser
> cmdlet instead
>
> Hope that helped !
>
> Best regards,
> Jacob
> http://www.ijacob.info
>
> Got a PowerShell question ? Go to http://www.powershellcommunity.org !
>
> "AHartman" <Hoosbruin@xxxxxx> wrote in message
> news:qNednWinksl6WX_VnZ2dnUVZ_sednZ2d@xxxxxx
Quote:

> > I have a sql table that has employee names but has there full name like
> >
> > Rice, Jim A.
> >
> >
> > Is there a way to read AD to get there Smtp email address and update that
> > Sql table?
> >
> >
> >
> >
My System SpecsSystem Spec
Old 10-02-2008   #3 (permalink)
Jacob Saaby Nielsen


 
 

Re: find email address

Hello AHartman,

sure you can.

You can choose one of two ways, at least with Quest's AD commandlets.

This is one way of getting the primary e-mail address:

Get-QADObject -SizeLimit 0 | where {$_.Email -ne $null} | select name, email

If you're looking for all the users e-mail addresses (users may have more
than one registered to them),
then you can use this:

Get-QADObject -SizeLimit 0 -IncludedProperties ProxyAddresses | where
{$_.proxyaddresses -ne $null} | select name, proxyaddresses

That, however, returns a whole collection of e-mail addresses per object,
where SMTP is the primary e-mail
address, and the smtp ones are the secondary ones.

There's an even faster way of doing it though. But it's a bit quirky
(haven't had time to find out why, but my
experience is that it is...)

This is how you get all of the users email addresses via the same cmdlet,
but using an LDAP query instead:

Get-QADObject -SizeLimit 0 -ldapfilter '(ProxyAddresses=*)' | where
{$_.EmailAddresses -ne $null} | select name, EmailAddresses

And, if you just need the primary email address:

Get-QADObject -SizeLimit 0 -ldapfilter '(mail=*)' | where {$_.Email -ne
$null} | Select Name, Email

Whichever you decide to use is fine. They provide the same output (afaik).
But the LDAP query is faster.

Remember that the Get-QADobject returns ALL types of objects. If you're just
looking for users, either use
the -Type parameter (-Type user/group/publicfolder), or use the Get-QADuser
cmdlet instead

As for the SQL, I don't do that myself. But there is this:

http://www.sqljunkies.com/WebLog/mar.../28/27237.aspx

Hope that helped !

--
Kind Regards,
Jacob Saaby Nielsen
http://www.ijacob.info

PowerShell trouble ? http://www.powershellcommunity.org
Quote:

> I have a sql table that has employee names but has there full name
> like
>
> Rice, Jim A.
>
> Is there a way to read AD to get there Smtp email address and update
> that Sql table?
>

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Can i migrate/associate http://mynick.spaces.live.com/ web address with my new email address??? Live Messenger
how do i find ip address on email Live Mail
find out an email address for someone Vista mail
Changing old email address to new email address for sending pictur Vista music pictures video


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46