Pyvmomi:对vcen的权限被拒绝

2024-06-11 16:03:54 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试在vcenter server设备上运行Pyvmomi社区示例中的一些示例脚本: https://github.com/vmware/pyvmomi-community-samples

Caught vmodl fault : Permission to perform this operation was denied.

用另一个简单的脚本:

from pyVim.connect import SmartConnect, Disconnect
import ssl

s = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
s.verify_mode = ssl.CERT_NONE

c = SmartConnect(host="IP", user="USER", pwd='PWD', sslContext=s)

datacenter = c.content.rootFolder.childEntity[0]
vms = datacenter.vmFolder.childEntity

for i in vms:
    print(i.name)

Disconnect(c)

如果我使用我的域用户帐户(使用该帐户可以登录vcenter):

Cannot complete login due to an incorrect user name or password.

我使用域\用户名作为用户。在

或作为根目录:

Permission to perform this operation was denied.

我在vcenter server中添加了一些权限,但显然不够:(。在


Tags: toimport脚本ssl示例serverthisoperation