mijones
asked on
VBScript to delete printers.
Hi
I need a script to run in Windows 2000 every night to delete all the printers on a server, because we're having problems with Citrix. Can I do this with Network.RemovePrinterConne ction? I need to be able to not have to list the name of every printer because there are 100s of them. Is there anyway of using a wildcard to do this?
Many thanks.
Martin.
I need a script to run in Windows 2000 every night to delete all the printers on a server, because we're having problems with Citrix. Can I do this with Network.RemovePrinterConne
Many thanks.
Martin.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Many thanks for your help.
The printer enumeration works great, but I'm still having problems in that it is coming up with errors saying that the network connection doesn't exist. With a source of WSHNetwork.RemoveNetworkDr ive ?! Might this be because I don't have an Active Directory installed? (Still on NT here)
Cheers
The printer enumeration works great, but I'm still having problems in that it is coming up with errors saying that the network connection doesn't exist. With a source of WSHNetwork.RemoveNetworkDr
Cheers
That is for drive mappings : WSHNetwork.RemoveNetworkDr ive
That is not what we are discussing here? But put an " on error resume next" on top and it ill go fine.
The problem is that if the mapping isn't there anymore if will give you an error.
That is not what we are discussing here? But put an " on error resume next" on top and it ill go fine.
The problem is that if the mapping isn't there anymore if will give you an error.
Check to see if you have WSH installed on the Server.
lyonst,
Without WSH he wouldn't be able to do the enumeration. So i think that is installed very well.
Without WSH he wouldn't be able to do the enumeration. So i think that is installed very well.
ASKER
Thanks. I know that WSHNetwork.RemoveNetworkDr ive in for removing mapped drives, that's why I was confused!! I've reinstalled WSH to check that out and the same error occured :( I've tried in on other servers and workstations in the domain and the same response.
I was wondering if the WSHNetwork.RemovePrinterCo nnection was a ADSI method and therefore wouldn't work on our NT domain? Or is there something else i've missed (probably!)? I'm going to try it on one of our Win2k ADs or Win2k3 ADs, to see if it works there.
Cheers
I was wondering if the WSHNetwork.RemovePrinterCo
Cheers
ASKER
Hi again.
With the "on error resume next" it now works on my workstation to delete the printers :) The only problem is that it has no effect on the server in question. The problem is that the printers are virtual printer connections created by Citrix when user connects and therefore i'm not sure if they are set up in the same way as "normal" printers. I think that I might have to remove the registry settings for them :(
With the "on error resume next" it now works on my workstation to delete the printers :) The only problem is that it has no effect on the server in question. The problem is that the printers are virtual printer connections created by Citrix when user connects and therefore i'm not sure if they are set up in the same way as "normal" printers. I think that I might have to remove the registry settings for them :(
ASKER