snootalope
IS-IT--Management
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?
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?