Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$count
#$farm = Get-SPFarm
$siteList = Get-SPSite -Limit 1
$serviceContext = Get-SPServiceContext($siteList[0])
$profileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($servicecontext)
$profiles = $profileManager.GetEnumerator()
foreach ($hi in $profiles) {
if([string]::IsNullOrEmpty($hi["AboutMe"].Value) -eq $false){
write-host "Acount Name:"$hi.AccountName"|AboutMe:"$hi["AboutMe"].Value
$count++
}
}
write-host $count
此代码不起作用,因为我不知道如何将C#的顶部转换为powershell
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$count
$siteList = Get-SPSite -Limit 1
$serviceContext = Get-SPServiceContext($siteList[0])
$profileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($serviceContext)
$profiles = $profileManager.GetEnumerator()
foreach ($profile in $profiles) {
if([string]::IsNullOrEmpty($profile["AboutMe"].Value) -eq $false){
write-host "Acount Name:"$profile.AccountName"|AboutMe:"$profile["AboutMe"].Value
$count++
}
}
write-host $count