Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2562

Powershell script to set the Computer Description field in AD to the display name - office number of the last person to login to a computer

$
0
0

I would like to create a Powershell script to set the Computer Description field in AD to the display name - office number of the last person to login to a computer. I've taken a couple posted ps scripts and have put this script together, but rather than using the username I would like to use the user's display name + office number:

Get-QADComputer -OSName "Windows 7*" | foreach{

    $name = $_.name

# would like to use display name + office number instead of username

    ((Get-WmiObject Win32_ComputerSystem -ComputerName $name -EA Stop).UserName)
    Set-QADComputer $name -Description

}


Viewing all articles
Browse latest Browse all 2562


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>