|
|
|||||||
Hi there, I have a problem deleting some printers... To delete a remote printer, I have to use DelPrinterConnection("Sharename"). But I don't know the sharename, only the printername. I couldn't find any sharename in the registry, so how can I find out the sharenames? Background is that I have to switch some clients from one server to another. So a script should find out which printer is installed on the client. Thanx in advance Marcus |
||||||||
|
|
|||||||
If you browse to the printer server in network neighborhood you will see the printers there. These are the share names. |
||||||||
|
|
|||||||
Yes, that's right, but how do I read this with a script?. It should be universal for diffrent servers. I don't want to hardcode the printernames in the skript. That's not very nice |
||||||||
|
|
|||||||
You could enumerate the subkeys from this key (on the printer server). HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers Then it depends on if your printernames and share names are the same. |
||||||||
|
|
|||||||
Won't "Net View \\servername" give you what you need? It returns the share name of all shares, followed by the share type. Code: Shell '%COMSPEC% /c net view \\servername | find /i "PRINT" > printers.txt' would create a file with the printer shares that you could then parse. Don't forget to delete the file when you're done. This is a good way to get started. As you get some experience, WMI might be a good alternative to investigate. Glenn |
||||||||
|
|
|||||||
Thanks for the answers. I got a solution for the problem by using WMI. Here is the result Code:
The select gets only printers with sharename not NULL because this are localy installed printers. Greets Marcus |