script edit description filed in AD (Full Version)

All Forums >> [Scripting Technologies] >> General Scripting



Message


jtralala -> script edit description filed in AD (5/16/2008 7:18:12 AM)

Hi All
I am pretty new with vb scripting and I am not able to create following script I hope someone can help me with that
What I need is a script that changes the description field in AD with following information
Username and officename
I have a txt file with this information see below
Computername:Username:officename
Computername1:U34567:Finance
Computername123:U89045:IT
So what the script needs to do is edit the description filed in AD with that information
For Computername1 description must be U34567 Finance
For Computername2 description must be U89045 IT
etc
I hope someone can help me with this script

THX in advance
J




gkamenjati -> RE: script edit description filed in AD (5/16/2008 2:19:33 PM)

Here the script that i use (our needs is to see who logged on when, we also have when logged off)
just copy the text in beteen the bigen and end.

Notice I've remed out the user side of the description, because our Net Admin needs it for managing user info.

i just change the field of the computer description.

All what you have to do is just the red fonts area with what you need to show.

This work came from the script guy of microsoft. just google it.

--> bigen

''GK modified 10 -10 -07
Set objSysInfo = CreateObject("ADSystemInfo")
Set objUser = GetObject("LDAP://" & objSysInfo.UserName)
Set objComputer = GetObject("LDAP://" & objSysInfo.ComputerName)
strMessage = objUser.CN & " logged on to " & objComputer.CN & " " & Now & "."
'''objUser.Description = strMessage
'''objUser.SetInfo
objComputer.Description = strMessage
objComputer.SetInfo

<-- end





gkamenjati -> RE: script edit description filed in AD (5/16/2008 2:20:24 PM)

one more thing we push this thru GPO.




jtralala -> RE: script edit description filed in AD (5/19/2008 4:24:57 AM)

Thx you
I will test this next week when I am back in the office

Have you placed this script as a startup script fot the users

Thx
J




jtralala -> RE: script edit description filed in AD (5/19/2008 5:00:49 AM)

One more question
You told me that you also have a script for logoff can you please also provide me with taht information

regards,

J




gkamenjati -> RE: script edit description filed in AD (5/19/2008 9:55:56 AM)

It's the same for the Log Off, just changed the red part.

--> bigen

''GK modified 10 -10 -07
Set objSysInfo = CreateObject("ADSystemInfo")
Set objUser = GetObject("LDAP://" & objSysInfo.UserName)
Set objComputer = GetObject("LDAP://" & objSysInfo.ComputerName)
strMessage = objUser.CN & " logged Off " & objComputer.CN & " " & Now & "."
'''objUser.Description = strMessage
'''objUser.SetInfo
objComputer.Description = strMessage
objComputer.SetInfo

<-- end




gkamenjati -> RE: script edit description filed in AD (5/19/2008 10:04:22 AM)

In our Case both, logon and log Off descriptions are on the computer Side, because we do not want to change the User Description.See below. Computer Configuration (Enabled)Windows SettingsShutdown




Name
Parameters

\\srvdc\NETLOGON\OA-Logon\LoggedOff_description.vbs




 

Administrative Templates
System/Logon




Policy
Setting




To use this setting, click Show, click Add, and then, in the text box, type the name of the executable program (.exe) file or document file. Unless the file is located in the %Systemroot% directory, you must specify the fully qualified path to the file.Note: This setting appears in the Computer Configuration and User Configuration folders. If both settings are configured, the system starts the programs specified in the Computer Configuration setting just before it starts the programs specified in the User Configuration setting.Also, see the &quot;Do not process the legacy run list&quot; and the &quot;Do not process the run once list&quot; settings." gpmc_supported="At least Microsoft Windows 2000">Run these programs at user logon
Enabled









Items to run at logon

\\srvdc\netlogon\oa-logon\change_computer_description.vbs




jtralala -> RE: script edit description filed in AD (5/22/2008 3:17:15 AM)

Thx

It works perfect

J




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.1855469