Quantcast
Channel: SharePoint 2010 - Setup, Upgrade, Administration and Operations forum
Viewing all articles
Browse latest Browse all 13778

Powershell script to get all user email address in Mysite

$
0
0
Hi All,

I have a script to fetch the user ntaccount name. Could you pls help to get their email ID too? PFB script and let me know how to include the email id.


Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

$mysiteUrl=Read-Host “Site URL”
$w = Get-SPWebApplication -Identity $mysiteUrl
$useraccount=Read-Host “domain\account name”
$w.GrantAccessToProcessIdentity(“$useraccount”)

$Webs=Get-SPSite “$mysiteUrl/*” -Limit All|Get-SPWeb -Limit All

$results = @()

ForEach ($Web in $Webs)
{
$webUrl = $web.url 
$docLibs = $web.Lists | Where-Object {$_.baseType -eq “DocumentLibrary”} 
$docLibs | Add-Member -MemberType ScriptProperty -Name WebUrl -Value {$webUrl}

#gets only the Personal and Shared documents count
$results += ($docLibs | Select-Object -Property WebUrl, Title, ItemCount|where-object {$_.Title -eq “Personal Documents” -or $_.Title -eq “Shared Documents”})

#line commented below to avoid getting all document librarires
#$results += ($docLibs | Select-Object -Property WebUrl, Title, ItemCount) 
}
$results |Where-Object {$_}| Export-Csv -Path SPListDocs.csv -NoTypeInformation
Write-Host All content will be written to [Environment]::CurrentDirectory


Thanks,
KS

Viewing all articles
Browse latest Browse all 13778

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>