How can I impersonate the current IronPython user?

I am trying to remotely control the installation of IIS7 using the Microsoft.Web.Administration library.

I do this in IronPython:

import Microsoft.Web.Administration
from Microsoft.Web.Administration import ServerManager

manager = ServerManager.OpenRemote("RemoteServerName")
for site in manager.Sites:
     print "Site: %(site)s" % { 'site' : site.Name }

On the last line, when it tries to contact the remote server, I get the following error:

Getting the COM factory class for a remote component with CLSID {2B72133B-3F5B-4602-8952-803546CE3344} from the devdealernetsvr machine failed because of the following error: 80070005.

My investigation of the error made me believe that I did not have the proper credentials against the remote machine, and therefore I would like to impersonate the user who does this.

It was hard for me to find a way to do this with IronPython. Any help is greatly appreciated.

+3
1

( , )

, . .: (

, :

  • .
  • IIS ( )
  • ""

!

0

Source: https://habr.com/ru/post/1716599/


All Articles