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的更多相关文章

  1. VMware Storage VMotion概述及功能

    可以跨存储阵列实时迁移虚拟机磁盘文件.VMware Storage VMotion 使您可以在共享存储位置之间和跨共享存储位置重新分配虚拟机磁盘文件,同时保证连续的服务供应和事务处理的完整性. 1.可 ...

  2. vSphere中Storage vMotion的流程详解

    内容预览: 1. Storage vMotion的迁移方式 2. 影响Storage vMotion效率的因素 3. Storage vMotion的详细流程 企业部署虚拟化后,如果发现存储的性能出现 ...

  3. 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 ...

  4. 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 ...

  5. 【原创】大数据基础之Benchmark(2)TPC-DS

    tpc 官方:http://www.tpc.org/ 一 简介 The TPC is a non-profit corporation founded to define transaction pr ...

  6. centos7安装powershell和powercli

    poershell github https://github.com/PowerShell/PowerShell/releases 本次采用github下载对应的rpm进行安装 windows下安装 ...

  7. JS检查是否支持Storage

    查看效果:http://hovertree.com/code/html5/q69kvsi6.htm 代码: <!DOCTYPE html> <html> <head> ...

  8. Managing IIS Log File Storage

    Managing IIS Log File Storage   You can manage the amount of server disk space that Internet Informa ...

  9. Web Storage事件无法触发

    不管是在同源其他页面还是在本页面都不能触发storage事件. <!DOCTYPE html> <html> <head> <meta charset=&qu ...

随机推荐

  1. dubbo入门和springboot集成dubbo小例子

    从零开始搭建springboot-dubbo的例子 Dubbo 是一个分布式服务框架,致力于提供高性能和透明化的 RPC 远程服务调用方案,以及 SOA 服务治理方案 一. Dubbo的简单介绍 1. ...

  2. bash 特殊符号的含义

    bash常见特殊符号及含义 linux中shell变量的含义解释

  3. 正则表达式从入门到放弃「Java」

    正则表达式能做什么? 正则表达式可以用来搜索.编辑或处理文本. 「都懂它可以处理文本,可到底是怎么回事?」 正则表达式的定义 百度百科:正则表达式是对字符串操作的一种逻辑公式,就是用事先定义好的一些特 ...

  4. (转载)Spring与SpringMVC父子容器的关系与初始化

    转自 https://blog.csdn.net/dhaiuda/article/details/80026354 Spring和SpringMVC的容器具有父子关系,Spring容器为父容器,Spr ...

  5. JavaWeb防止用户的重复请求提交

    这里实现这个重复提交的防止,是通过在一个FIlter过滤器中生成一个令牌token,保存在Session域中,然后在对这个token加密得到ciphertext(密文),将密文保存在request域中 ...

  6. app本身性能测试简介

    app 性能测试指标: 1.启动时间 2.内存占用量,内存警告次数 3.页面渲染时间,刷新帧率 4.网络请求时间.流量消耗 5.UI阻塞次数,不可操作时长,主线程阻塞超过400毫秒次数 6.耗电功率 ...

  7. Netty核心组件介绍及手写简易版Tomcat

    Netty是什么: 异步事件驱动框架,用于快速开发高i性能服务端和客户端 封装了JDK底层BIO和NIO模型,提供高度可用的API 自带编码解码器解决拆包粘包问题,用户只用关心业务逻辑 精心设计的Re ...

  8. Java程序流程控制

    程序流程控制有 选择,循环,以及跳转结构 选择结构中无非就是 If 和 switch语句我两种都做了一些小案例 1. 利用Scanner库来获得控制台用户输入的数字与代码中定义的变量比较 packag ...

  9. 4、、多变量线性回归(Linear Regression with Multiple Variables)

    4.1 多维特征 目前为止,我们探讨了单变量/特征的回归模型,现在我们对房价模型增加更多的特征,例如房间数楼层等,构成一个含有多个变量的模型,模型中的特征为(x1,x2,...xn) 增添更多特征后, ...

  10. 关于Object.create方法

    ES6最新的Object.create语法是 创造一个对象 可以传参,参数为一个对象,得到的结果是一个克隆的对象, 实际上 这是基于原型的克隆 分析如下: var a={b:1}; var a1 = ...