Get the user of a computer from the computers description in PowerShell

This is a quick script to show you how to get the user of a particular computer from the description field in Active Directory.  This will only work of course if you have filled in the user of the computer in the description field.

To use the script just run it and when prompted enter the users name or part of the users name and the computer should be returned.

Add-Type -AssemblyName Microsoft.VisualBasic

Import-Module ActiveDirectory

$ComputerUser = [Microsoft.VisualBasic.Interaction]::InputBox('Enter Computer users name', 'Users Name')

Get-ADComputer -Filter "Description -like '*$ComputerUser*'"

Leave a Reply

Your email address will not be published. Required fields are marked *