Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


What can VBs do that .bat files can't?

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,49372
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> What can VBs do that .bat files can't?
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1] 2   next >   >>
Login
Message << Older Topic   Newer Topic >>
 What can VBs do that .bat files can't? - 7/11/2007 2:38:34 PM   
  duki

 

Posts: 14
Score: 0
Joined: 7/11/2007
Status: offline
Could someone give me some good examples of some stuff vbs can do that .bat files can't?  Mainly from the perspective of logon scripts.
 
 
Post #: 1
 
 RE: What can VBs do that .bat files can't? - 7/11/2007 2:47:42 PM   
  kirrilian


Posts: 628
Score: 3
Joined: 3/15/2005
From:
Status: offline
I use a vbs login script to mount drives, add printers (if they dont already exist) and use the built in text-to-speech to say hello :)

could you do most of this with a batch file? probably, except the printer and the ear candy

as a general rule of thumb, I use vbs for more advanced scripts and batch for the quick and dirty ones

_____________________________

Have you searched here ?
VBScript Fundamentals
My Site

(in reply to duki)
 
 
Post #: 2
 
 RE: What can VBs do that .bat files can't? - 7/11/2007 2:58:55 PM   
  Rischip


Posts: 510
Score: 2
Joined: 3/26/2007
Status: offline
Batch can be used to install printers, mount drives, and most anything else. It is much more robust than most people give it credit for, but vbscript is even more robust, in a different manner.

Batch printer install:
rundll32 printui.dll,PrintUIEntry /p /n\\machine\printer

RUNDLL32 PRINTUI.DLL,PrintUIEntry /? to get parameters
 
Batch mount drives:
net use z: \\blahblahblah\share




_____________________________

Rischip
Author of - The Grim Linker

(in reply to kirrilian)
 
 
Post #: 3
 
 RE: What can VBs do that .bat files can't? - 7/11/2007 7:51:50 PM   
  crazymatt

 

Posts: 297
Score: 0
Joined: 3/4/2005
From:
Status: offline
quote:

ORIGINAL: duki

Could someone give me some good examples of some stuff vbs can do that .bat files can't?  Mainly from the perspective of logon scripts.


Well you can use it for more control, if you want to have all users have the same printers or the same networkshare i guess bat is good enough.
If on the other hand you only want the users that are on a certain ip-subnet have a printer you can make wmi querys that controls that.
Or maybe you only want ppl with Office to have the networkshare "documents", then you make a wmiquery in ADD/remove progs and if office exists the networkshare is mapped.

For one example i have both office2000 and 2003 users, for the office2000 users i run a small program that fixes a problem with their profiles, but if that is run on office2003 it generates an error.

You can also make nice looking .hta's that gives the users information about what happening.

Basicly i use a logon.bat as the backbone and then i call diffrent more comlicated vbs files from within that bat.

So simple tasks = .bat , complicated = vbs.
But if you have a simple enviroment and dont feel you need any special installations or tasks done during the logon phase i guess you can do just as good with plain old bat files.

Hope it answered you question?

/CM

_____________________________

-There is only 10 sorts of people, those who understand binary and those who dont.

(in reply to duki)
 
 
Post #: 4
 
 RE: What can VBs do that .bat files can't? - 7/12/2007 12:58:17 AM   
  ebgreen


Posts: 5250
Score: 31
Joined: 7/12/2005
Status: offline
Well to be honest, there are very few things that you can do in VBS but not in Bat. Everything is just simpler in VBS.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to crazymatt)
 
 
Post #: 5
 
 RE: What can VBs do that .bat files can't? - 7/12/2007 1:53:37 AM   
  duki

 

Posts: 14
Score: 0
Joined: 7/11/2007
Status: offline
Intersting.

Another question.  If I have a vbs that installs an MSI of my choice in a GPO ilnked to an OU, do the users have to have local admin privs?

(in reply to ebgreen)
 
 
Post #: 6
 
 RE: What can VBs do that .bat files can't? - 7/12/2007 2:43:07 AM   
  ginolard


Posts: 1082
Score: 21
Joined: 8/10/2005
Status: offline
If it runs under their context yes.  Usually when installing software via GPO it's done using a specific tool for remote software deployment (e.g. SMS, Altiris) and you can specify that it is installed using a specific account

_____________________________

Author of ManagePC - http://managepc.net
AD Query Template - http://www.visualbasicscript.com/m_40609/tm.htm
Consolidated Scripting Framework - http://www.visualbasicscript.com/m_59109/tm.htm

(in reply to duki)
 
 
Post #: 7
 
 RE: What can VBs do that .bat files can't? - 7/12/2007 3:33:37 AM   
  duki

 

Posts: 14
Score: 0
Joined: 7/11/2007
Status: offline
yeah, that's exactly what I'm trying to prevent.  I figure if I can get effecient at vbs and other server2003 tools, we won't need to blow $14000 on altiris.
Is there not a way to include a logon file with admin account and password with the installlation?

(in reply to ginolard)
 
 
Post #: 8
 
 RE: What can VBs do that .bat files can't? - 7/12/2007 9:39:57 AM   
  Parabellum


Posts: 222
Score: 0
Joined: 11/12/2006
From: UK
Status: offline
It is possible to do this with vbscript...although....
this functionality is already built into 2003 Server,
try here for starters..

http://support.microsoft.com/kb/816102

(in reply to duki)
 
 
Post #: 9
 
 RE: What can VBs do that .bat files can't? - 7/12/2007 9:46:43 AM   
  Rischip


Posts: 510
Score: 2
Joined: 3/26/2007
Status: offline
Installing things remotely and running scripts remotely is the reason I wrote TheGrimLinker.
It doesn't support pulling PC's from AD just yet but I'm working on it. For now you use a list file with pc names in it.

I have installed Lotus Notes, Java Runtime, Removed Yahoo Toolbar, Google Desktop, and many other things
on thousands of pc's using it. Keep in mind it's not perfect, but if you want to try it out, click my siggy and I'll help you out all you want.

With TheGrimLinker, if you can write a script that runs locally (you just wrote a script that can be run remotely)




_____________________________

Rischip
Author of - The Grim Linker

(in reply to Parabellum)
 
 
Post #: 10
 
 RE: What can VBs do that .bat files can't? - 7/12/2007 6:33:46 PM   
  Parabellum


Posts: 222
Score: 0
Joined: 11/12/2006
From: UK
Status: offline
I have some code, to perform this exact task..
It get's a list of Computer Accounts from AD, then uses some code i shamelessly pinched from dm4ever's connectivity monitor... to check if each PC is alive..
then write's the active PC's to an array...

Here it is if you want to use it..


      

< Message edited by Parabellum -- 7/12/2007 6:41:39 PM >

(in reply to Rischip)
 
 
Post #: 11
 
 RE: What can VBs do that .bat files can't? - 7/12/2007 8:24:35 PM   
  gdewrance


Posts: 587
Score: 3
Joined: 3/16/2006
Status: offline
Parabellum Just what I was looking for

(in reply to Parabellum)
 
 
Post #: 12
 
 RE: What can VBs do that .bat files can't? - 7/13/2007 12:07:50 AM   
  Rischip


Posts: 510
Score: 2
Joined: 3/26/2007
Status: offline
Parabellum nice script, but the reason I haven't incorporated it yet is that my needs are quite complicated.

I need to pull all PC's from AD. Then I need to provide a way (Filter) of limiting the PC's a user wants to run the script against by Domain, OU, operating system. They need to be able to select any combination and get the correct PC's. I need this info to be written to a file preferrably xml, so that AD is not polled each and every time. Then I need to give them the ability to "freshen" the file by requerying AD when they choose.

Simply put I need what ginolard has in ManagePC, but even more robust. Think you can whip me up one of those?

_____________________________

Rischip
Author of - The Grim Linker

(in reply to gdewrance)
 
 
Post #: 13
 
 RE: What can VBs do that .bat files can't? - 7/13/2007 3:18:11 AM   
  mcds99


Posts: 441
Score: 4
Joined: 2/28/2006
Status: offline
From another perspective you learn a large part of Visual Basic; this will help in day to day work in other areas like automating MS Office applications, reporting from databases, workstation management, and others.


Batch files (.bat or .cmd) are great, I started using .bat's in the DOS 3.x days BW (Before Windows). With the advent of VBS and now PS (PowerShell) I think Microsoft has depreciated the use of batch processing using .bat and .cmd. Not so much by design but by accident.  I still have my DOS 3.x Que book ;-)

_____________________________

Sam

Keep it Simple Make it Fun KiSMiF

(in reply to Rischip)
 
 
Post #: 14
 
 RE: What can VBs do that .bat files can't? - 7/13/2007 6:28:43 AM   
  Fredledingue


Posts: 383
Score: 0
Joined: 5/9/2005
From:
Status: offline
-Long file name support.

-Invisible mode (try running a batch file without the prompt -  the only way I know is... through a vbs)

-better sleep method

-better text manipulation

-send keys

However, what bat can do and vbs can't is "DIR".
That's realy something missing in VBS.

_____________________________

Fred

(in reply to mcds99)
 
 
Post #: 15
 
 RE: What can VBs do that .bat files can't? - 7/13/2007 6:43:09 AM   
  Rischip


Posts: 510
Score: 2
Joined: 3/26/2007
Status: offline
Neither is necessarily better than the other. Each has it's use and it's place.

One advantage batch has over vbs, is the fact that it is natively updated with the OS (kernel and command interpreter = update to batch language), whereas vbs and wsh require installs depending on version and OS.

I agree with mcds99, vbs does help learn VB (to a point), and since vbs is formatted and syntaxed more like a compiled language. If you learn good practice it is easier to maintain a large code base in vbs.

Oh, and don't ever try to run vbs from a boot floppy..... ROFLMAO.....
You need WINPE, or BARTPE for that.


_____________________________

Rischip
Author of - The Grim Linker

(in reply to Fredledingue)
 
 
Post #: 16
 
 RE: What can VBs do that .bat files can't? - 7/14/2007 12:43:57 AM   
  Fredledingue


Posts: 383
Score: 0
Joined: 5/9/2005
From:
Status: offline
Xhen did M$ update DOS the last time?

_____________________________

Fred

(in reply to Rischip)
 
 
Post #: 17
 
 RE: What can VBs do that .bat files can't? - 7/14/2007 3:50:27 AM   
  Rischip


Posts: 510
Score: 2
Joined: 3/26/2007
Status: offline
There is no more TRUE DOS..........

_____________________________

Rischip
Author of - The Grim Linker

(in reply to Fredledingue)
 
 
Post #: 18
 
 RE: What can VBs do that .bat files can't? - 7/14/2007 11:15:31 AM   
  Fredledingue


Posts: 383
Score: 0
Joined: 5/9/2005
From:
Status: offline
Ok, when did M$ update the "command interpreter"?

_____________________________

Fred

(in reply to Rischip)
 
 
Post #: 19
 
 RE: What can VBs do that .bat files can't? - 7/14/2007 12:45:51 PM   
  Rischip


Posts: 510
Score: 2
Joined: 3/26/2007
Status: offline
Well specifically the last update to the command interpreter itself was some updates and bug fixes for the "FOR" command.
More importantly A "DOS" was defined as having internal and "External" commands. External commands are standalone executables.
So any time either an internal or external command is updated or newly created it constitutes an update.

_____________________________

Rischip
Author of - The Grim Linker

(in reply to Fredledingue)
 
 
Post #: 20
 
 
Page:   [1] 2   next >   >>
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> What can VBs do that .bat files can't? Page: [1] 2   next >   >>
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts