Of course, you could always track down the user and ask
them for the information, but there??™s an easier way to obtain the information for Active Directory
users. The following script displays the logon name for a user based on the last name that you pass.
DSQUERY USER -name %1 | DSGET USER -samid -display
In this case, the input you provide is the user??™s last name. The DSQuery User object sends the user
information to the DSGet User object using a pipe (|). The DSGet utility, in turn, looks up the user??™s
SAM identifier and provides it as output on the command line. (When more than one user has the
same last name, you??™ll see a list of all of the associated logon names, but at least the list is shorter
than starting from scratch.)
Keeping Scripts Simple
Many people create batch files and scripts that perform so many tasks that the code becomes too complicated
to understand. The problem is feature creep. If one feature sounds good, two features must be
better, and three features beyond compare. Unfortunately, despite the bad example set by many shrinkwrap
application vendors, more features aren??™t always better. In fact, a simple single function script
often works better than a script that can perform multiple tasks.
Pages:
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151