如何使用新VMware vSphere命令行接口vCLI

1. 用fdisk -l 命令查看是否有usb设备,并记下usb设备名(我的是sda1)。

2. 建立usb目录
mkdir /root/usbdisk
3. 在etc/目录里的fstab文件加入下面文字:
/dev/sda1(usb设备名) /root/usbdisk vfat noauto 0 0
4. 重新启动linux系统,插入usb设备后看到有usb的标志在linux窗口右下角出现后,
用命令
mout -t msdos /dev/sda1 /root/usbdisk
5. 用完usb命令后,断开usb设备
unmout /dev/sda1
如何使用新VMware vSphere命令行接口vCLI?
无论你管理哪一种技术——交换机、路由器、Windows服务器还是VMware服务器,你都会想到一点,就是如何通过命令行,甚至脚本,来控制它。

当VMware ESXi发布的时候,并没有可以支持它的命令行接口。

VMware不得不为习惯使用服务控制台的管理员提供一些解决方案以便他们能够更好地使用VMware ESXi。

为了补上这个缺口,VMware创建了它的远程命令行接口(或者叫做Remote CLI)以及虚拟基础架构管理助手(VIMA), 后者包含Remote CLI。

随着VMware vSphere 4的发布,VMware同时发布了VIMA和Remote CLI, 而且它们具有新的名字、新的版本号以及新的功能。

Remote CLI安装在你本地的Windows或者Linux PC上,用于从命令行来管理ESX服务器。

VIMA是一个运行在你的虚拟基础架构之上的虚拟装置。

VIMA包含Remote CLI以及其他一些命令行工具。

现在,我们来聊聊最新版本的Remote CLI,说说它如何下载、安装以及它如何帮助你。

vCLI概览
当VMware在今年五月发布vSphere 4的时候,VMware不仅改变了VIMA的名字和版本,同时还将Remote CLI的名字和版本修改为vSphere命令行接口或者叫做vCLI。

Remote CLI 1.0变成vCLI 4.0(以便与vSphere 4相配合),不仅仅是名字和版本的改变。

现在,vCLI 4.0提供了许多增加的命令、支持IPv6、能够通过vCenter运行resxtop、vicfg-route新的选项,当然,还有与vSphere 4.0的兼容性。

新版本的vCLI 4.0包含在vMA 4.0中。

为什么你一开始就应该使用vCLI呢? 首先,vCLI可以让你通过命令行管理ESXi,除此之外,你别无它法。

它可以让你配置ESXi的功能,而且,没有其他的方法可选。

其次,它可以让你从你的PC来控制ESX和ESXi,可以让你从你的PC通过运行脚本来管理这些vSphere服务器。

再次,你可以在vCenter服务器上通过命令行执行esxtop进行性能监控。

最后,你可以通过命令行实现软件升级。

下载并安装vCLI 4.0
下载和安装vCLI的方法和其他的Windows或者Linux应用程序是一样的;差别在于安装之后。

可以从VMware vCLI站点下载vCLI。

需要注意的是,如果你没有(免费的)VMware网站登录账号,就注册一个,然后才能下载vCLI。

当点击“Download”并接受许可协议之后,你会看到下面截屏所示的页面,在那里你可以下载vCLI,有Windows版本、32位或者64位的Linux版本。

点击图片本身就能放大
我选择下载了46MB大小的Windows安装包。

运行可执行性文件。

vCLI的安装非常典型,基本上一路点击“Next”即可(接受缺省的安装路径)。

即可完成vCLI的安装。

vCLI的安装过程很快就结束了,最后几点“Finish”即可。

从“开始”菜单->“程序”->“VMware“-> vCLI可以找到vCLI。

点击上图中的“Command Prompt“会启动Windows命令行提示符并将你置于vCLI的目录下。

这时,你需要cd到bin目录下,然后你可以使用dir命令了解你可以使用的所有命令,如下图所示。

以esxcfg开头的那些命令将会被废弃,这些命令以后都将以vicfg开头。

坦诚的说,在你阅读本文下一部分之前,有关这些命令,有很多需要了解。

我强烈建议你阅读vCLI命令参考,它覆盖了上图中你看到的所有的命令。

五个很酷的vCLI命令
在上图中,你看到了所有你可以通过vCLI运行的命令。

太多了。

你应该从哪开始呢? 我建议你从下面五个命令开始,我使用这五个命令,认为它们是有用的(而且很酷)。

vihostupdate——从VMware的升级公告给ESX或者ESXi打补丁。

esxcli——存储路径和存储插件管理(可以插拔存储架构)。

vicfg-iscsi——从命令行完成全部的iSCSI SAN配置。

svmotion——将虚拟机从一个存储迁移到另外一个存储。

vifs——用于ESX/ESXi上所有的文件相关操作(比如:dir、mkdir、copy、put、get、move等等)。

对于每一个要运行的命令,你需要指定ESX/ESXi服务器或者vCenter服务器以及你的认证证书。

实际上,如果你阅读了vCLI 的命令参考,你会发现有不止五种方法可以完成这个步骤。

当然,所有以vicfg开头的命令都可以用来从命令行配置存储、网络、安全等等。

记住,esxcfg开头的命令非常有用(如果你想从命令行完成某个配置)。

要想通过命令行访问你的ESX、ESXi和vCenter服务器,我推荐你从这里下载vSphere最新版本的vCLI,并且最好阅读vCLI 命令参考和vCLI发布备忘录。

合集下载

VIC的基本使用流程是什么

VIC的基本使用流程是什么

VIC的基本使用流程是什么简介VIC(Virtual Infrastructure Client)是一款用于管理和监控 VMware vSphere 虚拟化环境的客户端工具。

本文将介绍 VIC 的基本使用流程,帮助用户快速上手。

使用流程1.安装 VIC 客户端–下载 VIC 安装包–双击安装包进行安装–按照安装向导完成安装过程2.连接到 vCenter 服务器–启动 VIC 客户端–在登录界面输入 vCenter 服务器地址、用户名和密码–点击登录按钮3.浏览 vSphere 虚拟化环境–连接成功后,VIC 会展示一个可视化界面,显示 vSphere 虚拟化环境的各项信息–在左侧的导航栏中,可以浏览虚拟机、主机、数据存储和网络等资源–点击相应的资源,可以查看其详细信息和配置4.虚拟机管理–在 VIC 中,可以对虚拟机进行创建、克隆、删除等操作–选择虚拟机资源,点击右键,在弹出的菜单中选择相应的操作–根据提示完成操作步骤5.主机管理–在 VIC 中,可以对主机进行添加、移除和配置等操作–选择主机资源,点击右键,在弹出的菜单中选择相应的操作–根据提示完成操作步骤6.数据存储管理–在 VIC 中,可以对数据存储进行添加、移除和配置等操作–选择数据存储资源,点击右键,在弹出的菜单中选择相应的操作–根据提示完成操作步骤7.网络管理–在 VIC 中,可以对网络进行添加、删除和配置等操作–选择网络资源,点击右键,在弹出的菜单中选择相应的操作–根据提示完成操作步骤8.性能监控–VIC 提供丰富的性能监控工具,可以实时监测虚拟机和主机的性能指标–在 VIC 中,选择相应的虚拟机或主机资源,在监控选项卡中查看性能监控信息9.报告生成–VIC 提供各种报告生成工具,可以帮助用户分析虚拟化环境的运行情况和性能状况–在 VIC 中,选择相应的虚拟化环境资源,在报告选项卡中生成和查看报告10.断开连接–在 VIC 客户端界面,点击。

(完整版)VMwareVSAN配置手册

(完整版)VMwareVSAN配置手册

VSAN配置手册1.配置前的基本准备工作1.1.手动将磁盘标记为SSD磁盘在某些情况下,当在RAID配置中将一个SSD配置为RAID-0模式后,vSphere只将这个磁盘当作一个普通的HDD盘,而不能将它正确地识别为SSD盘。

出现这种情况的时候,就需要通过命令行方式手动将这个磁盘标记为“SSD”盘。

首先,登录到vSphere的控制台,在菜单中选择‘TroubleShooting Options’:然后,敲回车键,分别启用“Shell”和“SSH”.这个时候,就可以通过SSH连接到这台ESXi主机。

# ssh ***********.x.x成功登录以后,运行以下命令。

# esxcli storage core device list以上这个命令将会列出这台ESXi主机上的所有磁盘列表,将SSD盘找出来,并且将这个SSD盘的ID复制下来,后面会用到。

(一般来说,SSD盘的容量比普通硬盘小很多,所以可以根据容量轻易地将SSD盘找出来。

)然后,运行以下命令,将命令中的ID(红色部分)替换成刚刚复制下来的ID。

# esxcli storage nmp satp rule add -s VMW_SATP_LOCAL -dnaa.6b8ca3a0e81e03001a4e539c08862b30 -o enable_ssd# esxcli storage core claiming reclaim -dnaa.6b8ca3a0e81e03001a4e539c08862b30下面这个命令可以验证SSD盘是否已经被成功地标记成”SSD”了:# esxcli storage core device list -d naa.6b8ca3a0e81e03001a4e539c08862b30 1.2.为vCenter, vSphere, VSAN添加许可证在vCenter网页客户端里,依次点击主页->主机和群集,然后选择vCenter 目录,再选管理->设置->许可,点“分配许可证密钥”:在新窗口里,选择“分配新的许可证密钥”,输入新密钥后,依次点击解码->确定。

PowerCLI安装及使用

PowerCLI安装及使用

PowerCLI安装及使用vSphere PowerCLI试用(一):安装PowerCLIPowerCLI是VMware中的一款命令行管理工具。

一般管理VMware都使用vSphrere Client或者vSphere Web Client,vSphere PowerCLI则可以通过命令行来管理VMware vSphere主机或者是VMware vCenter。

(PowerCLI各版本下载,百度云、360云盘(提取码:46ab)),下载清单:1、VMware-PowerCLI-5.0.0-435426.exe2、VMware-PowerCLI-5.0.1-1992769.exe3、VMware-PowerCLI-5.1.0-793510.exe4、VMware-PowerCLI-5.1.0-1926866.exe5、VMware-PowerCLI-5.5.0-1295336.exe6、VMware-PowerCLI-5.5.0-1931983.exe7、VMware-PowerCLI-5.8.0-2057893.exe从官方主页上查看,目前的最新版本为5.8R1,下载VMware-PowerCLI-5.8.0-2057893.exe 后将其复制到需要安装的服务器上。

PowerCLI可以安装在vCenter上,也可以是其它服务器,这里选择第二种。

双击安装文件后开始安装,会先安装VIX和相关插件,如下图接着开始安装PowerCLI,如下图。

安装完成后,桌面上会多出两个图标,运行VMware vSphere PowerCLI在首次运行时可能会出错,如下图,使用get-executionpolicy查看状态确实为Restricted使用set-executionpolicy将属性从Restricted更改为remotesigned,如下图,完成后,将此窗口关闭再次启动后,就可以看到正常的界面了,如下图。

VMwarevSphereClient使用文档

VMwarevSphereClient使用文档

VMwarevSphereClient使用文档
VMware vSphere Client应用文档
1.创建虚拟机主服务器
首先运行VMware vSphere Client软件
点击主机和群集
选择所要创建虚拟机的主机
右键选择新建虚拟机
选择典型配置
下一步
填写所要创建虚拟机的名称及选择清单位置
选择安装系统所在的存储设备
选择要在虚拟机中安装的系统类型
为虚拟机分配磁盘空间
完成
选择刚创建的虚拟机
在右侧选择编辑虚拟机设置
调整内存及CPU置虚拟机所需移除无用设备
添加硬盘(群集所需)
选择创建新的虚拟磁盘
选择所需的磁盘大小,注意磁盘配置要选上:支持群集功能,如容错
选择虚拟设配节点(因为要为集群做配置,所以需要令起一个磁盘通道)scsi(1:0)
完成一块硬盘的配置
选择新的SCSI控制器,将其SCSI总线选择为:虚拟
确定完成(一般windows2003群集需3块物理磁盘,所以,依照以上步骤再依次建立磁盘。

磁盘大小:仲裁盘一般为1G,dtc一般为2G,共享磁盘根据所需创建)
2.创建虚拟机副服务器
步骤同于虚拟机主机创建,但在单独创建磁盘时,需选择使用现有磁盘,调用主服务器的磁盘来应用
浏览存储磁盘,找到主服务器所在目录,添加磁盘
同样需要更改新建SCSI控制器的SCSI总线共享设置,调整为:虚拟查看各服务器SCSI控制器的控制器类型,将控制类型更改为并行模式。

VMware-vSphere配置使用手册

VMware-vSphere配置使用手册

vSphere配置使用手册关于本文档文档信息文档名称 vSphere配置手册作者 VMWARE说明 vSphere安装部署实施编写。

修订历史Rev Section Type Date Author Remarks1.0 VMWARE 新文档目录1.配置EXSI主机 (4)2.配置vCenter Server (5)2.1新建数据中心以及群集 (5)2.2添加ESXi主机到vCenter (10)2.3配置存储 (11)2.4配置网络 (13)2.4.1创建VMkernel网络交换机 (13)2.4.2创建虚拟网络交换机 (14)2.4.3添加适配器到交换机 (15)2.4.4添加VMkernel网络到交换机 (16)2.4.5添加虚拟网络到交换机 (18)2.4.6配置VMOTION网络 (19)2.4.7配置HA网络 (21)2.5配置NTP时间同步 (23)2.6配置邮件服务 (24)2.7配置告警邮件通知 (25)2.8创建新的角色 (28)2.9添加权限 (29)3.虚拟机管理 (32)3.1创建虚拟机 (32)3.2安装客户机操作系统 (34)3.3安装VMWARE TOOLS (34)3.4克隆虚拟机转换为模板 (35)3.5从模板部署虚拟机 (36)3.6虚拟机的迁移 (38)3.7修改虚拟机的资源配置 (38)3.8虚拟机随ESXI主机一起启停 (39)1.配置EXSI主机如果文字说明与图片说明不相符,请以文字说明为准。

1.设置主机root密码选择“Configure Password”2.输入root新的密码,然后按Enter键3.接下来,选择“configure the management network”,设置一个静态的IP管理地址按Enter键4.确保在网络适配器配置里,你所需的网络适配器右侧窗口中显示。

如果不是,按Enter键,然后选择正确的适配器5.选择“IP Configuration”按Enter键6.选择“Set static IP address and network configuration”设置IP地址,子网掩码和默认网关,然后按Enter键7.接下来,通过选择“DNS Configuration”配置DNS按Enter键8. 选择“Use the following DNS server addresses and hostname”,提供一个主要和备用(如果需要)的DNS服务器地址和主机名,然后按Enter键。

VMwareESXi6.0命令行操作教程

VMwareESXi6.0命令行操作教程

VMware ESXi 6.0命令行操作教程VMware服务器开启命令行模式步骤:1、用vSphere Client客户端登录VMware Esxi 6.0服务器;2、点击VMware Esxi 6.0服务器根目录;3、选择VMware Esxi 6.0服务器根目录—>“配置”标签;4、“配置”标签—>“安全配置文件”—>“防火墙”—>“属性”—>“勾选”安全SSH客户端和SSH服务器两个选项。

5、“配置”标签—>“安全配置文件”—>“服务”—>“属性”—>“远程访问”—>“启动ESXi shell和SSH”两个服务器。

6、使用Xshell 5.0工具进行命令行远程登录访问控制VMware ESXi 6.0服务器。

VMware服务器命令行使用操作释义:1、VMware服务器关机命令:命令:[root@VMSRC:~] poweroff2、VMware服务器重启命令:命令:[root@VMSRC:~] reboot3、VMware服务器版本查看命令:命令:[root@VMSRC:~]vmware -v示例:VMware ESXi 6.0.0 build-28092094、VMware服务器系统版本包括PATCH等信息查看命令:命令:[root@VMSRC:~]esxcli system version get示例:Product: VMware ESXiVersion: 6.0.0Build: Releasebuild-3620759Update: 25、VMware服务器系统时间查看命令:命令:[root@VMSRC:~] esxcli system time get示例:2017-06-11T09:41:57Z6、VMware服务器系统时间修改设置命令:命令:[root@VMSRC:~]esxcli system time set-y=2017 #修改年份命令:[root@VMSRC:~]esxcli system time set-M=6 #修改月份(注意命令大小写)命令:[root@VMSRC:~]esxcli system time set-d=6 #修改日期命令:[root@VMSRC:~]esxcli system time set-H=6 #修改小时(注意命令大小写)命令:[root@VMSRC:~]esxcli system time set-m=6 #修改分钟命令:[root@VMSRC:~]esxcli system time set-s=6 #修改秒钟命令:[root@VMSRC:~]esxcli system time set -y=2016 -M=9 -d=13 -H=10 -m=9 (注意红色字体)命令选项:-d|--day=<long> Day-H|--hour=<long> Hour-m|--min=<long> Minute-M|--month=<long> Month-s|--sec=<long> Second-y|--year=<long> Year7、VMware服务器维护模式管理命令:命令:[root@VMSRC:~]esxcli system maintenanceMode set --enable true #进入维护模式命令:[root@VMSRC:~]esxcli system maintenanceMode get #查看维护模式状态示例:Enabled #启用状态命令:[root@VMSRC:~]esxcli system maintenanceMode set --enable false #退出维护模式命令:[root@VMSRC:~]esxcli system maintenanceMode get #查看维护模式状态Disabled #关闭状态8、VMware服务器网络地址查看命令:命令:[root@VMSRC:~] esxcli network ip interface ipv4 get #查看IPV4网络地址示例:Name IPv4 Address IPv4 Netmask IPv4 Broadcast Address Type DHCP DNS---- ------------ ------------- -------------- ------------ --------vmk0 10.10.10.20 255.255.255.0 10.10.10.255 STATIC false9、VMware服务器路由表查看命令:命令:[root@VMSRC:~] esxcli network ip route ipv4 list #查看路由表示例:Network Netmask Gateway Interface Source---------- ------------- ----------- --------- ------default 0.0.0.0 10.10.10.10 vmk0 MANUAL10.10.10.0 255.255.255.0 0.0.0.0 vmk0 MANUAL10、VMware服务器网络适配器信息查看命令:命令:[root@VMSRC:~] esxcli network nic list #查看网络适配器列表信息示例:Name PCI Device Driver Admin Status Link Status Speed Duplex MAC Address MTU Description------ ------------ ------ ------------ ----------- ----- ------ ----------------- ---- --------------------vmnic0 0000:00:19.0 e1000e Up Up 100 Full08:62:66:4a:f5:10 1500 Intel Corporation Ethernet Connection I217-V11、VMware服务器网络适配器管理命令:命令:[root@VMSRC:~]esxcli network nic down -n=vmnic0 #关闭序号0网络适配器命令:[root@VMSRC:~]esxcli network nic up -n=vmnic0 #开启序号0网络适配器12、VMware服务器磁盘信息查看命令:命令:[root@VMSRC:~] esxcli storage core device list示例:t10.ATA_____ST3000VX0062D1HH166__________________________________W6A0PFTN Display Name: Local ATA Disk(t10.ATA_____ST3000VX0062D1HH166__________________________________W6A0PFTN) Has Settable Display Name: trueSize: 2861588Device Type: Direct-AccessMultipath Plugin: NMPDevfs Path:/vmfs/devices/disks/t10.ATA_____ST3000VX0062D1HH166_______________________________ ___W6A0PFTNVendor: ATAModel: ST3000VX006-1HH1Revision: CV11SCSI Level: 5Is Pseudo: falseStatus: onIs RDM Capable: falseIs Local: trueIs Removable: falseIs SSD: falseIs VVOL PE: falseIs Offline: falseIs Perennially Reserved: falseQueue Full Sample Size: 0Queue Full Threshold: 0Thin Provisioning Status: unknownAttached Filters:VAAI Status: unknownOther UIDs:vml.0100000000202020202020202020202020573641305046544e535433303030 Is Shared Clusterwide: falseIs Local SAS Device: falseIs SAS: falseIs USB: falseIs Boot USB Device: falseIs Boot Device: trueDevice Max Queue Depth: 31No of outstanding IOs with competing worlds: 32Drive Type: unknownRAID Level: unknownNumber of Physical Drives: unknownProtection Enabled: falsePI Activated: falsePI Type: 0PI Protection Mask: NO PROTECTIONSupported Guard Types: NO GUARD SUPPORTDIX Enabled: falseDIX Guard Type: NO GUARD SUPPORTEmulated DIX/DIF Enabled: false13、VMware服务器虚拟机管理命令:命令:[root@VMSRC:~] vim-cmd vmsvc/getallvms |grep #查看虚拟机信息BusyBox v1.20.2 (2014-08-27 12:48:18 PDT) multi-call binary.Usage: grep [-HhnlLoqvsriwFEz] [-m N] [-A/B/C N] PATTERN/-e PATTERN.../-f FILE [FILE]... Search for PATTERN in FILEs (or stdin)命令选项:-H Add 'filename:' prefix #附加虚拟机名称前缀,模糊查询。

vsphere update manager powercli VUM命令行指南

VMware vSphere Update Manager PowerCLI Installation andAdministration GuideUpdate Manager PowerCLI 5.5EN-001295-00VMware vSphere Update Manager PowerCLI Installation and Administration GuideYou can find the most up-to-date technical documentation on the VMware Web site at:/support/The VMware Web site also provides the latest product updates.If you have comments about this documentation, submit your feedback to:docfeedback@Copyright © 1998–2013 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at/go/patents.VMware is a registered trademark or trademark of VMware,Inc. in the United States and/or other jurisdictions. All other marks and names mentioned herein may be trademarks of their respective companies.VMware,Inc.3401 Hillview Ave.Palo Alto, CA 94304ContentsAbout This Book5Installing and Using Update Manager PowerCLI7 Installing Update Manager PowerCLI7Supported Platforms7Prerequisites8Install Update Manager PowerCLI8Uninstalling Update Manager PowerCLI8Using Update Manager PowerCLI8Getting Started with Update Manager PowerCLI8Connecting to a vCenter Server9Examples of Usage of Update Manager PowerCLI Cmdlets9Creating Patch Baselines9Attaching and Detaching Baselines9Scanning a Virtual Machine10Staging Patches10Remediating Inventory Objects11Downloading Patches and Scanning Objects12VMware vSphere Update Manager PowerCLI Installation and Administration GuideAbout This BookThe VMware vSphere Update Manager PowerCLI Installation and Administration Guide, provides informationabout installing and using the Update Manager PowerCLI. The Update Manager PowerCLI contains cmdlets for managing software patches and baselines, and scanning and remediating virtual machines and hosts. Intended AudienceThis book is intended for administrators who need to install and use Update Manager PowerCLI.N OTE All Update Manager PowerCLI users are expected to be familiar with the VMware vSphere PowerCLI cmdlets, VMware vSphere administration, VMware vSphere Update Manager, and the Windows operating system. For more information about the functionality of Update Manager, see the Update ManagerAdministration Guide.VMware Technical Publications GlossaryVMware Technical Publications provides a glossary of terms that might be unfamiliar to you. For definitions of terms as they are used in VMware technical documentation go to /support/pubs. Document FeedbackVMware welcomes your suggestions for improving our documentation. If you have comments, send your feedback to docfeedback@.Technical Support and Education ResourcesThe following sections describe the technical support resources available to you. To access the current version of this book and other books, go to /support/pubs.Online and Telephone SupportTo use online support to submit technical support requests, view your product and contract information, and register your products, go to /support.Customers with appropriate support contracts should use telephone support for the fastest response onpriority 1 issues. Go to /support/phone_support.html.Support OfferingsTo find out how VMware support offerings can help meet your business needs, go to/support/services.VMware vSphere Update Manager PowerCLI Installation and Administration GuideVMware Professional ServicesVMware Education Services courses offer extensive hands-on labs, case study examples, and course materials designed to be used as on-the-job reference tools. Courses are available onsite, in the classroom, and liveonline. For onsite pilot programs and implementation best practices, VMware Consulting Services provides offerings to help you assess, plan, build, and manage your virtual environment. To access information about education classes, certification programs, and consulting services, go to /services.Installing and Using Update ManagerPowerCLIThe VMware vSphere Update Manager PowerCLI provides a set of cmdlets for downloading softwarepatches, creating and modifying baselines, and for scanning and remediating virtual machines or hosts. These cmdlets are stored in the VMware.VumAutomation plug-in, and are available through the VMware vSphere PowerCLI console.The chapter includes the following topics:⏹“Installing Update Manager PowerCLI” on page7⏹“Using Update Manager PowerCLI” on page8Installing Update Manager PowerCLIYou can install and use Update Manager PowerCLI on machines that have VMware vSphere PowerCLIinstalled and have access to a vCenter Server system. You can install Update Manager PowerCLI on a machine that does not have Update Manager or vCenter Server installed.This section provides information about the following topics:⏹“Supported Platforms” on page7⏹“Prerequisites” on page8⏹“Install Update Manager PowerCLI” on page8⏹“Uninstalling Update Manager PowerCLI” on page8N OTE To install Update Manager PowerCLI, you must have vSphere PowerCLI installed on the targetmachine. To obtain the vSphere PowerCLI package, go to the vSphere PowerCLI download page.Supported PlatformsUpdate Manager PowerCLI 5.5 is supported on the 32-bit and 64-bit versions of the following Windowsoperating systems:⏹Windows 7⏹Windows Server 2008⏹Windows Vista⏹Windows XP Service Pack 2⏹Windows Server 2003 Service Pack 2VMware vSphere Update Manager PowerCLI Installation and Administration GuidePrerequisitesTo install and use Update Manager PowerCLI 5.5, you must have the following software installed on the target machine:⏹.NET 2.0 SP1⏹Windows PowerShell 2.0⏹VMware vSphere PowerCLI 4.1 or laterN OTE Update Manager PowerCLI 5.5 works only with Update Manager 5.5.Install Update Manager PowerCLIYou can download the Update Manager PowerCLI installer package from the product landing page.N OTE Update Manager PowerCLI is installed in the same location as PowerCLI. You cannot install Update Manager PowerCLI in a custom location.To install the Update Manager PowerCLI1Start the Update Manager PowerCLI installer.2Click Next in the Welcome page to continue with the installation.3Read and accept the license agreement terms.4Click Install.5Click Finish to complete the installation process.Uninstalling Update Manager PowerCLITo uninstall the Update Manager PowerCLI from your Windows system, you can use the Add or Remove Programs utility.Using Update Manager PowerCLIThis section explores the basics of the Update Manager PowerCLI cmdlets usage. It discusses the following topics:⏹“Getting Started with Update Manager PowerCLI” on page8⏹“Examples of Usage of Update Manager PowerCLI Cmdlets” on page9Getting Started with Update Manager PowerCLITo get started with Update Manager PowerCLI, open the vSphere PowerCLI console from the Windows Start menu or by clicking the vSphere PowerCLI shortcut icon.You can get a list of all Update Manager PowerCLI cmdlets by running the Get-Command command with the -PSSnapin parameter:Get-Command -PSSnapin VMware.VumAutomationN OTE You can check the Update Manager PowerCLI version by running the following command:Get-PowerCLIVersionTo find information on a specific cmdlet, run the Get-Help cmdlet with the cmdlet name. For example:Get-Help Get-PatchInstalling and Using Update Manager PowerCLIConnecting to a vCenter ServerConnect to a vCenter Server that has a Update Manager server installed on it.To connect to a vCenter Server1Run Connect-VIServer and provide the server DNS or IP address:Connect-VIServer 10.23.112.2342When prompted, provide a user name and password to authenticate.Examples of Usage of Update Manager PowerCLI CmdletsThe following examples demonstrate the basic usage of the Update Manager PowerCLI cmdlets. The examples contain vSphere PowerCLI cmdlets for retrieving and managing vSphere objects. To implement the examples’ code, you must have an existing vSphere infrastructure.Creating Patch BaselinesPatch baselines can be applied to hosts. Depending on the patch criteria you select, patch baselines can be either dynamic or fixed (static). Patch data in dynamic baselines changes depending on the criteria you specify each time Update Manager downloads new patches. Fixed baselines contain only the patches you have selected, regardless of new patch downloads.To create patch baselines1Retrieve all host patches released after 1st January 2009 for ESX products, and create a fixed baseline named Static Baseline, containing the retrieved patches:$patches = Get-Patch -After "1 Jan 2009" -Product “ESX*”$staticBaseline = New-PatchBaseline -Static -Name "Static Baseline" -IncludePatch $patches 2Create a critical dynamic baseline named Dynamic Baseline by using a fetch-all query: $criticalPatchBaseline = New-PatchBaseline -Dynamic -Name "Dynamic Baseline"-SearchPatchSeverity Critical3Create an extension baseline that contains all available extensions:$extensions = Get-Patch -BundleType ExtensionNew-PatchBaseline -Static -Name "Extension Baseline" -Extension -IncludePatch $extensionsAttaching and Detaching BaselinesAttach baselines to individual objects and to container objects, such as folders, hosts, clusters, and datacenters.Attaching a baseline to a container object transitively attaches the baseline to all objects in the container.To attach and detach baselines1Attach the host patch baselines stored in the provided variables to the host named Host: Attach-Baseline -Baseline $staticBaseline, $criticalPatchBaseline -Entity Host 2Detach the two baselines from the host:Detach-Baseline -Baseline $dynamicBaseline, $staticBaseline -Entity HostVMware vSphere Update Manager PowerCLI Installation and Administration GuideScanning a Virtual MachineScan a virtual machine against the baselines attached to it or inherited by its parent object.To create a task for scanning a virtual machine1Initialize scanning on a virtual machine named VM against baselines containing virtual machine hardware upgrades and VMware Tools upgrades:$task = Scan-Inventory -Entity VM -UpdateType VmHardwareUpgrade, VmToolsUpgrade -RunAsyncThe command initializes a task on the server, returns a snapshot object of the initial state of the task, andsaves it in the $task variable.2View the initial status of the scanning task:$taskN OTE The task object is not updated with the actual state of the task process running on the server. Evenafter the task is completed, the $task variable value is running. To view the actual status of the tasksrunning on the server, use the Get-Task cmdlet.3(Optional) Run the Wait-Task cmdlet to watch online the process progress and wait for the task to complete before running other commands:Wait-Task -Task $taskTo verify whether a virtual machine has at least one baseline with Unknown compliance statusattached to it and start a scan1Retrieve the compliance statuses with the value Unknown for the baselines attached to the VM virtual machine and store them in a variable:$statuses = Get-Compliance -Entity VM -ComplianceStatus Unknown2Verify whether the virtual machine has at least one baseline with Unknown compliance status attached to it and start a scan:if ($statuses.Count -gt 0) {Scan-Inventory -Entity VM -RunAsync"}Staging PatchesStaging allows you to download patches and extensions from the Update Manager server to the ESX/ESXihosts, without applying the patches and extensions immediately.To stage patches for a virtual machine host1Retrieve a host and assign it to a variable:$host = Get-VMHost -Name 10.23.112.2332Stage the patches for upgrading the host:Stage-Patch -Entity $hostN OTE Staging can be performed only for hosts, clusters, and datacenters.Installing and Using Update Manager PowerCLIRemediating Inventory ObjectsYou can remediate virtual machines, virtual appliances, clusters, and hosts.To remediate a virtual machine1Retrieve all baselines attached to the VM virtual machine:$baselines = Get-Baseline –Entity VM2Remediate the virtual machine:Remediate-Inventory –Entity VM –Baseline $baselinesTo upgrade virtual machine hardware and VMware Tools for all virtual machines in a datacenter1Retrieve all virtual machines in the Datacenter datacenter:$vms = Get-VM -Location Datacenter2Retrieve all virtual machine upgrade baselines:$ugradeBaselines = Get-Baseline -TargetType VM -BaselineType Upgrade3Remediate the all virtual machines against the virtual machine upgrade baselines:foreach ($vm in $vms) {Remediate-Inventory -Entity $vm -Baseline $upgradeBaselines}To remediate a cluster1Retrieve all baselines attached to the Cluster cluster:$baselines = Get-Baseline –Entity Cluster2Remediate the cluster:Remediate-Inventory –Entity Cluster –Baseline $baselines-ClusterDisableDistributedPowerManagement –ClusterDisableHighAvailability-ClusterDiabelFaultToleranceN OTE Before remediation, you must temporarily disable the Distributed Power Management (DPM), High Availability (HA) admission control, and Fault Tolerance (FT) features of the clusters you want to remediate.After remediation, Update Manager automatically re-enables the disabled features.To remediate a host1Retrieve all baselines attached to the Host host:$baselines = Get-Baseline –Entity Host2Remediate the host:Remediate-Inventory –Entity Host –Baseline $baselines –HostFailureAction Retry–HostNumberOfRetries 2 -HostDisableMediaDevices $trueN OTE When remediating a host, you can configure the maintenance mode settings. You can temporarilydisable any removable media devices that might prevent the host from entering maintenance mode as well. VMware, Inc.11VMware vSphere Update Manager PowerCLI Installation and Administration GuideDownloading Patches and Scanning ObjectsYou can download patches from previously defined location.To start a scan for all entities in a datacenter if new patches are downloaded1Retrieve all entities in the Datacenter datacenter and save the result in a variable:$entities = Get-Inventory -Location Datacenter2Download all available patches and save the result in a variable:$result = Download-Patch3Check if new patches are downloaded and start scanning the entities in Datacenter:if ($result.Count > 0) {Scan-Inventory -Entity $entities}12VMware, Inc.。

【转】VMwareCLI命令参考

【转】VMwareCLI命令参考VMwareCLI命令参考基本命令范例123 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41vmware -v# 看你的esx版本VMware ESXi 5.0.0 build-469512esxcfg-info -a # 显⽰所有ESX相关信息esxcfg-info -w # 显⽰esx上硬件信息service mgmt-vmware restart # 重新启动vmware服务esxcfg-vmknic -l # 查看宿主机IP地址esxcli hardware cpu list # cpu信息 Brand,Core Speed,esxcli hardware cpu global get # cpu信息(CPU Cores)esxcli hardware memory get # 内存信息内存 Physical Memoryesxcli hardware platform get # 硬件型号,供应商等信息,主机型号,Product Name 供应商,Vendor Nameesxcli hardware clock get # 当前时间esxcli system version get # 查看ESXi主机版本号和build号esxcli system maintenanceMode set--enable yes# 将ESXi主机进⼊到维护模式esxcli system maintenanceMode set--enable no # 将ESXi主机退出维护模式esxcli system settings advanced list -d # 列出ESXi主机上被改动过的⾼级设定选项esxcli system settings kernel list -d # 列出ESXi主机上被变动过的kernel设定部分esxcli system snmp get | hash| set| test# 列出、测试和更改SNMP设定esxcli vm process list # 利⽤esxcli列出ESXi服务器上VMs的World I(运⾏状态的)esxcli vm process kill-t soft -w WorldI # 利⽤esxcli命令杀掉VMvim-cmd hostsvc/hostsummary# 查看宿主机摘要信息vim-cmd vmsvc/get.datastores # 查看宿主存储空间信息vim-cmd vmsvc/getallvms# 列出所有虚拟机vim-cmd vmsvc/power.getstate VMI # 查看指定VMI虚拟状态vim-cmd vmsvc/power.shutdown VMI # 关闭虚拟机vim-cmd vmsvc/power.off VMI # 如果虚拟机没有关闭,使⽤poweroff命令vim-cmd vmsvc/get.config VMI # 查看虚拟机配置信息esxcli software vib install-d /vmfs/volumes/datastore/patches/xxx.zip # 为ESXi主机安装更新补丁和驱动esxcli network nic list # 列出当前ESXi主机上所有NICs的状态esxcli network vm list # 列出虚拟机的⽹路信息esxcli storage nmp device list # 理出当前NMP管理下的设备satp和psp信息esxcli storage core device vaai status get # 列出注册到PS设备的VI状态esxcli storage nmp satp set--default-psp VMW_PSP_RR --satp xxxx # 利⽤esxcli命令将缺省psp改成Round Robinesxcli信息查询esxcli命令帮助信息ssh登录VMware ESX server控制台,⽤esxcli命令查询虚拟机信息,输出格式⽀持普通、xml、csv、keyvalue。

vmware命令行

vmware命令⾏VMware vSphere PowerCLI 是⼀款功能强⼤的命令⾏⼯具,可⾃动执⾏ vSphere 的各⽅⾯管理,包括主机、⽹络、存储、虚拟机、客户操作系统等等打开打开的⽅法第⼀种1.直接在ESXi控制台界⾯上按住ALT+F1也能进⼊2.把ESXi的SSH功能开开,然后⽤⼯具连接⾏了,root/password。

选择esxi主机----配置--(软件)安全配置-----(安全配置⽂件)属性---(ssh)选项打开后远程root 密码链接即可。

常⽤命令主机信息查询vmware -v 查询系统版本esxcli system version get 查询系统信息esxcli system time get 查询时间esxcli system time set -y=2016 -M=9 -d=13 -H=10 -m=9esxcli system maintenanceMode set --enable true/false 进⼊/退出维护模式esxcli system maintenanceMode get 查询维护模式esxcli system shutdown reboot/poweroff 关机/重启/断电⽹络信息查询esxcli network ip interface ipv4 get 查询ipesxcli network ip route ipv4 list 查询路由表esxcli network nic list 查询⽹卡 up/down 信息esxcli network nic down/up -n=vmnic1 关闭/打开⼀个⽹卡 -n=指定⽹卡磁盘信息esxcli storage core device list 查看磁盘列表利⽤vshpere powercli 管理vcenter安装powe rcli ( windows)安装过程:1、下载VMWare.PowerCLI Save-Module -Name VMware.PowerCLI #执⾏后,会提⽰要输⼊path,它的⽬的是询问你将powercli软件下载到哪2、安装install-module VMware.PowerCLI3、导⼊模块Import-Module VMware.VimAutomation.Core4 设置powercli的证书机制为ignore。

vSphere基本使用手册

VMware vSphere管理员手册使用VI Client管理vSphere使用浏览器访http://<10.201.29.10>,如果网页不能正确显示,请添加到受信任网站。

点击Download VMware Infrastructure client, 下载VI Client并安装运行VI Client使用VI Client连接vCenter服务器-输入vCenter服务器机器名或者IP地址(10.201.29.10)-用户名为administrator-密码为password。

点击login 登陆点击Ignore,忽略服务器证书创建虚拟机右击Cluster或ESX服务器,选择New Virtual Machine选择Typical,点击下一步。

输入虚拟机名称,点击下一步,选择虚拟机物理位置选择Guest 操作系统类型选择vCPU数量选择内存容量,点击下一步。

选择网卡数量和连接的网络端口组,点击下一步。

选择磁盘容量,点击下一步直到完成。

安装操作系统右击新建的虚拟机,选择Edit Setting配置虚拟机CD驱动器Client Device――将VI Client机器光驱和光盘镜像文件通过网络映射到虚拟机Host Device――直接使用虚拟机运行的ESX服务器光驱DataStore――使用存储中的ISO镜像文件点击OK确定。

启动虚拟机,点击Connect CD/DVD,从模板创建虚拟机在Intenvory右面的下拉菜单中选择Virtual Machine and Template选择需要转换的模板,右击,选择部署新虚拟机输入虚拟机名称,选定数据中心,点击下一步选定集群选择ESX Server,点击下一步选择存储,点击下一步选择Customize using the Customization Wizard,点击下一步,进入定义Guest OS信息机器名产品授权管理员密码时区启动脚本网卡配置点击Customize可以手动为网卡设置IP地址、网关和DNS等信息工作组或加入AD域自动生成新SID注:域成员服务器SID不能相同取消选定保存点击finish完成。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
相关文档
最新文档