Solved

Adding information to description field of computer objects in Active Directory

Posted on 2013-02-06
7
330 Views
Last Modified: 2013-03-16
Hello,

I'm looking for a script that will add information to the description field for a list of servers. If it would work with a servers.txt file that I could put a list of server in that would be ideal or something along those lines. I'm looking to add "Virtual" to our "Servers" OU in the description field to like 800 servers so that we can query against that to find all of our vm's. Thanks!
0
Comment
Question by:jacksonwsa
7 Comments
 
LVL 17

Expert Comment

by:Kent Dyer
ID: 38862569
First, I would start with the ADSI Script-o-matic from Microsoft..

http://technet.microsoft.com/en-us/scriptcenter/dd939958.aspx

This should help you get started..

HTH,

Kent
0
 
LVL 16

Expert Comment

by:choward16980
ID: 38862575
Do you want powershell, vbs or batch file?
0
 
LVL 13

Expert Comment

by:Gabriel Clifton
ID: 38863933
Here is something to start with, I use it as a user login script. .VBS
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")

' get service tag and computer manufacturer
For Each objSMBIOS in objWMI.ExecQuery("Select * from Win32_SystemEnclosure")
serviceTag = replace(objSMBIOS.SerialNumber, ",", ".")
manufacturer = replace(objSMBIOS.Manufacturer, ",", ".")
Next

' get computer model
For Each objComputer in objWMI.ExecQuery("Select * from Win32_ComputerSystem")
model = trim(replace(objComputer.Model, ",", "."))
Next

' get computer object in AD
Set objSysInfo = CreateObject("ADSystemInfo")
Set objComputer = GetObject("LDAP://" & objSysInfo.ComputerName)

' build up description field data and save into computer object
objComputer.Description = WshNetwork.UserName & " - Computer Manufacturer: " & manufacturer & " - Model: " & model & " - Serial Number: " & " " & serviceTag & " " & Now 
objComputer.SetInfo

Open in new window

0
Don't lose your head updating email signatures!

Do your end users still have the wrong email signature? Do email signature updates bore you or fill you with a sense of dread? You can make this a whole lot easier on yourself by trusting an Exclaimer email signature management solution. Over 50 million users do...so should you!

 

Author Comment

by:jacksonwsa
ID: 38866369
Powershell preferably but anything would work. I just need something simple if possible.
0
 

Author Comment

by:jacksonwsa
ID: 38883111
What about this. I found this online and would only need to change it to work against computer objects rather than a user, and a .txt file with a list of servers (get-content) in some form or fashion..

Import-Module ActiveDirectory
 $users = $i = $null
 $users = Get-ADUser -SearchBase "ou=testou,dc=nwtraders,dc=com" -filter * `
  -property description
 ForEach($user in $users)
  {
   if([string]::isNullOrEmpty($user.description))
    {
      "modifying $($user.name)"
      Set-ADUser -Identity $user.distinguishedName -Description "added via script"
      $i++
    }
 }
"modified $i users"
0
 

Accepted Solution

by:
jacksonwsa earned 0 total points
ID: 38976232
This was not resolved
0
 

Author Closing Comment

by:jacksonwsa
ID: 38991470
Not resolved
0

Featured Post

Do email signature updates give you a headache?

Do you feel like you are constantly making changes to email signatures? Are the images not formatting how you want them to? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today.

Join & Write a Comment

Several part series to implement Internet Explorer 11 Enterprise Mode
Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now