I would liek to alter this script to query active directory to get the
department and add it to the Computer description in active directory
along with the username. I am no very skilled yet and could use some
help. HEre is what I have found on the net so far.

Dim adsinfo,nw
Set adsinfo = CreateObject("adsysteminfo")
Set nw = CreateObject("Wscript.Network")

Set ThisComp = GetObject("LDAP://" & adsinfo.ComputerName)
wscript.echo ThisComp.Description
Thiscomp.put "description",nw.username
ThisComp.Setinfo

I would like to make it Department - Username instead of just username.
HElp is appreciated

Re: VBScript to update Computer Description with username and department by Steve

Steve
Thu Jan 27 22:17:54 CST 2005

Edit the script so it looks like this

Dim adsinfo,nw
Set adsinfo = CreateObject("adsysteminfo")

Set ThisComp = GetObject("LDAP://" & adsinfo.ComputerName)
Set oUser = GetObject("LDAP://" & adsinfo.UserName)
wscript.echo ThisComp.Description
Thiscomp.put "description", oUser.department & "-" & adsinfo.UserName
ThisComp.Setinfo


--
Steve Seguis - MCSE, MVP Windows Server, SCJP
SCRIPTMATION
Automating the Enterprise
http://www.scriptmation.com

"Lexxus" <JBDanford2002@yahoo.com> wrote in message
news:1106877277.076420.281070@c13g2000cwb.googlegroups.com...
>I would liek to alter this script to query active directory to get the
> department and add it to the Computer description in active directory
> along with the username. I am no very skilled yet and could use some
> help. HEre is what I have found on the net so far.
>
> Dim adsinfo,nw
> Set adsinfo = CreateObject("adsysteminfo")
> Set nw = CreateObject("Wscript.Network")
>
> Set ThisComp = GetObject("LDAP://" & adsinfo.ComputerName)
> wscript.echo ThisComp.Description
> Thiscomp.put "description",nw.username
> ThisComp.Setinfo
>
> I would like to make it Department - Username instead of just username.
> HElp is appreciated
>



Re: VBScript to update Computer Description with username and department by Lexxus

Lexxus
Fri Jan 28 08:47:13 CST 2005

Thanks Steve that worked out great. This is what I finally came up
with.
Dim adsinfo,nw
Set adsinfo = CreateObject("adsysteminfo")

Set ThisComp = GetObject("LDAP://" & adsinfo.ComputerName)
Set oUser = GetObject("LDAP://" & adsinfo.UserName)
wscript.echo oUser.department & " - " & ouser.description & " " &
oUser.cn & " " & Ouser.telephonenumber
Thiscomp.put "description", oUser.department & " - " &
ouser.description & " " & oUser.cn & " " & Ouser.telephonenumber
ThisComp.Setinfo

The problem with what you gave me was it was writing the path to the
the use from Active Directory.

Although through your post I better understand how to pull the info I
wanted. Do you know of any good books to get for VBScript? or at least
for doing this kind of stuff. What does the Thiscomp. do? Is that a
library of commands?


Re: VBScript to update Computer Description with username and department by Lexxus

Lexxus
Fri Jan 28 09:05:57 CST 2005

Also, Would you know how I could allow users to modify the computer
description in active directory?


Re: VBScript to update Computer Description with username and department by Steve

Steve
Fri Jan 28 17:24:05 CST 2005

Thiscomp essentially holds a reference to the computer object in
ActiveDirectory whereas oUser is a reference to the user object. As far as
books are concerned, I like the "Windows 2000 Scripting Guide" from
Microsoft Press.

--
Steve Seguis - MCSE, MVP Windows Server, SCJP
SCRIPTMATION
Automating the Enterprise
http://www.scriptmation.com


"Lexxus" <JBDanford2002@yahoo.com> wrote in message
news:1106923633.154387.4030@z14g2000cwz.googlegroups.com...
> Thanks Steve that worked out great. This is what I finally came up
> with.
> Dim adsinfo,nw
> Set adsinfo = CreateObject("adsysteminfo")
>
> Set ThisComp = GetObject("LDAP://" & adsinfo.ComputerName)
> Set oUser = GetObject("LDAP://" & adsinfo.UserName)
> wscript.echo oUser.department & " - " & ouser.description & " " &
> oUser.cn & " " & Ouser.telephonenumber
> Thiscomp.put "description", oUser.department & " - " &
> ouser.description & " " & oUser.cn & " " & Ouser.telephonenumber
> ThisComp.Setinfo
>
> The problem with what you gave me was it was writing the path to the
> the use from Active Directory.
>
> Although through your post I better understand how to pull the info I
> wanted. Do you know of any good books to get for VBScript? or at least
> for doing this kind of stuff. What does the Thiscomp. do? Is that a
> library of commands?
>



Re: VBScript to update Computer Description with username and department by Steve

Steve
Fri Jan 28 17:25:38 CST 2005

The only way this can be done is by using ADSIEdit to modify the computer
object permissions in Active Directory to allow them to update whatever
attribute you want to allow them to update. Just do a search for ADSIEDIT
and change permissions and you should find instructions for how to do this.

--
Steve Seguis - MCSE, MVP Windows Server, SCJP
SCRIPTMATION
Automating the Enterprise
http://www.scriptmation.com


"Lexxus" <JBDanford2002@yahoo.com> wrote in message
news:1106924757.067259.249460@c13g2000cwb.googlegroups.com...
> Also, Would you know how I could allow users to modify the computer
> description in active directory?
>