Friday, November 21, 2008

Add mobile number to 1000 users

Hi all,

This is a script i wrote it in a response to a question asked by someone in Microsoft newsgroups:
how to add mobile numbers easily to 1000 users?
Let's assume that you have the users in a file named mobile.txt formatted like this:
User Phone number
Jon Kerry 0743221021
The first column is the name of the user, the second column is his mobile number (separated by a tab). The following script would do the trick:
For /F "Tokens=1,* Delims= " %%A In (mobile.txt) Do (
Set name=%%A
Set mobile=%%B)
dsquery user -name "%name%" dsmod user -mobile %mobile%
Pay attention that after Delims= it is a tab character.

Essential LDAP attributes

In this note i'll show you the essentials ldap attributes that can be used with different tools (like csvde or ldifde) to easily query for the required properties.

In the general tab, these are the ldap attributes (in the second column are the corresponding ldap attributes):
First name: givenname
Initials: initials
Last name: sn
Description: description
Display name: displayname
Office: physicalDeliveryOfficeName
TelephoneNumber: telephoneNumber
Webpage: wWWHomePage
E-mail: mail

In the address tab:
Street: streetAddress
P.O. Box: postOfficeBox
City: I
State: st
Zip code: postalCode
Country: co

In the account tab:
User logon name: UserPrincipalName
User logon name (pre Windows 2000): sAMAccountName
Account expires: accountExpires

In the profile tab:
Profile path: profilePath
Logon script: scriptPath
Home folder, drive: homeDrive
Home folder, local path: homeDirectory

In the telephones tab:
Home: homePhone
Pager: pager
Fax: facsimileTelephoneNumber
Ip Phone: ipPhone
Notes: Info

In the organization tab:
Title: title
Department: department
Company: company
Manager: manager