Announcement

Collapse
No announcement yet.

How do you map printers with vb?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do you map printers with vb?

    Hi there good folk,
    I currently use a dos batch file for my scripting bit would move to the more stylish VB scripting if I could figure out how to map printers...
    An Suggestions?

    Many Thanks

    Iain Jones
    Iain Jones
    IT Manager
    Renascent Australia

  • #2
    see example:

    Code:
    ' AUTHOR: Marcel Henderik 
    'Comment: simple example to create printer connections. 
    
    Dim Network 
    Set Network = CreateObject("Wscript.network") 
    Network.AddPrinterConnection "\\server\printer"
    Marcel
    Technical Consultant
    Netherlands
    http://www.phetios.com
    http://blog.nessus.nl

    MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
    "No matter how secure, there is always the human factor."

    "Enjoy life today, tomorrow may never come."
    "If you're going through hell, keep going. ~Winston Churchill"

    Comment


    • #3
      Amny Thanks Dumber

      Yoy are a champ!!!

      Iain Jones
      Iain Jones
      IT Manager
      Renascent Australia

      Comment


      • #4
        *blush*



        going to bed now.. it's 1 am.... and at 6 i must get out...
        Marcel
        Technical Consultant
        Netherlands
        http://www.phetios.com
        http://blog.nessus.nl

        MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
        "No matter how secure, there is always the human factor."

        "Enjoy life today, tomorrow may never come."
        "If you're going through hell, keep going. ~Winston Churchill"

        Comment


        • #5
          Stupid Question...sorry...newbie

          Hi Dumber,
          Since I have cajolled you with complimets...I was curious....
          I know the answer will be hundreds of things....but could you give me some advice on other stuff i should/could put in a logon script besides the map printers and network drives?

          Thanks in Advance,

          Iain Jones
          Iain Jones
          IT Manager
          Renascent Australia

          Comment


          • #6
            You can do anything you want to (obviously) but the most common uses of logon scripts are to:

            map network drives based on group membership or location
            map network printers (ditto)
            run particular startup applications.
            housekeeping e.g. clear temp files, old profiles etc.

            Probably plenty of other ideas out there....

            Tom
            Tom Jones
            MCT, MCSE (2000:Security & 2003), MCSA:Security & Messaging, MCDBA, MCDST, MCITP(EA, EMA, SA, EDA, ES, CS), MCTS, MCP, Sec+
            PhD, MSc, FIAP, MIITT
            IT Trainer / Consultant
            Ossian Ltd
            Scotland

            ** Remember to give credit where credit is due and leave reputation points where appropriate **

            Comment


            • #7
              I agree with ossian...
              im in a network where a lot of change must be made. changes in office, mcafee (see topic epo agent) etcetc.

              cause my users are still a local admin (not anymore when i tested all the applications and approve it) i put al those things in the loginscript. registry changes.. installing new software, updates from word templates.
              Marcel
              Technical Consultant
              Netherlands
              http://www.phetios.com
              http://blog.nessus.nl

              MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
              "No matter how secure, there is always the human factor."

              "Enjoy life today, tomorrow may never come."
              "If you're going through hell, keep going. ~Winston Churchill"

              Comment


              • #8
                Same topic....

                How do I check if a printer connection exist on a computer ?

                Comment


                • #9
                  you could use something like this:

                  Code:
                  on error resume next
                  Set Network = CreateObject("Wscript.network")
                  Network.SetDefaultPrinter "\\server\printer"
                  If Err <> 0 Then
                  	WScript.Echo "printer does not exist"
                  Else
                  	wscript.Echo "printer exist"
                  end if
                  or maybe better:
                  Code:
                  Set X = network.EnumPrinterConnections 
                  
                  For Each printers In X
                  WScript.Echo printers
                   If printers = "\\Server\printer" Then 
                   	WScript.Echo "printer found...."
                   End If
                   
                  next
                  Marcel
                  Technical Consultant
                  Netherlands
                  http://www.phetios.com
                  http://blog.nessus.nl

                  MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
                  "No matter how secure, there is always the human factor."

                  "Enjoy life today, tomorrow may never come."
                  "If you're going through hell, keep going. ~Winston Churchill"

                  Comment


                  • #10
                    Tnx.

                    Thanks

                    Comment

                    Working...
                    X