Finding Email of Logged On User

In an Active Directory environment, PowerShell can easily find the currently logged on user and retrieve AD information about that user, for example, his or her email address:

$searcher = [adsisearcher]"(samaccountname=$env:username)"
$searcher.FindOne().Properties.mail

A logon script could then process this information.

Twitter This Tip! ReTweet this Tip!


Posted Feb 08 2012, 06:00 AM by ps1
Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.