#该脚本修改某些显示名,email和活动目录不一致的账户
Add-PSSnapin Microsoft.SharePoint.PowerShell
$ConfirmPreference = 'None' #关闭确认提示
$filePath="c:\file\"
$allUsers=get-content C:\file\user.txt -Encoding UTF8 #从文件中读取需要迁移的账户,每一行包含账户和新的显示名称,新的email地址,字段之间用---隔开
$webApp=get-spwebapplication "http://" #设置需要修改的web application
$allSites= $webApp.sites
foreach ($site in $allSites)
{
"正在查询$site......"
$SiteUsers=Get-SPUser -Web $site.url.ToString()
foreach ($siteUser in $SiteUsers)
{
foreach ($user in $allUsers)
{
$account=($user.tostring() -split "---" )[0]
$newname=($user.tostring() -split "---" )[1]
$NewEmail=($user.tostring() -split "---" )[2]
<#
if (($siteuser.ToString() -split "\|" )[1])
{
$userPrefix=($siteuser.ToString() -split "\|" )[0]
$NewUser=$userprefix+"|"+($user.tostring() -split "---" )[1]
}
else
{
$NewUser=($user.tostring() -split "---" )[1]
}
#>
if ($siteUser.LoginName.tostring().toupper().contains($account.ToUpper())) #判断站点中是否存在该用户
{
“ ***找到账户$user,正在处理中......”
$datetime=get-date
$date=$datetime.ToString('yyyy-MM-dd')
$outInfo=($datetime.ToString() +" "+$site.url.ToString() + " setting displayname "+$newname.tostring() +" To $newuser and Setting Email:$newemail")
Out-File -filePath $filepath$date.TXT -inputobject $outInfo -Append -Encoding UTF8
try
{
set-spuser -Identity $siteUser -web $site.url -DisplayName $newname -Email $NewEmail 2>>$filepath$date.TXT
}
catch
{$error[0].Exception}
}
}
}
“ ”
$site.dispose()
}
sharepoint 2013 修改某些显示名,email和活动目录不一致的账户 powershell
原创pclzr 博主文章分类:sharepoint ©著作权
文章标签 point share 文章分类 SharePoint 服务器
-
MySQL 主从 AUTO_INCREMENT 不一致问题分析
本文介绍了MySQL5.7 中常见的replace into 操作造成的主从auto_increment不一致现象,一旦触发了主从切换,业务的正常插入操作会触发主键冲突的报错提示。
MySQL典型案例 replace into auto_increment -
C++打开NC数据得到与真实值不一致结果的解决方法
本文介绍基于C++语言的netCDF库读取.nc格式的栅格文件时,代码读取到的数据与栅格文件的实际数据不一致的解决方法~
C++ netCDF NC数据 栅格文件 数据读取
















