Re: python create WMI instances

2005-06-23 Thread future_retro
Heres a script for creating printer ports import win32com.client WBEM = win32com.client.GetObject(r"winmgmts:{impersonationLevel=impersonate}!\\" + "." + r"\root\cimv2") printer = WBEM.Get("Win32_Printer").SpawnInstance_() printer.Properties_('DeviceID').Value = 'myprinter' printer.Properties_('Dr

Re: python create WMI instances

2005-06-23 Thread future_retro
Right I got it working. I had to put a printer port in aswell. I'll now look at a script to create printer ports. My goal is being able to query the printers on print server x and then recreate the printers (shares and ports) on print server y. Thanks, for all your help Tim, much appreciated. M

RE: python create WMI instances

2005-06-23 Thread Tim Golden
[EMAIL PROTECTED] | I've got as far as this. I don't get any errors but still no | printer | | >>> import win32com.client | >>> WBEM = | win32com.client.GetObject(r"winmgmts:{impersonationLevel=imper | sonate}!\\" + "." + r"\root\cimv2") | >>> printer = WBEM.Get("Win32_Printer").SpawnInstanc

Re: python create WMI instances

2005-06-23 Thread future_retro
I've got as far as this. I don't get any errors but still no printer >>> import win32com.client >>> WBEM = >>> win32com.client.GetObject(r"winmgmts:{impersonationLevel=impersonate}!\\" + >>> "." + r"\root\cimv2") >>> printer = WBEM.Get("Win32_Printer").SpawnInstance_() >>> printer.Propertie

RE: python create WMI instances

2005-06-22 Thread Tim Golden
[EMAIL PROTECTED] | Win32_Printer doesn't work with the Create method and | AddPrinterConnection only lets me add a connection to a share. I'll | try and work out how to set the printer object properties in | the format | suggested; | | oPrinter.Properties_ ("DriverName").Value = strDriver | |

Re: python create WMI instances

2005-06-22 Thread future_retro
Win32_Printer doesn't work with the Create method and AddPrinterConnection only lets me add a connection to a share. I'll try and work out how to set the printer object properties in the format suggested; oPrinter.Properties_ ("DriverName").Value = strDriver Cheers, MW. -- http://mail.python.

Re: python create WMI instances

2005-06-22 Thread future_retro
Create isn't a method of Win32_Printer so I couldn't get that to work. .Create is a method of Win32_Process which (wait for it..) creates a new process. Unfortunatly there is no method to add a printer. the method .AddPrinterConnection will allow me to add a connection to an existing print share

RE: python create WMI instances

2005-06-10 Thread Tim Golden
[Marc Wyburn] | | Hi all, I am struggling with a vb - python code conversion. I'm using | WMI to create printers on remote machines using (in VB); | | set oPrinter = oService.Get("Win32_Printer").SpawnInstance_ | | oPrinter.DriverName = strDriver | oPrinter.PortName = strPort | oPrinter.Devic

python create WMI instances

2005-06-10 Thread Marc Wyburn
Hi all, I am struggling with a vb - python code conversion. I'm using WMI to create printers on remote machines using (in VB); set oPrinter = oService.Get("Win32_Printer").SpawnInstance_ oPrinter.DriverName = strDriver oPrinter.PortName = strPort oPrinter.DeviceID = strPrinter oPrinter.Put_(