Powercli随笔 - PowerCLI script to sequentially Storage vMotion VMs from a CSV File
PowerCLI script to sequentially Storage vMotion VMs from a CSV File
This is a PowerCLI script that I use to Storage vMotion (s/vmotion) VMs from an input file (CSV File). This helps me evacuate VMs from a datastore that will be decommissioned and this serves like an automation. With this, I do not have to log back to vCenter and manually do storage migrations. This also have a lesser performance impact compared to simultaneously queuing storage migrations manually in case this will be done on non-peak hours.
1
2
3
4
5
6
7
8
|
$VMsToRelocate = Import-Csv "ListOfVMsToRelocate.csv" $Datastore = Get-Datastore -Name "datastore_name" foreach ( $VM in $VMsToRelocate ) { Write-Host "Relocating VM:" $VM .Name "to" $Datastore Get-VM -Name $VM .Name | Move-VM -datastore $Datastore > $null } Write-Host "Completed!" |
Note that the CSV file must have a Header called Name, below is an example.
1
2
3
4
|
Name VM1 VM2 VM3 |
If you want to export the list of VMs that you want to migrate, you can use RV Tools to generate a VM Inventory, export the list to MS Excel, do your filtering there (such as filter by the storage path), and I personally like to sort them by used size (in MB), then simply copy-paste to the CSV file. You do not need to create the CSV file in Excel, I use Notepad++.
Powercli随笔 - PowerCLI script to sequentially Storage vMotion VMs from a CSV File的更多相关文章
- VMware Storage VMotion概述及功能
可以跨存储阵列实时迁移虚拟机磁盘文件.VMware Storage VMotion 使您可以在共享存储位置之间和跨共享存储位置重新分配虚拟机磁盘文件,同时保证连续的服务供应和事务处理的完整性. 1.可 ...
- vSphere中Storage vMotion的流程详解
内容预览: 1. Storage vMotion的迁移方式 2. 影响Storage vMotion效率的因素 3. Storage vMotion的详细流程 企业部署虚拟化后,如果发现存储的性能出现 ...
- SQL Script for select data from ebs and make a csv file to FTP
DECLARE CURSOR cur_lcy_test IS SELECT rcta.customer_trx_id, rcta.trx_number, rcta.trx_date FROM ra_c ...
- SQL Script for read information from a csv file in FTP Server
DECLARE w_file_path VARCHAR2(4000) := 'XXIF_INPUT'; --all_directories.directory_name w_file_name VAR ...
- 【原创】大数据基础之Benchmark(2)TPC-DS
tpc 官方:http://www.tpc.org/ 一 简介 The TPC is a non-profit corporation founded to define transaction pr ...
- centos7安装powershell和powercli
poershell github https://github.com/PowerShell/PowerShell/releases 本次采用github下载对应的rpm进行安装 windows下安装 ...
- JS检查是否支持Storage
查看效果:http://hovertree.com/code/html5/q69kvsi6.htm 代码: <!DOCTYPE html> <html> <head> ...
- Managing IIS Log File Storage
Managing IIS Log File Storage You can manage the amount of server disk space that Internet Informa ...
- Web Storage事件无法触发
不管是在同源其他页面还是在本页面都不能触发storage事件. <!DOCTYPE html> <html> <head> <meta charset=&qu ...
随机推荐
- python的tesseract库几个重要的命令
在调用tesseract时,最重要的三个参数是 -l, -oem 和 -psm -l 参数控制识别文本的语言.可以通过命令 tesseract --list-langs 查看已经安装的字库. 支持中 ...
- Action 分离
原文地址:http://www.cnblogs.com/giggle/p/5380832.html?utm_source=tuicool&utm_medium=referral 本处摘要备注. ...
- [Linux] 020 RPM 包的命名原则与其依赖性
1. RPM 包命名原则 例如:httpd-2.2.15-15.e16.centos.1.i686.rpm 字符 释义 httpd 软件包名 2.2.15 软件版本 15 软件发布的次数 e16.ce ...
- CentOS删除Applications中的菜单项
有时候会错误的安装一些软件,可能安装被不成功,但是在左上角的Applications菜单中还是会显示出来,让人很不爽. 现在介绍一个删除掉CentOS Applications中菜单项的方法: 1.安 ...
- JS中 [] == ![]结果为true,而 {} == !{}却为false
为什么? 先转换再比较 (==) 仅比较而不转换 (===) ==转换规则? ==比较运算符会先转换操作数(强制转换),然后再进行比较 ①如果有一个操作数是布尔值,则在比较相等性之前 ...
- Java 时间类 Date 和 Calendar
在项目中获取一个yyyy-MM-dd HH:mm:ss格式的时间字符串 package org.htsg.kits; import java.text.SimpleDateFormat; import ...
- maven system path,加载本地jar
当引用第三方包,且没有源代码时候,可以使用system path <dependency> <groupId>ctec</groupId> <artifact ...
- zabbix入门之添加主机
添加主机的方法有两种:手动添加.自动发现 前提是:在被监控主机中安装zabbix-agent.zabbix-sender组件,并配置好启动服务. 手动添加: 自动发现: 这里等待1分钟左右即可发现主机 ...
- Spring之控制反转——IoC、面向切面编程——AOP
控制反转——IoC 提出IoC的目的 为了解决对象之间的耦合度过高的问题,提出了IoC理论,用来实现对象之间的解耦. 什么是IoC IoC是Inversion of Control的缩写,译为控制 ...
- Sass-乘法
Sass 中的乘法运算和前面介绍的加法与减法运算还略有不同.虽然他也能够支持多种单位(比如 em ,px , %),但当一个单位同时声明两个值时会有问题.比如下面的示例: 编译的时候报“20px*px ...