سؤال

لدي متطلبات عميل للانتقال من الكلاسيكية إلى المطالبات.أنا تستخدم حاليا بعض PowerShell من http://derekmartin.org/archives/701 giveacodicetagpre.

لسوء الحظ في كل مرة أحاول تشغيلها، أحصل على ما يلي

تعبير مهمة غير صالح.يجب أن يكون الجانب الأيسر من مشغل التعيين شيء يمكن تعيينه إلى مثل متغير أو خاصية. في C: \ المستخدمين \ user \ desktop \ lects.ps1: 12 char: 22 +!$ newuserloginname= <<< $ user.loginname.substring (7) + الفئات: Parsererror: (:) []، ParseException + FullQualifiedRORID: 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