문제

나는 클래식에서 클래식으로 이동하는 것이 클라이언트 요구 사항이 있습니다.현재 http://derekmartin.org/archives/701 에서 현재 일부 PowerShell을 활용하고 있습니다.

$webApp =
$farm = get-SPFarm
$wa = get-SPWebApplication $webApp
$site = get-SPSite $webApp
$web = $site.OpenWeb()
foreach ($user in $web.AllUsers) {
   $newuser = $user
   $newuserLoginName = “”
   write-host($user.LoginName)
   if ($newuser.LoginName.StartsWith(“i:0#.w|”))
   {
      ! $newuserLoginName = $user.LoginName.Substring(7)
   }
   $user = $newuser
   $farm.MigrateUserAccount($user.LoginName, $newuserLoginName, $false)
}
.

불행히도 실행하려고 할 때마다 다음을받습니다

잘못된 할당 표현식.과제 운영자의 왼쪽면은 할당 할 수있는 것일 필요가 있습니다. 변수 또는 속성을 좋아합니다. C : \ Users \ User \ Desktop \ Claims.ps1 : 12 char : 22 +!$ newuserloginname= <<<< $ user.loginname.substring (7) + CategoryInfo : parserError : (:) [], ParseException + FlyQualifiedErrid : InvalidLeFthandside

무엇이 잘못 될 수 있는지에 대한 아이디어?

감사합니다!

죄송합니다. 원래에 스크립트를 해결하십시오!

도움이 되었습니까?

해결책

I may be wrong but I suppose that the exclamation mark on the

!$newuserLoginName = $user.LoginName.Substring(7)

line should just be a refuse (or at last it doesn't match any syntax I am aware of).

If you are on a test environment or are otherwise sure that you won't damage your system with a wrong comand, I would try to replace the if with:

if ($newuser.LoginName.StartsWith(“i:0#.w|”))
{
   $newuserLoginName = $user.LoginName.Substring(7)
}

The if should simply remove the "claim specific part" from the login name, so I would assume the original blog post intended it this way.

That said, know that I have never done this before and are only trying to spot an error in the powershell code. I don't know if that code will actually do what promised, so use that at your risk (or wait some more expert other user to confirm the behaviour).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top