Tech Support > Microsoft Windows > Windows Server > Survey: what do you use to create Login scripts
Survey: what do you use to create Login scripts
Posted by JohnB on April 24th, 2008


I have been, in various forms and titles, working in the network
administration field for some 20 years now. But with my previous employer,
I did much less of that and, more on the project management side of things.
Well now after having been "right-sized" I am looking at getting into
network admin again.

In the past I always used traditional batch files for login scripts. And
now I'm wondering if this is still the preferred method. I have done some
VB scripting in the past, but always thought you ended up with many more
lines of code with that method. I know there are some other options our
there like kixtart, but I have only "played" with those, never used them in
production.

What do you use for your login scripts, and why did you choose that option?



Posted by Pegasus \(MVP\) on April 24th, 2008



"JohnB" <jbrigan@yahoo.com> wrote in message
news:u9othTjpIHA.6096@TK2MSFTNGP06.phx.gbl...
I use batch files each and every time. Under Win2000/XP they have
become sufficiently versatile to perform 95% of all jobs. If I have a
specific requirement that is beyond the capabilities of a batch file then
I invoke a tailor-made VB script from within the batch file.

I find VB scripts both unnecessary and too verbose for everyday
tasks. As an example: To keep a local folder (including subfolders)
up-to-date requires lots of VB script lines. With robocopy or xcopy
I can do the job in a single line of code.



Posted by Herb Martin on April 24th, 2008



"JohnB" <jbrigan@yahoo.com> wrote in message
news:u9othTjpIHA.6096@TK2MSFTNGP06.phx.gbl...
It's what I do mostly. And I write a LOT of scripts.

(For admin task I tend to use Perl [or sometimes Ruby and PHP lately
but Perl is on ALL of my machiens]).

I try to use straight batch with only built-in tools so that they will "run
anywhere".

When they are too complicated for that, I generally use Perl, or white a
custom
C(++) app to do the hard part, especially if the hard part is something
reusuable
and useful in the future.




Posted by Richard Mueller [MVP] on April 24th, 2008


JohnB wrote:

I used to use batch files for everything (10 years ago), but I use VBScript
programs almost exclusively now. There are many new capabilities in batch
language, but they don't work on older clients, plus they are harder to read
(for me). I like code that anyone can understand. VBScript often requires
more lines of code, but that does not make them slower. I find too many
things that can only be done with ADSI and VBScript. Copying files is easier
in batch language, but checking group membership is especially important in
logon scripts, and this can only be done in batch files if you use third
party tools. I can always run command line tools like xcopy, calcs, or ping
from a VBScript program.

In the future most admins will use PowerShell for admin tasks, which in some
ways is similar to batch language, but requires .NET. This won't be good for
logon scripts until more capabilities come out from Microsoft.

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--



Posted by Herb Martin on April 25th, 2008



"Richard Mueller [MVP]" <rlmueller-nospam@ameritech.nospam.net> wrote in
message news:%23F8WK0kpIHA.3804@TK2MSFTNGP02.phx.gbl...
I am a "script guy" but highly doubt that PowerShell will be what
"most admins" use.

One serious problem is that PowerShell is practically worthless
as an ordinary (manual, interactive) command shell -- most users
will find it too "Unix like" to use easily, but not enough like them
to use regularly (habitually.)

My opinion ... only.



Posted by JohnB on April 25th, 2008


Yes, that was one of the things I was wondering what others do; what if
you're doing something like testing for group membership... but that
requires a 3rd party tool.




Posted by JohnB on April 25th, 2008


Yeah, I've always wondered why Microsoft chose not to go the same route as
Novell; to use built-in scripting. To me that's always been a glaring
omission from the server versions of Windows. Or maybe they considered
batch files to be just that. Then if that's the case, they sure have could
have done a better job, by adding things such as a command to test for group
membership.




"Richard Mueller [MVP]" <rlmueller-nospam@ameritech.nospam.net> wrote in
message ...



Posted by JohnB on April 25th, 2008


Thanks for the feedback.


"Pegasus (MVP)" <I.can@fly.com.oz> wrote in message
news:OiysEWkpIHA.1240@TK2MSFTNGP02.phx.gbl...


Posted by Herb Martin on April 25th, 2008



"JohnB" <jbrigan@yahoo.com> wrote in message
news:OIxll4tpIHA.3680@TK2MSFTNGP05.phx.gbl...
IfMember.exe from the ResKit works ok; it's free and from Microsoft.

It is my habit to have the ResKit, support tools, Perl, UnxTools (Gnu for
Win32), and a large collection of my own Bat/Cmd files on or available
to each machine.



Posted by kj [SBS MVP] on April 25th, 2008


JohnB wrote:
No it doesn't but it does require some scripting abilities. Even an amateur
scripter like me can leverage the work of good scripters to accomplish this
objective.

Go look on scriptcenter and see whats already there and how to customize for
your own environment.

http://www.microsoft.com/technet/scr...r/default.mspx


(Sample snipit supplied below)
--

Const Test1_GROUP = "cn=test1"
Const Test2_GROUP = "cn=test2"
Const Test3_GROUP = "cn=test3"

Set wshNetwork = CreateObject("WScript.Network")
'wshNetwork.MapNetworkDrive "k:", "\\FileServer\Users\" &
wshNetwork.UserName

Set ADSysInfo = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" & ADSysInfo.UserName)
strGroups = LCase(Join(CurrentUser.MemberOf))
WScript.Echo strGroups

If InStr(strGroups, Test1_GROUP) Then

wshNetwork.MapNetworkDrive "l:", "\\sbs1\test1"
' wshNetwork.AddWindowsPrinterConnection "\\PrintServer\EngLaser"
' wshNetwork.AddWindowsPrinterConnection "\\PrintServer\Plotter"
' wshNetWork.SetDefaultPrinter "\\PrintServer\EngLaser"
WScript.Echo "Map Drive L"

End if

-----
--
/kj



Posted by Herb Martin on April 25th, 2008



"kj [SBS MVP]" <KevinJ.SBS@SPAMFREE.gmail.com> wrote in message
news:%23jDwnEvpIHA.4280@TK2MSFTNGP02.phx.gbl...
Good advice -- and pay particular attention to the "Script-O-Matic" located
there; either for ADSI or WMI.



Posted by kj [SBS MVP] on April 25th, 2008


Herb Martin wrote:
Yes, I meant to mention script-o, thanks Herb.

Script-o is great too, for so many things.

--
/kj



Posted by stufeatherston@gmail.com on April 25th, 2008


On Apr 24, 12:58 pm, "JohnB" <jbri...@yahoo.com> wrote:

I use VBScript or Batch files. I guess the reason that I use them is
I am familiar with the syntax of them and they run without installing
any other software, like Perl for example.

Posted by DevilsPGD on April 27th, 2008


In message <ucM0n6tpIHA.4376@TK2MSFTNGP06.phx.gbl> "JohnB"
<jbrigan@yahoo.com> wrote:

Batchfiles, VBScript, and now Powershell... What more do you want?


Similar Posts