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. eclipse配置,快捷键备忘

    1. General --> Workspace --> UTF-82. General --> Editors --> Associations --> JSP --& ...

  2. SAP选择屏幕开发(二)(转)

    原文链接:https://blog.csdn.net/wtxhai/article/details/90698683 1.2.SAP屏幕框架的创建        SAP页面设计中的框架不但可以保证SA ...

  3. Spring学习(一)--简化Java开发,认识Spring

    一.传统Java开发弊端 在传统的开发之中,任何一个有实际意义的应用都会由两个或更多的类所组成,这些类之间相互协调来完成特定的业务逻辑,按照传统的做法,每个对象负责管理与自己相互协作的对象(即他所依赖 ...

  4. redis setNx方法

    Redis有一系列的命令,特点是以NX结尾,NX是Not eXists的缩写,如SETNX命令就应该理解为:SET if Not eXists.这系列的命令非常有用,这里讲使用SETNX来实现分布式锁 ...

  5. 【Vue 2.X】基于input[type='number']封装parseFloat、parseInt-自定义指令系列(一)

    一.parseFloat 效果:限制负值输入,且输入值不为空时自动保留两位小数,等同于js的parseFloat(value).toFixed(2) 使用:与v-model配合使用,v-parseFl ...

  6. CLR 垃圾回收知识梳理

  7. linux性能分析工具Cpu

  8. ffmpeg音频文件转换之使用stdin/stdout或BytesIO对象输入输出

    最近在搞小程序录音,然后使用百度接口做语音识别. 小程序目前仅支持mp3和aac编码格式.虽然百度接口提供的m4a格式支持能直接识别小程序的录音文件,但由于自己还有其他一系列需求(比如直接读取数据,根 ...

  9. 您的加密USB驱动器是否安全?黑客又是如何攻破的?

    您如何确定您使用的“安全”USB驱动器是否真的安全,并且您存储的数据无法提取?这正是Google公司和中国网络安全研究人员在最近的2018年黑帽美国大会上以艰难的方式攻击加密的USB密钥”的问题. 研 ...

  10. 机器学习:1.K近邻算法

    1.简单案例:预测男女,根据身高,体重,鞋码 import numpy as np import matplotlib import sklearn from skleran.neighbors im ...