Open to all suggestions…that might indeed be better. I was disappointed to find 
I couldn’t use something like dsquery…

From: [email protected] [mailto:[email protected]] On 
Behalf Of Stephen Gestwicki
Sent: 27 June 2016 17:12
To: [email protected]
Subject: RE: [NTSysADM] RE: PowerShell weaknesses

Why don’t you use ADSI instead of installing RSAT on everyone’s computers?
http://stackoverflow.com/questions/10184052/get-a-users-email-address-from-the-username-via-powershell-and-wmi

- Stephen

From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]] On Behalf Of James Rankin
Sent: Monday, June 27, 2016 11:58 AM
To: [email protected]<mailto:[email protected]>
Subject: RE: [NTSysADM] RE: PowerShell weaknesses

Actually might be worth extending this debate slightly…

I’m trying to build Outlook signature files on the fly using AD attributes. So 
I basically need to grab certain AD attributes and set them as variables. This 
is not a problem.

However, as I am doing this at user first logon, I need to query the AD 
attributes in the context of the user. Get-ADUser is the cmdlet I’m using, but 
this is unavailable on my Windows 10 clients unless I install the RSAT. So…

Is there a way to programmatically install the RSAT feature on Windows 10 with 
the AD PowerShell stuff enabled? I’d rather not have to go back and create a 
new image.

I found Enable-WindowsOptionalFeature but don’t seem to be able to crack the 
right syntax for it…

Cheers,



JR

From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]] On Behalf Of Charles F Sullivan
Sent: 27 June 2016 16:29
To: [email protected]<mailto:[email protected]>
Subject: RE: [NTSysADM] RE: PowerShell weaknesses

I was going to suggest:

Get-ADUser -identity jrankin -Properties mail

That will get you the defaults plus Mail.
I mention this because I find it easier to remember, though of course it’s a 
matter of preference.


From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]<mailto:[email protected]>] 
On Behalf Of James Rankin
Sent: Monday, June 27, 2016 10:41 AM
To: [email protected]<mailto:[email protected]>
Subject: [NTSysADM] RE: PowerShell weaknesses

Doh!

Put it in brackets would be the thing I’m missing

(Get-ADUser -filter jrankin -Properties mail).mail

Never mind…. ☺


From: James Rankin
Sent: 27 June 2016 15:39
To: '[email protected]<mailto:[email protected]>' 
<[email protected]<mailto:[email protected]>>
Subject: PowerShell weaknesses

How can I used Get-ADUser to query a single attribute for a specific user? If I 
use something like

Get-ADUser -filter jrankin -Properties mail

To query the email address in AD, I don’t just get that attribute returned, I 
get a bunch of default stuff too…

DistinguishedName : CN=James Rankin,OU=Desktop1,OU=Standard Users,OU=User 
Accounts,DC=JRR,DC=test,DC=local
Enabled           : True
GivenName         : James
mail              : [email protected]<mailto:[email protected]>
Name              : James Rankin
ObjectClass       : user
ObjectGUID        : 694d15e1-d550-483a-8f21-cb7415f05342
SamAccountName    : jrankin
SID               : S-1-5-21-2950944927-1203068717-1704750700-1114
Surname           : Rankin
UserPrincipalName : [email protected]<mailto:[email protected]>

Am I missing something blatantly obvious here?

Cheers,


James Rankin
EUC Solutions Architect | 07809 668579 | [email protected]<mailto:[email protected]>
One Trinity Green, Eldon Street, South Shields, Tyne & Wear, NE33 1SA
Tel: 0191 481 3446

Reply via email to