質問

私は古典的なクレームからクレームへ移動するためのクライアント要件を持っています。私は現在、 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 \ arfors.ps1:12 char:22 +!$ NEWUSERLOGINNAME= <<<< $ user.loginname.substring(7) + CategoryInfo:ParserError :( :) []、parseException + FullQualifiedErrorID: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