WUGNET, the Windows User Group Network
Your Complete Resource Center for "The Best" in Shareware, Computing Tips and Support, Windows Industry News... and much more!
Home Forums Shareware Windows Tips Hot Offers FREE Newsletters Arcade Contact Us About Partners
Search WUGNET: RSS Feeds RSS Feeds Advertise with WUGNET    |    Shareware eBooks
HomeHome FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Logon script

 
   Home -> Windows Other -> Group Policy RSS
Next:  CSVDE tool usage  
Author Message
qq

External


Since: Sep 12, 2007
Posts: 5



(Msg. 1) Posted: Wed Mar 26, 2008 1:35 pm
Post subject: Logon script
Archived from groups: microsoft>public>win2000>group_policy (more info?)

Hi All,

I want to have a vbscript logon script for domain users. When they login
from client PCs, detect network printers, if it exist, then do nothing, if it
doesn't exist, then add it.

Can anybody help me out? Thanks.

My code is the following:

Option Explicit

Dim objNetwork, strNJQAPrinter1, strNJQAPrinter2, strNJQAPrinter3
Dim objPrinter, intDrive
Dim ExistPrinter1, ExistPrinter2, ExistPrinter3

strNJQAPrinter1 = "\\server\SHARP AR-M455N PCL6 "
strNJQAPrinter2 = "\\server\Zebra170XiIII Plus #2"
strNJQAPrinter3 = "\\server\Zebra170XiIIIPlus #3"

ExistPrinter1 = 0 'Set not exist printer1
ExistPrinter2 = 0 'Set not exist printer2
ExistPrinter3 = 0 'Set not exist printer3

' Create a network object
Set objNetwork = CreateObject("WScript.Network")
set objPrinter = objNetwork.EnumPrinterConnections

If objPrinter.Count = 0 Then
WScript.Echo "Warning: No Printers connected"
Else
WScript.Echo "Printer Count = " & objPrinter.Count
End IF

'Determine printer
For intDrive = 0 To (objPrinter.Count -1) Step 2

If objPrinter.Item(intDrive +1) = strNJQAPrinter1 Then
ExistPrinter1 = 1
End IF

If objPrinter.Item(intDrive +1) = strNJQAPrinter2 Then
ExistPrinter2 = 1
End IF

If objPrinter.Item(intDrive +1) = strNJQAPrinter3 Then
ExistPrinter3 = 1
End IF

Next

If ExistPrinter1 = 1 Then
WScript.Echo strNJQAPrinter1 & " is exist."
Else
objNetwork.AddWindowsPrinterConnection strNJQAPrinter1
WScript.Echo strNJQAPrinter1 & " is Not exist. Add it."
End IF

If ExistPrinter2 = 1 Then
WScript.Echo strNJQAPrinter2 & " is exist."
Else
objNetwork.AddWindowsPrinterConnection strNJQAPrinter2
WScript.Echo strNJQAPrinter2 & " is Not exist. Add it."
End IF

If ExistPrinter3 = 1 Then
WScript.Echo strNJQAPrinter3 & " is exist."
Else
objNetwork.AddWindowsPrinterConnection strNJQAPrinter3
WScript.Echo strNJQAPrinter3 & " is Not exist. Add it."
End IF

' Set the default printer now
objNetwork.SetDefaultPrinter strNJQAPrinter1


WScript.Quit

' End of printer script.
Back to top
Login to vote
qq

External


Since: Sep 12, 2007
Posts: 5



(Msg. 2) Posted: Thu Mar 27, 2008 2:17 pm
Post subject: RE: Logon script [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Can anybody help me? Help me, please.
Back to top
Login to vote
Display posts from previous:   
       Home -> Windows Other -> Group Policy All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Categories:
 Windows XP
 Windows Vista
  Windows Other
 Office
 Office Other
 Security
 WinRAR
  • Home |
  • Shareware |
  • Windows Tips |
  • Hot Offers |
  • FREE Newsletters |
  • Arcade |
  • Forums |
  • eBooks |
  • About WUGNET |
  • Partners |
  • Contact

  • WUGNET Privacy Policy |
  • Link to WUGNET