![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Using renameprinter to change a printer name on Server 2008 I am trying to change the names of printers on Windows Server 2008. The script works on XP and should work on Server 2008 but it isn't. Here is the script... Dim EndPos strComputer = "." Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colPrinters = objWMIService.ExecQuery("Select * From Win32_Printer Where DeviceID Like '%redirected%'") For Each objPrinter in colPrinters EndPos = InStr(objPrinter.name,"redirected") -1 objPrinter.name = Left(objPrinter.name, EndPos) & "redirected)" msgbox objprinter.name 'objPrinter.RenamePrinter(objPrinter.name) Next Any ideas how to fix this"? -- Thanks! |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Using renameprinter to change a printer name on Server 2008 Anyone? "Saucer Man" <saucerman@xxxxxx> wrote in message news:49070da9$0$5734$cc2e38e6@xxxxxx Quote: >I am trying to change the names of printers on Windows Server 2008. The >script works on XP and should work on Server 2008 but it isn't. Here is >the script... > > Dim EndPos > > strComputer = "." > > Set objWMIService = GetObject("winmgmts:" & > "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") > > > Set colPrinters = objWMIService.ExecQuery("Select * From Win32_Printer > Where DeviceID Like '%redirected%'") > > For Each objPrinter in colPrinters > EndPos = InStr(objPrinter.name,"redirected") -1 > objPrinter.name = Left(objPrinter.name, EndPos) & "redirected)" > msgbox objprinter.name > 'objPrinter.RenamePrinter(objPrinter.name) > Next > > > Any ideas how to fix this"? > -- > Thanks! > > |
My System Specs![]() |
| | #3 (permalink) |
| | RE: Using renameprinter to change a printer name on Server 2008 If your statement spans multiple rows, you should end your statement with a _ or put the full statement on 1 row. Set objWMIService = GetObject("winmgmts:" & _ "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colPrinters = objWMIService.ExecQuery("Select * From Win32_Printer Where _ DeviceID Like '%redirected%'") |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Using renameprinter to change a printer name on Server 2008 Sander Verroen schrieb: Quote: > If your statement spans multiple rows, you should end your statement with a _ > or put the full statement on 1 row. > > Set objWMIService = GetObject("winmgmts:" & _ > "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") > > Set colPrinters = objWMIService.ExecQuery("Select * From Win32_Printer Where _ > DeviceID Like '%redirected%'") > Set colPrinters = objWMIService.ExecQuery("Select * From Win32_Printer Where " _ & "DeviceID Like '%redirected%'") |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Using renameprinter to change a printer name on Server 2008 I do have the statements on 1 line. It just looks like two here in the post. Thanks. "ekkehard.horner" <ekkehard.horner@xxxxxx> wrote in message news:4964708c$0$31871$9b4e6d93@xxxxxx-online.net... Quote: > Sander Verroen schrieb: Quote: >> If your statement spans multiple rows, you should end your statement with >> a _ or put the full statement on 1 row. >> >> Set objWMIService = GetObject("winmgmts:" & _ >> "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") >> >> Set colPrinters = objWMIService.ExecQuery("Select * From Win32_Printer >> Where _ >> DeviceID Like '%redirected%'") > Set colPrinters = objWMIService.ExecQuery("Select * From Win32_Printer > Where " _ > & "DeviceID Like '%redirected%'") > |
My System Specs![]() |
| | #6 (permalink) |
| | Re: Using renameprinter to change a printer name on Server 2008 Saucer Man schrieb: Quote: > I do have the statements on 1 line. It just looks like two here in the > post. Thanks. don't deserve your thanks. (You are welcome anyway) Quote: > > > "ekkehard.horner" <ekkehard.horner@xxxxxx> wrote in message > news:4964708c$0$31871$9b4e6d93@xxxxxx-online.net... Quote: >> Sander Verroen schrieb: Quote: >>> If your statement spans multiple rows, you should end your statement with >>> a _ or put the full statement on 1 row. >>> >>> Set objWMIService = GetObject("winmgmts:" & _ >>> "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") >>> >>> Set colPrinters = objWMIService.ExecQuery("Select * From Win32_Printer >>> Where _ >>> DeviceID Like '%redirected%'") >> Set colPrinters = objWMIService.ExecQuery("Select * From Win32_Printer >> Where " _ >> & "DeviceID Like '%redirected%'") >> > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Error when installing SQL Express 2008 on Windows Server 2008 | PowerShell | |||
| Install Virtual Machine additions on Server 2008 server core. | Virtual PC | |||
| SQL Server Express 2008 & VS 2008 | .NET General | |||
| How do I set up SCVMM 2008 to interface with Hyper-V Server 2008? | Virtual Server | |||
| Windows 2008 print server at terminal services - printer driver problem | Vista print fax & scan | |||