而且由系統端處理即可,不需動用到使用者,使用者只要登入系統即會處理,IT只要動個login script就好。
試了好多方式,最後有一個我認為不錯的方式,只改user login script,其它都不用動:
在user login script中加一行如下:
mic printer where "servername like "%%printer server name%%"" delete /nointeractive
例如: printer server name = ABC,指示要改成
mic printer where "servername like "%%ABC%%"" delete /nointeractive
mic printer where "servername like "%%ABC%%"" delete /nointeractive
只要一段日子大家都登入過,再將指令移除即可。
打完,收工。
但是~~~好像有些時候上述方式不work,原因待查,就試試vbs的方式看看~~~
=====================
' Remove all network printers vbs
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colInstalledPrinters = objWMIService.ExecQuery _
("SELECT * FROM Win32_Printer where Servername='\\\\printer'")
For Each objPrinter in colInstalledPrinters
objPrinter.Delete_
Next
=======================
但是~~~好像有些時候上述方式不work,原因待查,就試試vbs的方式看看~~~
=====================
' Remove all network printers vbs
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colInstalledPrinters = objWMIService.ExecQuery _
("SELECT * FROM Win32_Printer where Servername='\\\\printer'")
For Each objPrinter in colInstalledPrinters
objPrinter.Delete_
Next
=======================
- 存檔在c:\test\deleteprn.vbs
- 在cmd中下cscript c:\test\deleteprn.vbs
這樣也OK的。
沒有留言:
張貼留言