0

I'm using Power Shell script to get user.

I have include the Domain name in EnsureUser - Domain\Username

Please check below code.

$AuthorLoginName = "domain\akshay"
try{
[Microsoft.SharePoint.SPUser]$Author = $w.EnsureUser($AuthorLoginName)  }
catch
{}

Please suggest some workaround

2

You need to use i:0#.w|domain\akshay as input.

So try below code:

$AuthorLoginName = "i:0#.w|domain\akshay"
try{
[Microsoft.SharePoint.SPUser]$Author = $w.EnsureUser($AuthorLoginName)  }
catch
{}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.