setting description on a computer account in AD

setting description on a computer account in AD

Post by Brent Groom » Fri, 03 Nov 2000 01:56:05



Does anyone know how to set the description on a computer account in active
directory?  I can bind to the AD alright but if I try to change the
description I get some error that says that the command violates the schema
rules.  If anyone has done this and has sample code that would be great.

Thanks,

Brent Grooms

 
 
 

setting description on a computer account in AD

Post by John Armstrong OSIRI » Fri, 03 Nov 2000 04:39:53


Try using some of this.  It works in NT Server 4.0


<%

' Phase one--Setup

Dim username ' login name
Dim fullname ' full name
Dim descript ' Description
Dim Password ' Password

Dim ComputerObj ' Computer Object
Dim NewUser  ' user object

On Error Resume Next

Username = "username"
Fullname = "fullname"
Descript = "This is a test user's description"
Password = "password"

%>

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE>Add User</TITLE>
</HEAD>

<BODY BGcolor=#FFFFFF>

<%
' Get object for computer
Set ComputerObj = GetObject("WinNT://your DOMAIN here")
If Err Then adsiErr()

%>

Create New User on <%= ComputerObj.Name %>

<%

'Phase 2--Create the new user

Set NewUser = ComputerObj.Create("User", UserName)
NewUser.SetInfo
if err then adsiErr()
Response.Write "Creating User:<B> " & NewUser.Name & "</B>...<BR>"

' Phase 3
' Set Password

NewUser.SetPassword(Password)
Response.Write "Setting Password ... <BR>"
NewUser.SetInfo

' Set Fullname

NewUser.Fullname = FullName
Response.Write "Setting Full Name ... <BR>"
NewUser.SetInfo

' Set Description

NewUser.Description = Descript
Response.Write "Setting Description ...<BR>"
NewUser.SetInfo

Response.Write "Done!!! <BR>"
%>

<P>&nbsp;</P>

</BODY>
</HTML>

John

Quote:> Does anyone know how to set the description on a computer account in
active
> directory?  I can bind to the AD alright but if I try to change the
> description I get some error that says that the command violates the
schema
> rules.  If anyone has done this and has sample code that would be great.

> Thanks,

> Brent Grooms


 
 
 

1. Computer description in ADS?

Hi,
I need your help again.
I'm trying to uniform descriptions  for all users & computers in my domain
using ads.
For example: I wanted to set descriptions for most computers (what user they
belong to, department, room & phone nr).
Some computer accounts in my domain have such comments (made in process of
account creation), visible in file explorer.
But after I made such script for updating computer object property
'description', I found that this property is not visible in file explorer.
Then I tried to find some ads property for computer object (available via
LDAP), reflecting these comments... and did not find.
The only one way I was able to get this computer property was using old
....
Set objComp=GetObject("WinNT://" & domainName & "/" & CompName)
objComp.GetInfo
qq=objComp.FullName
....
To make matters worse, this property is available only for computers, having
it already set.

So, the question is:
how can I update computer descriptions (to be precise - comments, or winnt
.FullName) for all my domain computers?

Thanks in advance,
Vincas

2. left masterpage contains no templates of any sort

3. Create computer accounts in AD

4. infared ipaq

5. Help Creating AD Computer account for NT 4.0 Machines

6. Bitmaps in paperspace???

7. Create prestaged computer accounts in AD

8. Future of Easy C++

9. Computer Account keeps disappearing in A.D.

10. Removing Object setting. LockoutTime on AD account.

11. Set user account info in AD with vbscript (Let users do it self)

12. ADSI - Re-adding computer into AD while keeping computer contianer and property info :x595

13. how can I sync Windows AD Network accounts with Unix accounts?