Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
objWMIService.Security_.Privileges.AddAsString "SeLoadDriverPrivilege", True

Set colInstalledPrinters =  objWMIService.ExecQuery _
    ("Select * from Win32_Printer")

For Each objPrinter in colInstalledPrinters
        if (objPrinter.name="Oki ML 590") then
        objPrinter.driverName = "HPLaserJet4"
        objPrinter.Put_
        msgbox(objPrinter.Name)
        end if
    Wscript.Echo objPrinter.driverName
next
Posted
Updated 22-Jan-14 23:42pm
v2
Comments
Member 13336280 9-Jan-18 16:04pm    
Hello! How can I update driver of other parts of pc with this code (Graphics, Processor...) with replacing "HPLaserJet4" with other driver name.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900