setting description on a computer account in AD 
Author Message
 setting description on a computer account in AD

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



Mon, 21 Apr 2003 00:56:05 GMT  
 setting description on a computer account in AD

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



Mon, 21 Apr 2003 03:39:53 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. setting description on a computer account in AD

2. Computer Accounts not logged into AD for thirty days

3. Adding a computer account to an AD group

4. AD Error when removing computer accounts via script.

5. setting password to multiple account in AD

6. automatic create user account, computer account in 2000 server

7. write description field AD

8. Checking for Account Lockout property: AD

9. AD Account Mgmt

10. change description in user account

11. User account description

12. How to get computer comment / description?

 

 
Powered by phpBB® Forum Software