I'm updating custom fields in a document library and I have to set a value for the person that's responsible for the file. On the frontend I put the AD account name in the field but it is stored as a numeric user id. How can I get this id using powershell if I have the AD account name?
$web = Get-SPWeb URLTOWEB $user = $web.EnsureUser("USERLOGINNAME") $id = $user.ID
$id will contain the ID of the user
This is a custom field. We don't know it's behavior. Probably, your field stores
SPUser.Id property value. In this case method
SPWeb.EnsureUser helps you get