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:


But i m getting $userName null



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


To get user login user below given command


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.