• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 18414
  • Last Modified:

Can you launch a vbs script from a bat file logon script

I have a logon bat file now and need to remap printers in MS Active Directory to a new server. I have worked with vbs logon scripts but never bat logon scripts, so can I call a vbs script from a logon script that is in bat format. Then let the vbs script remap the printers.
0
pointhigh
Asked:
pointhigh
3 Solutions
 
jax79sgCommented:
There shouldn't be any problems. In fact i think you can place the vbs files in the logon script folder without a need for a batch file.
*vbs files are executable in windows*
0
 
ghostdog74Commented:
generally to call vbscript from bat file,

cscript <scriptname>
0
 
RobSampsonCommented:
ghostdog74 is right.

In a batch file (or from the DOS prompt, for testing), you can run
   cscript \\server\netlogon\script.vbs
for the DOS version of Windows Script Host (which shows a DOS prompt briefly)
and you can also use
   wscript \\server\netlogon\script.vbs
for the Windows version of Windows Script Host (which will not show the DOS window)

Regards,

Rob.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
pointhighAuthor Commented:
Thanks for that information, it looks to be what I am looking for. One other part is what is does the vbs script pass back control to the bat login script when it finishes or do I have to do that in the vbs script. Also does the bat login script wait for the vbs script to finish?

I have increased the points to 250 because of the added question.
Pointhigh
0
 
RobSampsonCommented:
When you call the VBS from your batch file, the script will be executed, but the batch file will continue to run the rest of it's commands.

If you want the batch file to wait for the script to finish before running its other commands, use
start /wait wscript \\server\netlogon\script.vbs

instead.

Regards,

Rob.
0
 
pointhighAuthor Commented:
Thanks that was the information I was looking for.
Pointhigh
0
 
RobSampsonCommented:
No problem, thanks Pointhigh.

Regards,

Rob.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now