Results 1 to 10 of 10

Thread: add a printer

  1. #1

    Thread Starter
    Fanatic Member dark_shadow's Avatar
    Join Date
    Feb 2005
    Location
    Igloo
    Posts
    900

    add a printer

    Hi , is it possible to add a printer through vb i am on a LAN and my account does not have admin rights the adminstrator made a mistake and blocked the add a printer and he cant unblock it so if its possible to be done please post the code

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: add a printer

    I'm pretty sure I've seen examples of how to do this (although I've not an example handy), however, even adding a printer through code requires the proper permissions be set.

    Goggle "add printer vb6" and see what you come up with.

  3. #3

    Thread Starter
    Fanatic Member dark_shadow's Avatar
    Join Date
    Feb 2005
    Location
    Igloo
    Posts
    900

    Re: add a printer

    like he kinda hid the add a printer its only blocked of you directly try to access it ( like if you make a shortcut to it it wont work he did the same with command prompt her blocked cmd.exe so we just used the shell statment with command.com btw if you know whats the diffent between the two (cmd.exe and command.com)

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: add a printer

    Quote Originally Posted by dark_shadow
    like he kinda hid the add a printer its only blocked of you directly try to access it ( like if you make a shortcut to it it wont work he did the same with command prompt her blocked cmd.exe so we just used the shell statment with command.com btw if you know whats the diffent between the two (cmd.exe and command.com)
    Command.com is used by Win95/98 - cmd.exe is used by NT/2000/XP

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

    Re: add a printer

    See my code example in CodeBank on Globally Add or Delete Network Printer to All Profiles on a Computer.

    It uses Rundll32 instead.
    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

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: add a printer

    Quote Originally Posted by RobDog888
    See my code example in CodeBank on Globally Add or Delete Network Printer to All Profiles on a Computer.

    It uses Rundll32 instead.
    Cool.

    Does this work regardless of administrative or policy settings regardings adding printers?

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

    Re: add a printer

    Thanks! Not too sure. I have an Admin account and we dont have any policies so I cant test it.
    We just have user/group permissions here.
    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

  8. #8
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: add a printer

    Quote Originally Posted by RobDog888
    Thanks! Not too sure. I have an Admin account and we dont have any policies so I cant test it.
    We just have user/group permissions here.
    Yeah, same here, thats why I was wondering. I've tried a number of times to bypass policies and admin settings through code, but so far I've not been successful. For me, that isn't an issue, but sometimes it can be for customer's.

    dark shadow: Give RobDog888's code a shot, and let us know how you make out.

  9. #9
    Addicted Member Cimperiali's Avatar
    Join Date
    Oct 2002
    Location
    Milan, Italy, Europe
    Posts
    188

    Re: add a printer

    Good one, RobDog888. I am quite sure it requires access to the server and
    printer, but it might work also withoud admin rights, as long as you have enough priviledges. Matter is: does he has at least power user access?
    Special thanks to some wonderful people,
    such as Lothar the Great Haensler, Aaron Young,
    dr_Michael, Chris Eastwood, TheOnlyOne ClearCode....

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

    Re: add a printer

    Cool! Thanks guys for the props This may be the first time my codebank code will be used after being
    posted for over 5 months.

    Rundll32 can do sooo many different things. I wish there was more documentation on it.



    Your network admin cant or wont unblock the add new printer?
    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