Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Logon Script, combine bat and vbs

Status
Not open for further replies.

snootalope

IS-IT--Management
Jun 28, 2001
1,706
US
I currently have a bat logon script that runs ifmember and maps users drives.. I'm trying to get a script to work that will also create a mapped printer for them based on an ifmember check. Here's a snip from both:

batch:
\\server1\netlogon\ifmember "DOMAIN\Basic Users"
if not errorlevel 1 goto end
(run the vbs below)
:end

vbs:
Set objWSHNetwork = CreateObject("WScript.Network") 'create network object
strConnectString = "\\DOMAIN\basicprinter"
strResult = objWSHNetwork.AddWindowsPrinterConnection(strConnectString)

I try to combine the two:

\\server1\netlogon\ifmember "DOMAIN\Basic Users"
if not errorlevel 1 goto end
Set objWSHNetwork = CreateObject("WScript.Network") 'create network object
strConnectString = "\\DOMAIN\basicprinter"
strResult = objWSHNetwork.AddWindowsPrinterConnection(strConnectString)
:end

It doesn't work saying "'strConnectString' is not recognized as an internal or external command, operable program or batch file."

My scripting skills are very meager, could someone tell me if it's possible to put the vbs code into the batch, or do I need to keep them separate and just call the vbs script from the batch?
 
VBS scripting commands will not run from a batch file, you will need to create a seperate VBS script to run.
 
And if you look in the FAQs for the vbscript forum here, you'll see markdmac's awesome logon script that does everything.

Pat Richard MVP
Plan for performance, and capacity takes care of itself. Plan for capacity, and suffer poor performance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top