Solved

Adding information to description field of computer objects in Active Directory

Posted on 2013-02-06
7
334 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Backup Solution for AWS

Read about how CloudBerry Backup fully integrates your backups with Amazon S3 and Amazon Glacier to provide military-grade encryption and dramatically cut storage costs on any platform.

 

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Know what services you can and cannot, should and should not combine on your server.
When you try to extract and to view the contents of a Microsoft Update Standalone Package (MSU) for Windows Vista, you cannot extract the files from the MSU. Here we are going to explain how to extract those hotfix details without using any third pa…
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…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

749 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