PowerShell for Windows Admins

Mar 22 2019   5:11AM GMT

Putting user information into computer description

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

Tags:
Active Directory
Powershell

I was recently asked how to add user information – specifically first and last name – into  computer description in Active Directory.

 

First get your user

$user = Get-ADUser -Identity FredBrown

 

Then add the information to the computer’s description

Set-ADComputer -Identity W10ProIp -Description “Used by $($user.Givenname) $($user.Surname)”

 

You need to use the subexpression – $() – syntax to resolve the values rather than getting references to the $user object.

Then test the description has been set

Get-ADComputer -Identity W10ProIp -Properties  Description

 

if it was me I’d add the samAccountName or other unique identifier as name isn’t sufficient to uniquely identify the user

 Comment on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: