SlideShare a Scribd company logo
Windows 安裝 ptyhon 控制 VMWare API
20210201
Python 是一種跨平台程式語言。
目的:接到一個任務要對 VMware 下 API 接令 ; 而 API 是 python 程式
環境安裝:
1. 安裝 python
網站下載所要的版本 https://www.python.org/downloads/
以版本 3.8.6 為例
https://www.python.org/downloads/release/python-386/
…..就裝完了
試跑 IDLE
2. 安裝 python 需要的 pip
Pip 是 python 安裝套件 模組的功能
https://bootstrap.pypa.io/get-pip.py
下載存檔
執行
點兩下後很快跑完就不見了
3. 安裝 git
VMWARE API 在 github
VMware vSphere Automation SDK for Python
但先需要 git 程式 , 所以先裝 git
https://git-scm.com/download/win
執行…………..一直下一步
Npp 很好用就指定它為預設編輯, 如果沒有 npp 就先裝 npp ( https://notepad-
plus-plus.org/downloads/ )
接著下一步到結束
到 github
https://github.com/vmware/vsphere-automation-sdk-python
開啟 cmd 把以下兩行貼上
pip install --upgrade pip setuptools
pip install --upgrade git+https://github.com/vmware/vsphere-automation-sdk-
python.git
如果 pip 或 python 沒有跑起來 應該是 OS path 沒有自動被加去
自已加路徑或是切到以下路徑
4. 試連 vCenter
開啟 python
貼上以下 [需自行修改 vcenter ip username / password]
import requests
import urllib3
from vmware.vapi.vsphere.client import create_vsphere_client
session = requests.session()
# Disable cert verification for demo purpose.
# This is not recommended in a production environment.
session.verify = False
# Disable the secure connection warning for demo purpose.
# This is not recommended in a production environment.
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
# Connect to a vCenter Server using username and password
vsphere_client = create_vsphere_client(server='192.168.100.101',
username='administrator@vsphere.local', password='P@ssw0rd', session=session)
# List all VMs inside the vCenter Server
vsphere_client.vcenter.VM.list()
vsphere_client.vcenter.VM.list() 會列出現行系統 VM 列表
例:列出 VM FREENAS 資源狀態
client.vcenter.VM.list(client.vcenter.VM.FilterSpec(names={'FREENAS'}))
接著就依自行需要執行 python API
備註:
Python 程序副檔為.py 可以命令列方式行
Windows 環境變數 PATH 如果不在請自行手動加。
http://code.vmware.com/ > API Explorer https://developer.vmware.com/ 有完整
API

More Related Content

What's hot

Ansible-cours .pdf
Ansible-cours .pdfAnsible-cours .pdf
Ansible-cours .pdf
Jaouad Assabbour
 
Présentation Docker
Présentation DockerPrésentation Docker
Présentation Docker
Colin LEVERGER
 
An Introduction to Kubernetes
An Introduction to KubernetesAn Introduction to Kubernetes
An Introduction to Kubernetes
Imesh Gunaratne
 
Tadx - Présentation Conteneurisation
Tadx -  Présentation ConteneurisationTadx -  Présentation Conteneurisation
Tadx - Présentation Conteneurisation
TADx
 
Kubernetes in 30 minutes (2017/03/10)
Kubernetes in 30 minutes (2017/03/10)Kubernetes in 30 minutes (2017/03/10)
Kubernetes in 30 minutes (2017/03/10)
lestrrat
 
Containerization and Docker
Containerization and DockerContainerization and Docker
Containerization and Docker
Megha Bansal
 
Kubernetes: An Introduction to the Open Source Container Orchestration Platform
Kubernetes: An Introduction to the Open Source Container Orchestration PlatformKubernetes: An Introduction to the Open Source Container Orchestration Platform
Kubernetes: An Introduction to the Open Source Container Orchestration Platform
Michael O'Sullivan
 
Room 2 - 3 - Nguyễn Hoài Nam & Nguyễn Việt Hùng - Terraform & Pulumi Comparin...
Room 2 - 3 - Nguyễn Hoài Nam & Nguyễn Việt Hùng - Terraform & Pulumi Comparin...Room 2 - 3 - Nguyễn Hoài Nam & Nguyễn Việt Hùng - Terraform & Pulumi Comparin...
Room 2 - 3 - Nguyễn Hoài Nam & Nguyễn Việt Hùng - Terraform & Pulumi Comparin...
Vietnam Open Infrastructure User Group
 
PROGRAMA-PADRÃO DE INSTRUÇÃO QUALIFICAÇÃO DO CABO E DO SOLDADO CORNETEIRO E C...
PROGRAMA-PADRÃO DE INSTRUÇÃO QUALIFICAÇÃO DO CABO E DO SOLDADO CORNETEIRO E C...PROGRAMA-PADRÃO DE INSTRUÇÃO QUALIFICAÇÃO DO CABO E DO SOLDADO CORNETEIRO E C...
PROGRAMA-PADRÃO DE INSTRUÇÃO QUALIFICAÇÃO DO CABO E DO SOLDADO CORNETEIRO E C...
Falcão Brasil
 
Deploy Application on Kubernetes
Deploy Application on KubernetesDeploy Application on Kubernetes
Deploy Application on Kubernetes
Opsta
 
Linux Internals - Kernel/Core
Linux Internals - Kernel/CoreLinux Internals - Kernel/Core
Linux Internals - Kernel/Core
Shay Cohen
 
OpenStack Quantum Intro (OS Meetup 3-26-12)
OpenStack Quantum Intro (OS Meetup 3-26-12)OpenStack Quantum Intro (OS Meetup 3-26-12)
OpenStack Quantum Intro (OS Meetup 3-26-12)
Dan Wendlandt
 
Kubernetes Basics
Kubernetes BasicsKubernetes Basics
Kubernetes Basics
Rishabh Kumar
 
Install and Configure NGINX Unit, the Universal Application, Web, and Proxy S...
Install and Configure NGINX Unit, the Universal Application, Web, and Proxy S...Install and Configure NGINX Unit, the Universal Application, Web, and Proxy S...
Install and Configure NGINX Unit, the Universal Application, Web, and Proxy S...
NGINX, Inc.
 
An Architectural Deep Dive With Kubernetes And Containers Powerpoint Presenta...
An Architectural Deep Dive With Kubernetes And Containers Powerpoint Presenta...An Architectural Deep Dive With Kubernetes And Containers Powerpoint Presenta...
An Architectural Deep Dive With Kubernetes And Containers Powerpoint Presenta...
SlideTeam
 
Qemu Introduction
Qemu IntroductionQemu Introduction
Qemu Introduction
Chiawei Wang
 
OpenShift Virtualization- Technical Overview.pdf
OpenShift Virtualization- Technical Overview.pdfOpenShift Virtualization- Technical Overview.pdf
OpenShift Virtualization- Technical Overview.pdf
ssuser1490e8
 
HPE SimpliVity 使用PowerShell 控制
HPE SimpliVity 使用PowerShell 控制HPE SimpliVity 使用PowerShell 控制
HPE SimpliVity 使用PowerShell 控制
裝機安 Angelo
 
Achieving the ultimate performance with KVM
Achieving the ultimate performance with KVM Achieving the ultimate performance with KVM
Achieving the ultimate performance with KVM
ShapeBlue
 
Le guide d'administration d'un site sous joomla3
Le guide d'administration d'un site sous joomla3Le guide d'administration d'un site sous joomla3
Le guide d'administration d'un site sous joomla3
Com'3elles - www.com3elles.com
 

What's hot (20)

Ansible-cours .pdf
Ansible-cours .pdfAnsible-cours .pdf
Ansible-cours .pdf
 
Présentation Docker
Présentation DockerPrésentation Docker
Présentation Docker
 
An Introduction to Kubernetes
An Introduction to KubernetesAn Introduction to Kubernetes
An Introduction to Kubernetes
 
Tadx - Présentation Conteneurisation
Tadx -  Présentation ConteneurisationTadx -  Présentation Conteneurisation
Tadx - Présentation Conteneurisation
 
Kubernetes in 30 minutes (2017/03/10)
Kubernetes in 30 minutes (2017/03/10)Kubernetes in 30 minutes (2017/03/10)
Kubernetes in 30 minutes (2017/03/10)
 
Containerization and Docker
Containerization and DockerContainerization and Docker
Containerization and Docker
 
Kubernetes: An Introduction to the Open Source Container Orchestration Platform
Kubernetes: An Introduction to the Open Source Container Orchestration PlatformKubernetes: An Introduction to the Open Source Container Orchestration Platform
Kubernetes: An Introduction to the Open Source Container Orchestration Platform
 
Room 2 - 3 - Nguyễn Hoài Nam & Nguyễn Việt Hùng - Terraform & Pulumi Comparin...
Room 2 - 3 - Nguyễn Hoài Nam & Nguyễn Việt Hùng - Terraform & Pulumi Comparin...Room 2 - 3 - Nguyễn Hoài Nam & Nguyễn Việt Hùng - Terraform & Pulumi Comparin...
Room 2 - 3 - Nguyễn Hoài Nam & Nguyễn Việt Hùng - Terraform & Pulumi Comparin...
 
PROGRAMA-PADRÃO DE INSTRUÇÃO QUALIFICAÇÃO DO CABO E DO SOLDADO CORNETEIRO E C...
PROGRAMA-PADRÃO DE INSTRUÇÃO QUALIFICAÇÃO DO CABO E DO SOLDADO CORNETEIRO E C...PROGRAMA-PADRÃO DE INSTRUÇÃO QUALIFICAÇÃO DO CABO E DO SOLDADO CORNETEIRO E C...
PROGRAMA-PADRÃO DE INSTRUÇÃO QUALIFICAÇÃO DO CABO E DO SOLDADO CORNETEIRO E C...
 
Deploy Application on Kubernetes
Deploy Application on KubernetesDeploy Application on Kubernetes
Deploy Application on Kubernetes
 
Linux Internals - Kernel/Core
Linux Internals - Kernel/CoreLinux Internals - Kernel/Core
Linux Internals - Kernel/Core
 
OpenStack Quantum Intro (OS Meetup 3-26-12)
OpenStack Quantum Intro (OS Meetup 3-26-12)OpenStack Quantum Intro (OS Meetup 3-26-12)
OpenStack Quantum Intro (OS Meetup 3-26-12)
 
Kubernetes Basics
Kubernetes BasicsKubernetes Basics
Kubernetes Basics
 
Install and Configure NGINX Unit, the Universal Application, Web, and Proxy S...
Install and Configure NGINX Unit, the Universal Application, Web, and Proxy S...Install and Configure NGINX Unit, the Universal Application, Web, and Proxy S...
Install and Configure NGINX Unit, the Universal Application, Web, and Proxy S...
 
An Architectural Deep Dive With Kubernetes And Containers Powerpoint Presenta...
An Architectural Deep Dive With Kubernetes And Containers Powerpoint Presenta...An Architectural Deep Dive With Kubernetes And Containers Powerpoint Presenta...
An Architectural Deep Dive With Kubernetes And Containers Powerpoint Presenta...
 
Qemu Introduction
Qemu IntroductionQemu Introduction
Qemu Introduction
 
OpenShift Virtualization- Technical Overview.pdf
OpenShift Virtualization- Technical Overview.pdfOpenShift Virtualization- Technical Overview.pdf
OpenShift Virtualization- Technical Overview.pdf
 
HPE SimpliVity 使用PowerShell 控制
HPE SimpliVity 使用PowerShell 控制HPE SimpliVity 使用PowerShell 控制
HPE SimpliVity 使用PowerShell 控制
 
Achieving the ultimate performance with KVM
Achieving the ultimate performance with KVM Achieving the ultimate performance with KVM
Achieving the ultimate performance with KVM
 
Le guide d'administration d'un site sous joomla3
Le guide d'administration d'un site sous joomla3Le guide d'administration d'un site sous joomla3
Le guide d'administration d'un site sous joomla3
 

Similar to Windows 環境下建構python 跑VMware API

Python meetup 1
Python meetup 1Python meetup 1
Python meetup 1
Vic Yang
 
LineBot.pptx
LineBot.pptxLineBot.pptx
LineBot.pptx
NCUDSC
 
如何幫樹莓派安裝常用的Python套件(How to Install Python Package on Raspberry Pi)
如何幫樹莓派安裝常用的Python套件(How to Install Python Package on Raspberry Pi)如何幫樹莓派安裝常用的Python套件(How to Install Python Package on Raspberry Pi)
如何幫樹莓派安裝常用的Python套件(How to Install Python Package on Raspberry Pi)
Yanwei Liu
 
容器驅動開發 - .NET Conf 2017 @ 台中
容器驅動開發 - .NET Conf 2017 @ 台中容器驅動開發 - .NET Conf 2017 @ 台中
容器驅動開發 - .NET Conf 2017 @ 台中
Andrew Wu
 
Bitbucket pipeline CI
Bitbucket pipeline CIBitbucket pipeline CI
Bitbucket pipeline CI
Zero Huang
 
Using google appengine_final
Using google appengine_finalUsing google appengine_final
Using google appengine_finalWei Sun
 
11132020_python tutor.pdf
11132020_python tutor.pdf11132020_python tutor.pdf
11132020_python tutor.pdf
ssuserc840d7
 
03.python工作环境
03.python工作环境03.python工作环境
03.python工作环境modou li
 
Using google appengine_1027
Using google appengine_1027Using google appengine_1027
Using google appengine_1027Wei Sun
 
Using google appengine (2)
Using google appengine (2)Using google appengine (2)
Using google appengine (2)Wei Sun
 
常用开发工具介绍
常用开发工具介绍常用开发工具介绍
常用开发工具介绍
haozes
 
2020 gops-旷视城市大脑私有云平台实践-刘天伟
2020 gops-旷视城市大脑私有云平台实践-刘天伟2020 gops-旷视城市大脑私有云平台实践-刘天伟
2020 gops-旷视城市大脑私有云平台实践-刘天伟
Tianwei Liu
 
轻量级Flash服务器开发框架(刘恒)
轻量级Flash服务器开发框架(刘恒)轻量级Flash服务器开发框架(刘恒)
轻量级Flash服务器开发框架(刘恒)FLASH开发者交流会
 
自动化运维管理
自动化运维管理自动化运维管理
自动化运维管理frankwsj
 
设置用vim编辑python
设置用vim编辑python设置用vim编辑python
设置用vim编辑pythonKing Hom
 
EOS_2015_Fall Team6 - One to Ten App Design Toolkit
EOS_2015_Fall  Team6 - One to Ten App Design ToolkitEOS_2015_Fall  Team6 - One to Ten App Design Toolkit
EOS_2015_Fall Team6 - One to Ten App Design Toolkit
nctusee
 
腾讯大讲堂58 拍拍app platform中间件解决方案简介
腾讯大讲堂58 拍拍app platform中间件解决方案简介腾讯大讲堂58 拍拍app platform中间件解决方案简介
腾讯大讲堂58 拍拍app platform中间件解决方案简介areyouok
 
Python和web开发
Python和web开发Python和web开发
Python和web开发moonbingbing
 
100902 wm4wps-py-webdev
100902 wm4wps-py-webdev100902 wm4wps-py-webdev
100902 wm4wps-py-webdev
Zoom Quiet
 
如何更新 I puppy 的韌體?
如何更新 I puppy 的韌體?如何更新 I puppy 的韌體?
如何更新 I puppy 的韌體?
臺灣塔米歐
 

Similar to Windows 環境下建構python 跑VMware API (20)

Python meetup 1
Python meetup 1Python meetup 1
Python meetup 1
 
LineBot.pptx
LineBot.pptxLineBot.pptx
LineBot.pptx
 
如何幫樹莓派安裝常用的Python套件(How to Install Python Package on Raspberry Pi)
如何幫樹莓派安裝常用的Python套件(How to Install Python Package on Raspberry Pi)如何幫樹莓派安裝常用的Python套件(How to Install Python Package on Raspberry Pi)
如何幫樹莓派安裝常用的Python套件(How to Install Python Package on Raspberry Pi)
 
容器驅動開發 - .NET Conf 2017 @ 台中
容器驅動開發 - .NET Conf 2017 @ 台中容器驅動開發 - .NET Conf 2017 @ 台中
容器驅動開發 - .NET Conf 2017 @ 台中
 
Bitbucket pipeline CI
Bitbucket pipeline CIBitbucket pipeline CI
Bitbucket pipeline CI
 
Using google appengine_final
Using google appengine_finalUsing google appengine_final
Using google appengine_final
 
11132020_python tutor.pdf
11132020_python tutor.pdf11132020_python tutor.pdf
11132020_python tutor.pdf
 
03.python工作环境
03.python工作环境03.python工作环境
03.python工作环境
 
Using google appengine_1027
Using google appengine_1027Using google appengine_1027
Using google appengine_1027
 
Using google appengine (2)
Using google appengine (2)Using google appengine (2)
Using google appengine (2)
 
常用开发工具介绍
常用开发工具介绍常用开发工具介绍
常用开发工具介绍
 
2020 gops-旷视城市大脑私有云平台实践-刘天伟
2020 gops-旷视城市大脑私有云平台实践-刘天伟2020 gops-旷视城市大脑私有云平台实践-刘天伟
2020 gops-旷视城市大脑私有云平台实践-刘天伟
 
轻量级Flash服务器开发框架(刘恒)
轻量级Flash服务器开发框架(刘恒)轻量级Flash服务器开发框架(刘恒)
轻量级Flash服务器开发框架(刘恒)
 
自动化运维管理
自动化运维管理自动化运维管理
自动化运维管理
 
设置用vim编辑python
设置用vim编辑python设置用vim编辑python
设置用vim编辑python
 
EOS_2015_Fall Team6 - One to Ten App Design Toolkit
EOS_2015_Fall  Team6 - One to Ten App Design ToolkitEOS_2015_Fall  Team6 - One to Ten App Design Toolkit
EOS_2015_Fall Team6 - One to Ten App Design Toolkit
 
腾讯大讲堂58 拍拍app platform中间件解决方案简介
腾讯大讲堂58 拍拍app platform中间件解决方案简介腾讯大讲堂58 拍拍app platform中间件解决方案简介
腾讯大讲堂58 拍拍app platform中间件解决方案简介
 
Python和web开发
Python和web开发Python和web开发
Python和web开发
 
100902 wm4wps-py-webdev
100902 wm4wps-py-webdev100902 wm4wps-py-webdev
100902 wm4wps-py-webdev
 
如何更新 I puppy 的韌體?
如何更新 I puppy 的韌體?如何更新 I puppy 的韌體?
如何更新 I puppy 的韌體?
 

More from 裝機安 Angelo

DELL PowerStore 相關主題中譯本
DELL PowerStore 相關主題中譯本DELL PowerStore 相關主題中譯本
DELL PowerStore 相關主題中譯本
裝機安 Angelo
 
Dell VxRail Dynamic Node 設定記錄-7.0.410.pdf
Dell VxRail Dynamic Node 設定記錄-7.0.410.pdfDell VxRail Dynamic Node 設定記錄-7.0.410.pdf
Dell VxRail Dynamic Node 設定記錄-7.0.410.pdf
裝機安 Angelo
 
【VM保護備份專題】Dell Power Protect Data Manager (PPDM) 詳解TSDM機制
【VM保護備份專題】Dell Power Protect Data Manager (PPDM) 詳解TSDM機制【VM保護備份專題】Dell Power Protect Data Manager (PPDM) 詳解TSDM機制
【VM保護備份專題】Dell Power Protect Data Manager (PPDM) 詳解TSDM機制
裝機安 Angelo
 
Dell AppSync整合與實現應用程式資料複本管理
Dell AppSync整合與實現應用程式資料複本管理Dell AppSync整合與實現應用程式資料複本管理
Dell AppSync整合與實現應用程式資料複本管理
裝機安 Angelo
 
DELL CloudIQ 幫助MIS小克一手掌握IT維運 .docx
DELL CloudIQ 幫助MIS小克一手掌握IT維運 .docxDELL CloudIQ 幫助MIS小克一手掌握IT維運 .docx
DELL CloudIQ 幫助MIS小克一手掌握IT維運 .docx
裝機安 Angelo
 
VxRail_7.0.x_管理員手冊.pdf
VxRail_7.0.x_管理員手冊.pdfVxRail_7.0.x_管理員手冊.pdf
VxRail_7.0.x_管理員手冊.pdf
裝機安 Angelo
 
VxRail_7.0.x_管理員手冊.en.zh-TW.docx
VxRail_7.0.x_管理員手冊.en.zh-TW.docxVxRail_7.0.x_管理員手冊.en.zh-TW.docx
VxRail_7.0.x_管理員手冊.en.zh-TW.docx
裝機安 Angelo
 
Dell EMC PowerStore: PowerStore Manager 概述
Dell EMC PowerStore: PowerStore Manager 概述Dell EMC PowerStore: PowerStore Manager 概述
Dell EMC PowerStore: PowerStore Manager 概述
裝機安 Angelo
 
需求VMWARE架構下就是要建兩邊可以嗎?
需求VMWARE架構下就是要建兩邊可以嗎?需求VMWARE架構下就是要建兩邊可以嗎?
需求VMWARE架構下就是要建兩邊可以嗎?
裝機安 Angelo
 
vSAN7 關機
vSAN7 關機vSAN7 關機
vSAN7 關機
裝機安 Angelo
 
HPE SimpliVity 升級 4.1.0
HPE SimpliVity 升級 4.1.0HPE SimpliVity 升級 4.1.0
HPE SimpliVity 升級 4.1.0
裝機安 Angelo
 
HPE SimpliVity VM保護備份
HPE SimpliVity VM保護備份HPE SimpliVity VM保護備份
HPE SimpliVity VM保護備份
裝機安 Angelo
 
(2021-01).UT-商品-企業-訊息-技EDM-2021-1-Dell EMC RP4VM VM保護備份
(2021-01).UT-商品-企業-訊息-技EDM-2021-1-Dell EMC RP4VM VM保護備份(2021-01).UT-商品-企業-訊息-技EDM-2021-1-Dell EMC RP4VM VM保護備份
(2021-01).UT-商品-企業-訊息-技EDM-2021-1-Dell EMC RP4VM VM保護備份
裝機安 Angelo
 
(2021-03).UT-商品-企業-訊息-技EDM-2021-3-Dell EMC Avamar VM保護備份
(2021-03).UT-商品-企業-訊息-技EDM-2021-3-Dell EMC Avamar VM保護備份(2021-03).UT-商品-企業-訊息-技EDM-2021-3-Dell EMC Avamar VM保護備份
(2021-03).UT-商品-企業-訊息-技EDM-2021-3-Dell EMC Avamar VM保護備份
裝機安 Angelo
 
(2020-02)HPE SimpliVity 安裝設定管理的影片網站
(2020-02)HPE SimpliVity 安裝設定管理的影片網站(2020-02)HPE SimpliVity 安裝設定管理的影片網站
(2020-02)HPE SimpliVity 安裝設定管理的影片網站
裝機安 Angelo
 
(2020-06)HPE SimpliVity 開放資源網站
(2020-06)HPE SimpliVity 開放資源網站(2020-06)HPE SimpliVity 開放資源網站
(2020-06)HPE SimpliVity 開放資源網站
裝機安 Angelo
 
(2020-04)HPE SimpliVity node 關機
(2020-04)HPE SimpliVity node 關機(2020-04)HPE SimpliVity node 關機
(2020-04)HPE SimpliVity node 關機
裝機安 Angelo
 
(2020-01).HPE SimpliVity 如何分享腹內Datastore給現現有的ESXi使用
(2020-01).HPE SimpliVity 如何分享腹內Datastore給現現有的ESXi使用(2020-01).HPE SimpliVity 如何分享腹內Datastore給現現有的ESXi使用
(2020-01).HPE SimpliVity 如何分享腹內Datastore給現現有的ESXi使用
裝機安 Angelo
 
2019-HPE Infosight AI智能雲平台功能解析1-7篇
2019-HPE Infosight AI智能雲平台功能解析1-7篇2019-HPE Infosight AI智能雲平台功能解析1-7篇
2019-HPE Infosight AI智能雲平台功能解析1-7篇
裝機安 Angelo
 
HPE SimpliVity install mgmt guide 201907-01 (Taiwan-Chinese) ;HPE SimpliVity ...
HPE SimpliVity install mgmt guide 201907-01 (Taiwan-Chinese) ;HPE SimpliVity ...HPE SimpliVity install mgmt guide 201907-01 (Taiwan-Chinese) ;HPE SimpliVity ...
HPE SimpliVity install mgmt guide 201907-01 (Taiwan-Chinese) ;HPE SimpliVity ...
裝機安 Angelo
 

More from 裝機安 Angelo (20)

DELL PowerStore 相關主題中譯本
DELL PowerStore 相關主題中譯本DELL PowerStore 相關主題中譯本
DELL PowerStore 相關主題中譯本
 
Dell VxRail Dynamic Node 設定記錄-7.0.410.pdf
Dell VxRail Dynamic Node 設定記錄-7.0.410.pdfDell VxRail Dynamic Node 設定記錄-7.0.410.pdf
Dell VxRail Dynamic Node 設定記錄-7.0.410.pdf
 
【VM保護備份專題】Dell Power Protect Data Manager (PPDM) 詳解TSDM機制
【VM保護備份專題】Dell Power Protect Data Manager (PPDM) 詳解TSDM機制【VM保護備份專題】Dell Power Protect Data Manager (PPDM) 詳解TSDM機制
【VM保護備份專題】Dell Power Protect Data Manager (PPDM) 詳解TSDM機制
 
Dell AppSync整合與實現應用程式資料複本管理
Dell AppSync整合與實現應用程式資料複本管理Dell AppSync整合與實現應用程式資料複本管理
Dell AppSync整合與實現應用程式資料複本管理
 
DELL CloudIQ 幫助MIS小克一手掌握IT維運 .docx
DELL CloudIQ 幫助MIS小克一手掌握IT維運 .docxDELL CloudIQ 幫助MIS小克一手掌握IT維運 .docx
DELL CloudIQ 幫助MIS小克一手掌握IT維運 .docx
 
VxRail_7.0.x_管理員手冊.pdf
VxRail_7.0.x_管理員手冊.pdfVxRail_7.0.x_管理員手冊.pdf
VxRail_7.0.x_管理員手冊.pdf
 
VxRail_7.0.x_管理員手冊.en.zh-TW.docx
VxRail_7.0.x_管理員手冊.en.zh-TW.docxVxRail_7.0.x_管理員手冊.en.zh-TW.docx
VxRail_7.0.x_管理員手冊.en.zh-TW.docx
 
Dell EMC PowerStore: PowerStore Manager 概述
Dell EMC PowerStore: PowerStore Manager 概述Dell EMC PowerStore: PowerStore Manager 概述
Dell EMC PowerStore: PowerStore Manager 概述
 
需求VMWARE架構下就是要建兩邊可以嗎?
需求VMWARE架構下就是要建兩邊可以嗎?需求VMWARE架構下就是要建兩邊可以嗎?
需求VMWARE架構下就是要建兩邊可以嗎?
 
vSAN7 關機
vSAN7 關機vSAN7 關機
vSAN7 關機
 
HPE SimpliVity 升級 4.1.0
HPE SimpliVity 升級 4.1.0HPE SimpliVity 升級 4.1.0
HPE SimpliVity 升級 4.1.0
 
HPE SimpliVity VM保護備份
HPE SimpliVity VM保護備份HPE SimpliVity VM保護備份
HPE SimpliVity VM保護備份
 
(2021-01).UT-商品-企業-訊息-技EDM-2021-1-Dell EMC RP4VM VM保護備份
(2021-01).UT-商品-企業-訊息-技EDM-2021-1-Dell EMC RP4VM VM保護備份(2021-01).UT-商品-企業-訊息-技EDM-2021-1-Dell EMC RP4VM VM保護備份
(2021-01).UT-商品-企業-訊息-技EDM-2021-1-Dell EMC RP4VM VM保護備份
 
(2021-03).UT-商品-企業-訊息-技EDM-2021-3-Dell EMC Avamar VM保護備份
(2021-03).UT-商品-企業-訊息-技EDM-2021-3-Dell EMC Avamar VM保護備份(2021-03).UT-商品-企業-訊息-技EDM-2021-3-Dell EMC Avamar VM保護備份
(2021-03).UT-商品-企業-訊息-技EDM-2021-3-Dell EMC Avamar VM保護備份
 
(2020-02)HPE SimpliVity 安裝設定管理的影片網站
(2020-02)HPE SimpliVity 安裝設定管理的影片網站(2020-02)HPE SimpliVity 安裝設定管理的影片網站
(2020-02)HPE SimpliVity 安裝設定管理的影片網站
 
(2020-06)HPE SimpliVity 開放資源網站
(2020-06)HPE SimpliVity 開放資源網站(2020-06)HPE SimpliVity 開放資源網站
(2020-06)HPE SimpliVity 開放資源網站
 
(2020-04)HPE SimpliVity node 關機
(2020-04)HPE SimpliVity node 關機(2020-04)HPE SimpliVity node 關機
(2020-04)HPE SimpliVity node 關機
 
(2020-01).HPE SimpliVity 如何分享腹內Datastore給現現有的ESXi使用
(2020-01).HPE SimpliVity 如何分享腹內Datastore給現現有的ESXi使用(2020-01).HPE SimpliVity 如何分享腹內Datastore給現現有的ESXi使用
(2020-01).HPE SimpliVity 如何分享腹內Datastore給現現有的ESXi使用
 
2019-HPE Infosight AI智能雲平台功能解析1-7篇
2019-HPE Infosight AI智能雲平台功能解析1-7篇2019-HPE Infosight AI智能雲平台功能解析1-7篇
2019-HPE Infosight AI智能雲平台功能解析1-7篇
 
HPE SimpliVity install mgmt guide 201907-01 (Taiwan-Chinese) ;HPE SimpliVity ...
HPE SimpliVity install mgmt guide 201907-01 (Taiwan-Chinese) ;HPE SimpliVity ...HPE SimpliVity install mgmt guide 201907-01 (Taiwan-Chinese) ;HPE SimpliVity ...
HPE SimpliVity install mgmt guide 201907-01 (Taiwan-Chinese) ;HPE SimpliVity ...
 

Windows 環境下建構python 跑VMware API

  • 1. Windows 安裝 ptyhon 控制 VMWare API 20210201 Python 是一種跨平台程式語言。 目的:接到一個任務要對 VMware 下 API 接令 ; 而 API 是 python 程式 環境安裝: 1. 安裝 python 網站下載所要的版本 https://www.python.org/downloads/
  • 3.
  • 5. 2. 安裝 python 需要的 pip Pip 是 python 安裝套件 模組的功能 https://bootstrap.pypa.io/get-pip.py
  • 7. 點兩下後很快跑完就不見了 3. 安裝 git VMWARE API 在 github VMware vSphere Automation SDK for Python 但先需要 git 程式 , 所以先裝 git https://git-scm.com/download/win
  • 9. Npp 很好用就指定它為預設編輯, 如果沒有 npp 就先裝 npp ( https://notepad- plus-plus.org/downloads/ ) 接著下一步到結束 到 github https://github.com/vmware/vsphere-automation-sdk-python
  • 10. 開啟 cmd 把以下兩行貼上 pip install --upgrade pip setuptools pip install --upgrade git+https://github.com/vmware/vsphere-automation-sdk- python.git
  • 11. 如果 pip 或 python 沒有跑起來 應該是 OS path 沒有自動被加去 自已加路徑或是切到以下路徑
  • 13. 貼上以下 [需自行修改 vcenter ip username / password] import requests import urllib3 from vmware.vapi.vsphere.client import create_vsphere_client session = requests.session() # Disable cert verification for demo purpose. # This is not recommended in a production environment. session.verify = False # Disable the secure connection warning for demo purpose. # This is not recommended in a production environment. urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
  • 14. # Connect to a vCenter Server using username and password vsphere_client = create_vsphere_client(server='192.168.100.101', username='administrator@vsphere.local', password='P@ssw0rd', session=session) # List all VMs inside the vCenter Server vsphere_client.vcenter.VM.list() vsphere_client.vcenter.VM.list() 會列出現行系統 VM 列表
  • 15. 例:列出 VM FREENAS 資源狀態 client.vcenter.VM.list(client.vcenter.VM.FilterSpec(names={'FREENAS'})) 接著就依自行需要執行 python API 備註: Python 程序副檔為.py 可以命令列方式行 Windows 環境變數 PATH 如果不在請自行手動加。 http://code.vmware.com/ > API Explorer https://developer.vmware.com/ 有完整 API