These functions should get you started and probably finished...
def createprinterport(IPAddress,ServerName):
WBEM =
win32com.client.GetObject(r"winmgmts:{impersonationLevel=impersonate}!\\"
+ ServerName + r"\root\cimv2")
WBEM.Security_.Privileges.AddAsString("SeLoadDriverPrivilege")
pr
The target OS needs to support WMI so 2000 or XP.
--
http://mail.python.org/mailman/listinfo/python-list
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
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.
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
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
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
hi all,could someone clear this up for me. I'm sure it's probably very
simple but I can't seem to get my head round it.
doing the following
>>> import wmi
>>> c = wmi.WMI()
>>> for printdriver in c.Win32_PrinterDriver():
... pd = printdriver.Name
>>> print pd
AGFA-AccuSet v52.3,3,Windows
the square brackets round the output of split got me. Have plit into a
new list and all works as expeted. Cheers, MW.
--
http://mail.python.org/mailman/listinfo/python-list
Hi, I'm trying to use the AddPrinterDriver method of
Win32_PrinterDriver to create a new. print driver. I can't get my
head round how I need to do this. So far I have
import win32com.client
WBEM =
win32com.client.GetObject(r"winmgmts:{impersonationLevel=impersonate}!\\"
+ "." + r"\root\cimv2
Got it working, removed spawninstance and the driver path should have
been "C:\\test\\"
Cheers for your help Roger.
--
http://mail.python.org/mailman/listinfo/python-list
In the following script I can't get the reg key to unload. Anyone got
any ideas? I can load and save the key without any problems. I can
unload the key from regedit and have checked security on the key. The
docs don't mention any special privileges are needed
(SeRestorePrivilege should do it).
I've worked out that I can open and close the key fine if I don't open
a subkey. I've tried adding flush and close statements after opening
the key and still get access denied when trying to unload.
--
http://mail.python.org/mailman/listinfo/python-list
solved it!
I need to close the key first
import ntsecuritycon
import win32security
import win32api
import _winreg
import win32con
flags = ntsecuritycon.TOKEN_ADJUST_PRIVILEGES |
ntsecuritycon.TOKEN_QUERY
htoken = win32security.OpenProcessToken(win32api.GetCurrentProcess(),
flags)
Loadid = win32s
Hi all, cannot work this one out at all...
import win32com.client
WBEM =
win32com.client.GetObject(r"winmgmts:{impersonationLevel=impersonate}!\\"
+ servername + r"\root\cimv2")
WBEM.Security_.Privileges.AddAsString("SeLoadDriverPrivilege")
drv = WBEM.Get("Win32_PrinterDriver")
drv.Properties_('Na
soz I missed the glaring error. The file paths need to be to a UNC
location of have to exist on the remote PC.
--
http://mail.python.org/mailman/listinfo/python-list
Anyone got any idea how to use this? It looks like it isn't available
directly from the win32 extensions.
Thanks, MW.
--
http://mail.python.org/mailman/listinfo/python-list
I got that far but the RasAdminUserGetInfo function isn't defined in
win32net (or anywhere else as far as I can work out). Is there a way
to use it without the win32 module? This is the first thing I haven't
been able to do with win32net so I'm a little stumped on where the road
goes from here..M
18 matches
Mail list logo