0

I have a name of an employee For eg: "XYZ". Now i want to get its login name using script. I have tried like this:

$user='XYZ'
$userName=$web.EnsureUser[$user]

But i m getting $userName null

Thanks

1

EnsureUser is a method, and you are using it as an indexer. Change $userName=$web.EnsureUser[$user] to $userName=$web.EnsureUser($user)

0

To get user login user below given command

$user='XYZ'
$userName=$web.EnsureUser($user).UserLogin

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.