Results 1 to 1 of 1

Thread: Globally Add or Delete Network Printer to All Profiles on a Computer

Threaded View

  1. #1

    Thread Starter
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Thumbs up Globally Add or Delete Network Printer to All Profiles on a Computer

    VB Code:
    1. Option Explicit
    2. 'Globally add or delete network printer(s) to all profiles on a computer.
    3.  
    4. 'Windows 2000/XP no problems.
    5. 'Windows NT 4 or below not supported.
    6. 'Windows 95/98 dont have anymore so can test.
    7.  
    8. 'Note 1: If you have problems shelling, then you could run all from the command prompt.
    9. 'Note 2: If you have a network printer with a space in the name then surround the name in double quotes.
    10. 'Note 3: Add a " /y" to the end of the command in order to make the printer the default printer.
    11. 'Note 4: This is [b]CASE SENSITIVE!!![/b]
    12.  
    13. 'You need to stop and start the spooler in order to refresh the printers folder after each add/delete.
    14.  
    15. 'At the command prompt:
    16. 'NET STOP Spooler - wait for confirmation
    17. 'NET START Spooler - wait for confirmation
    18.  
    19. Private Sub cmdGlobalAdd_Click()
    20.     Shell "Rundll32 printui.dll,PrintUIEntry /g[b]a[/b] /c\\[i]localcomputername[/i] /n\\[i]servername\printername[/i]", vbNormalFocus
    21. End Sub
    22.  
    23. Private Sub cmdGlobalDelete_Click()
    24.     Shell "Rundll32 printui.dll,PrintUIEntry /g[b]d[/b] /c\\[i]localcomputername[/i] /n\\[i]servername\printername[/i]", vbNormalFocus
    25. End Sub
    Last edited by RobDog888; Oct 12th, 2004 at 02:39 PM.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width