大家在使用vsphere的时候,常遇到这个问题,就是有时候把一些文件放到vsphere文件夹,是不是需要将此文件从datastore中的某个文件夹移到另一个文件夹。如果没有vscenter的时候,会很痛苦!今天就来看看如何实现使用PowerCLI来访问和管理Vsphere Datastore中的文件吧!
首先下载安装vSphere PowerCLI 软件。
然后更改Windows 7的ExecutionPolicy 为Remotesigned模式,才可以加载PowerCLI的脚本等!
打开PowerCLI,如下图“
并使用connect-viserver 连接到服务器。弹出对话框,输入用户名和密码:
获取vsphere的datastore
使用命令$datastore=get-datastore –name datastore1 将datastore1赋值给$datastore,然后再映射到本地磁盘ps,new-psdrive –location $datastore –name ds –psprovider Vimdatastore –root “\”
set-location ds:\定位到ds盘符下
下面就可以使用类似于命令提示符下的命令了,但是注意这里区分字母大小写的
就可以将vmdk复制到Lync-2013-1文件夹里面了。
-------------------------------------------------------------------------------华丽的分割线
做完这个blog的时候我SB,我要求的这个功能,其实使用vsphere client里面的datastore browser就可以直接右击复制粘贴了!
哎~!非专业就是非专业的啊~!
不过也有所得吧,至少了解了些PowerCLI的命令和用法!
转载于:https://blog.51cto.com/c1813/1184345