E_ACCESSDENIED problem with win32 disk quota

B

Bart Simpson

Hi,

I'm testing to control Windows disk quota by PythonWin on win2003 and
winXP.

But ther is some problem..
This is the test code:

import win32com.client

qutoa=win32com.client.Dispatch('Microsoft.DiskQuota.1')
quota.Initialize('c:\\',1)
test=quota.AddUser('test') ## 'test' is real account name in my
machine.
test.QuotaLimit=10000000 # 10MB

However, If I run it within PythonWin, I get this returned error
message:
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File "C:\Python22\Lib\site-packages\win32com\client\__init__.py",
line 355, in __setattr__
apply(self._oleobj_.Invoke, args + (value,) + defArgs)
com_error: (-2147352567, 'Exception occurred.', (0, None, None, None,
0, -2147024891), None)

I have known error code -2147024891 (0x80070005) means E_ACCESSDENIED
by someone's kind help. (Thanks Roger :)

But I run PythonWin on Administrator privilege and I couldn't find any
related method for setting permission in 'Microsoft.DiskQuota.1'
object.

Does anyone have any ideas?

Thanks!
 
W

Werner Schiendl

Bart said:
I have known error code -2147024891 (0x80070005) means E_ACCESSDENIED
by someone's kind help. (Thanks Roger :)

But I run PythonWin on Administrator privilege and I couldn't find any
related method for setting permission in 'Microsoft.DiskQuota.1'
object.

Does anyone have any ideas?

I think this will probably similar to rebooting the PC: You will need to
acquire some kind of "Security Token".

Unfortunately I don't have the actual name for it handy :-(

So even when you have the right to do it, you need to tell windows that
you are about to do something "potentially dangerous".


hth

Werner
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top