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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Login script - disable the close window/command prompt window

Status
Not open for further replies.

toby77jo

Programmer
May 4, 2006
35
BE
Hi,

I am using a login.bat file to map network drives, sync files with some vbs files etc.

My question is, can I make it impossible for the users to close the command prompt window that is opened from the login.bat file? My problem is that some users close the window before all scripts have finished to run.
 
Code:
'Check if a specific printer exists already  Returns -1 if printer exists, 0 if printer not present
Set WSHPrinters = WSHNetwork.EnumPrinterConnections
PrinterPath = "\\markmac-pc\HP LaserJet 6P"
PrinterExists = False
For LOOP_COUNTER = 0 To WSHPrinters.Count - 1 Step 2
    If WSHPrinters.Item(LOOP_COUNTER +1) = PrinterPath Then
      PrinterExists = True
    End If
Next
WScript.Echo PrinterExists

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
 
but in our firm we have 4 printers, in your example you use one printer..

PrinterPath = "\\markmac-pc\HP LaserJet 6P"

how would I put a printer path with 4 different printers?
 
I am using this code from Mark, How do I modify it to use the domain user name instead of the domain group name,

For Each GroupObj In UserObj.Groups
Select Case GroupObj.Name
'Check for group memberships and take needed action
'In this example below, ADMIN and WORKERB are groups.
Case "Cubic"
WSHNetwork.MapNetworkDrive "f:", "\\ADE-WEB\Cubic",True
WSHNetwork.AddWindowsPrinterConnection "\\ADE-WEB\HPColor4600"
Case "ADE-ITC"
WSHNetwork.MapNetworkDrive "Q:", "\\ade-domain\sysvol",True
WSHNetwork.MapNetworkDrive "T:", "\\Ade-mirror\mirror",True

Case "ade-hp"
WSHNetwork.SetDefaultPrinter "\\ADE-WEB\HPColor4600"

'Below is an example of how to set the default printer
'WSHNetwork.SetDefaultPrinter "\\ServerName\PrinterName"
End Select
Next
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top