Если кто-то захочет разобраться в работе скрипта и понять Подключение ( маппинг) сетевого принтера к пользователю;; Отключение.
VBS Logon Scripts - RemovePrinterConnection. Use VBScript To Remove a Printer. Occasionally Windows logon scripts need the RemovePrinterConnection method. So I will provide two worked examples of how to remove unwanted printer icons from the Printers and Faxes folder. Topics for RemovePrinterConnection. Remove Printer With VBScript Scenario. I find that printer logon scripts do not need RemovePrinterConnection as much as mapping network drives need RemoveNetworkDrive.
The reason is that if you map the same printer repeatedly you don't get the error: 'The local device name is already in use'. Surprisingly, the script just maps the new printer over the old one. Nevertheless, removing an existing printer is useful when your scripts are at the testing stage and you don't want to keep going to the Printer and Faxes folder, right-clicking the printer and selecting: Delete. RemovePrinterConnection Arguments. To get rid of a printer icon, most of the time, all that you need is the method, RemovePrinterConnection and the printer name.
For example. objNetwork. RemovePrinterConnection strUNCPrinter (Network Printer). objNetwork. RemovePrinterConnection "Epson" (Local Printer). Mastering the basics of RemovePrinterConnection are easy.
- Если применить его ко всем компьютерам с Windows Vista и новее, то при срабатывании скрипта подключения принтера не выскочит.
- По своей работе частенько сталкиваюсь с тем, что пользователи кривыми ручками переводят принтер в режим Offline, т.е. "Автономная.
- Он подключает «расшаренный» сетевой принтер и назначает его принтером по умолчанию. Если этот скрипт разместить в папке.
Готовые VBS скрипты для управления принтерами в Windows; Установка драйвера принтера из командной строки; Добавляем в.
If there is a danger it's adding, un-needed, unnecessary syntax. For instance there is no need for a comma before the printer name.
Even mastering the extra arguments is not difficult, however, in this instance you do need commas between the last three arguments, here is the full syntax:. RemovePrinterConnection strDriveLetter, bForce, bUpdateProfile. It was a long time before I realized that the prefix b, in bForce and bUpdateProfile meant Boolean.
Если кто-то захочет разобраться в работе скрипта и понять Подключение ( маппинг) сетевого принтера к пользователю;; Отключение.
Once I understood this significance, it became obvious why there were only two possible values, true or false. bForce means remove the printer - even if its in use.
(My friend 'Mad' Mick thinks bForce means brute force and he is not far wrong. Setting bUpdateProfile to "true" tells VBScript to update the user's profile. Example 1a - Preparation RemovePrinterConnection. Even though RemovePrinterConnection is straightforward, we still need preparation. So we must create a printer, otherwise, there would be nothing to remove and all you would get is Error: 'This network connection does not exist'. You need an printer before the script has any icons to remove from the Printers and Faxes folder.
' PrintersLong. vbs - Windows Logon Script example. ' VBScript - to map a network printer.
' Author Guy Thomas. ' Version 2. 2 - April 24th 2010. Option Explicit.
Dim objNetwork. Guy Recommends SolarWinds' Free Network Monitor. Example 1b - Delete the printer icon with RemovePrinterConnection. Instructions for RemovePrinterConnection. Copy and paste the script below into notepad or get a script editor such as OnScript (free download). Save the file with.
vbs extension e. RemovePrinterConnection. vbs. Double click the VBScript and then launch your Printers and Faxes folder. There should be no printer corresponding to strUNCPrinter.
objNetwork. RemovePrinterConnection strUNCPrinter. WScript. Echo "Check Printers folder NO: " & strUNCPrinter.
VBS Learning Points. Note 1: The basic RemovePrinterConnection is a simple command with no commas and only one argument - the drive letter. Note 2: If you need to remove a local printer, all you need to do is place its name in quotes "HP Laserjet 6l". Example 2 - Full RemovePrinterConnection Syntax. Just in case you need the bForce or the bUpdateProfile switch, here is an example of the full RemovePrinterConnection command with all three arguments. Instructions to RemovePrinterConnection.
You need to create a printer before this script can delete its icon from the Printers and Faxes folder. Copy and paste the script below into notepad. Save the file with. vbs extension e. RemPrinterBForce. vbs.
Double click the VBScript and then launch your Printers and Faxes folder. There should be no printer corresponding to strUNCPrinter name. ' Author Guy Thomas. ' Version 2. 5 - April 24th 2010.