python - Pyvmomi:vcenter 上的权限被拒绝

标签 python vmware pyvmomi

我正在尝试在 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.

我使用 DOMAIN\USERNAME 作为用户。

或以 root 身份:

Permission to perform this operation was denied.

我在vcenter服务器中添加了一些权限,但显然这还不够:(。

最佳答案

我也遇到了同样的问题,我添加了它有效的端口。 需要添加端口作为参数, 改变这个

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

import ssl
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
context.verify_mode = ssl.CERT_NONE
SmartConnect(host="IP", user="USER", pwd='PWD', port=443, sslContext=context)

关于python - Pyvmomi:vcenter 上的权限被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40471226/

相关文章:

python - 图和轴之间的 Matplotlib 填充

vmware - 使用 VMWare Fusion/服务器替换开发环境中的虚拟 PC/服务器

CentOS 8 Pane 已死 VMware Workstation 15.5

windows-7 - "Cannot find a valid peer process to connect to"启动虚拟机时的 VMware Workstation 10.0.1

python - 使用 pyvmomi 模块从 .vmx 和 .vmdk 文件创建虚拟机

python - 在 Google Colaboratory 上使用 GPU 的 XGBoost

python - 比较列表中整数与给定值的差异

python - Heroku 上的 TCP/IP 套接字