5

I wonder what scripting languages is most used as logon scripts these days. Is people still hacking away in batch-file files or vbscripts, or do you use PowerShell or something completely different?

Personally, I have pretty good experience with vbscript, it works across almost all Windows versions, but PowerShell looks sweet and might be an option going forward.

So, what is your preferred scripting language for logon scripts, and why? And if you can, please share some of the brilliant things you do in your logon scripts.

Regards, Egil.

Egil Hansen
  • 203
  • 2
  • 8

9 Answers9

3

Although we use powershell on our servers, we use vbscript on the clients to login. VBscript is installed by default and we use it instead of CMD batch files because of the access to wmi and specifically we use it to install all the appropriate printers.

Knox
  • 2,453
  • 2
  • 26
  • 33
1

Your title strongly suggests a unix environment (or maybe its just me :-). Could be more precise if you add the phrase "for windows" at the end of the question.

Sorry for writing this as an answer, wanted to make it a comment but i just started on serverfault and don't have sufficient credits to add a comment.

nik
  • 7,040
  • 2
  • 24
  • 30
1

For now, our logon scripts still are winNT batch files, and will stay for quite a while. The reason for being so conservative is how fundamentally important the scripts are, and how easy it would be to screw up the distibution of the proper interpreter on all computers.

If and when Windows 7 replaces Windows XP, imho, it will become feasible to switch the logon scripts to PowerShell.

But even before then, it is possible to branch to other scripts (perl etc) from the logon.cmd after doing the proper tests.

Posipiet
  • 186
  • 1
1

I've used KIX for about 15 years. It's fast, easy, and just about anyone can learn it. Which is the best part as far as I'm concerned as I then don't have to be the one maintaining the scripts.

Also there is a great free kix editor Kixtarter

Dayton Brown
  • 1,549
  • 2
  • 13
  • 23
0

I use a combination of VBScript, WMI and ADSI. I am also starting to play with Powershell to see what it can do in the login scripts.

0

While Powershell is a fantastic scripting tool, and I use it all the time on servers, its a pain to use for scripts on client machines because its not installed everywhere, like VBscript is. Yes it could be rolled out by group policy but a lot of companies don't want to do that just to make life a bit easier for sysadmins!

Once organisations move to Windows 7 and Powershell is installed by default, then things can start to get interesting,

Sam Cogan
  • 38,158
  • 6
  • 77
  • 113
  • I haven't actually tried Powershell for login scripts because my guess is that they would be too slow. Each time a Powershell script runs the .Net framework also has to load up. I heard of one sys admin who changed all his login scripts on his Citrix servers to Powershell and almost crippled the servers when the users started to log in. I would be interested to hear what people need in a login script from Powershell that couldn't be done via VBscript. – fenster Sep 04 '09 at 01:24
0

I've also always used VBScript\WMI\ADSI as well as CMD batch files. I've deployed (firm-wide) and used Powershell plenty but not in login or startup scripts as Powershell is great, I love it, but it's slow compared to .vbs or .cmd and I don't want to slow down bootup\login times.

Jordan W.
  • 1,403
  • 1
  • 13
  • 19
0

I'm using batch too. I try to keep my logon scripts as simple as possible. Most of the time it's only for connecting network drives or printers...

Benoit
  • 3,499
  • 1
  • 18
  • 17
0

It's a mix of batch and VBScript at the moment.

I have been playing with PowerShell recently, but even with the script execution policy set to Unrestricted it will prompt when running a script from a UNC path such as \\domain.local\sysvol\...\file.ps1, which is not ideal for use as a logon script.

For the moment I'll stick with VBScript and eventually I'll get around to doing it the right way, i.e. signing the PowerShell scripts.

For local use, e.g. ad-hoc or scheduled tasks, PowerShell does just fine.

ThatGraemeGuy
  • 15,314
  • 12
  • 51
  • 78