vmware - 脚本自动备份

发布于 2024-07-21 16:27:40 字数 182 浏览 15 评论 0原文

我在 WinXP 上运行 VMWare Workstation 6.5

如何编写脚本自动克隆虚拟机映像?

我读过有关“vmware-cmd”工具的信息,但相信该工具仅适用于 VMWare ESX,不适用于 Workstation。

I run VMWare Workstation 6.5 on WinXP.

How can I script a way to automatically clone my VM images?

I've read about the "vmware-cmd" tool but believe that is only available with VMWare ESX, not Workstation.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

む无字情书 2024-07-28 16:27:40

由于 VMWare 映像只是磁盘上的文件,因此您可以仅使用 XCOPY。 下次运行虚拟机时,系统将提示您询问是否移动或复制了虚拟机。 确保选择复制以确保为克隆的虚拟机网卡分配不同的硬件 MAC 地址。

XCOPY /S /I WinXP WinXPClone

如果您的客户机是基于 Windows 的计算机,请确保在克隆上生成新的 SID。 如果您只是出于个人用途进行克隆,那么 Sysprep 会很痛苦,这是一种更快更简单的方法是使用 NewSID

Since VMWare images are just files on disk, you can just use XCOPY. When next running the VM you'll be prompted asking if you moved, or copied the VM. Make sure you select copy to ensure the cloned VM network card is assigned a different hardware MAC address.

XCOPY /S /I WinXP WinXPClone

If your guests are Windows based machines, then ensure you generate a new SID on the clone. Sysprep is a pain if you're just cloning for personal use, a much quicker and simpler way is to use NewSID.

巷子口的你 2024-07-28 16:27:40

vmrun 将执行 vmware-cmd 所做的操作。 它可以在 ESX、工作站和服务器中找到。

vmrun will do what vmware-cmd did. It's found with ESX, Workstation, and Server.

月光色 2024-07-28 16:27:40

您可以尝试 PowerShell 脚本

Param( 
    [Parameter(Position=0,Mandatory=$true,HelpMessage="What Environment do you want exported?")]
    [ValidateSet("VCAC","IDENT","IAAS","ORCH","VCENTER","CA","DC","ALL")]
    [String[]]$vmExports)

###connect to server statement -- add later
if ( (Get-PSSnapin -Name VMware.VimAutomation.Core -ErrorAction SilentlyContinue) -eq $null )
{
    Add-PSsnapin VMware.VimAutomation.Core
}





if ($vmExports -Contains "ALL" )
{
    $vmExports = ("VCENTER")

}


function exportova ([string[]]$servers) 
{
    foreach($server in $servers)
        {

        $date = Get-Date -format MMddyyyy
        $datastore = ''
        $VMhost = ''
        $newVMName = $server+'_'+$date
        $my_vm = New-VM -Name $newVMName -VM $server -Datastore $datastore -VMHost $VMhost
        Export-VApp -Destination "E:\VMs\" -VM $newVMName -Format Ova
        Remove-VM $newVMName -DeletePermanently -Confirm:$false


        }

}



switch ($vmExports)

{


    "VCENTER"
        {

        $servers= ("")
        exportova $servers

        }       
}

You could try PowerShell Scripts

Param( 
    [Parameter(Position=0,Mandatory=$true,HelpMessage="What Environment do you want exported?")]
    [ValidateSet("VCAC","IDENT","IAAS","ORCH","VCENTER","CA","DC","ALL")]
    [String[]]$vmExports)

###connect to server statement -- add later
if ( (Get-PSSnapin -Name VMware.VimAutomation.Core -ErrorAction SilentlyContinue) -eq $null )
{
    Add-PSsnapin VMware.VimAutomation.Core
}





if ($vmExports -Contains "ALL" )
{
    $vmExports = ("VCENTER")

}


function exportova ([string[]]$servers) 
{
    foreach($server in $servers)
        {

        $date = Get-Date -format MMddyyyy
        $datastore = ''
        $VMhost = ''
        $newVMName = $server+'_'+$date
        $my_vm = New-VM -Name $newVMName -VM $server -Datastore $datastore -VMHost $VMhost
        Export-VApp -Destination "E:\VMs\" -VM $newVMName -Format Ova
        Remove-VM $newVMName -DeletePermanently -Confirm:$false


        }

}



switch ($vmExports)

{


    "VCENTER"
        {

        $servers= ("")
        exportova $servers

        }       
}
谎言 2024-07-28 16:27:40

我认为在 vSphere 中备份虚拟机时使用脚本是一种不好的方法,我之前曾使用过这种方法,但在移动虚拟机时遇到了麻烦,而某些机器具有依赖性或有人留下了虚拟磁盘仍然附着在克隆机器上。 我认为您最好使用免费的 vMware Data Protection,其缺点是您需要建议的 1.5TB 可用空间,但其好处超出了存储方面的牺牲

I think using Scripts is a bad way to go about when it comes to backing up virtual machines within vSphere i did this approach before and ran into trouble when it came to moving virtual machines around, while some machines had dependencies or someone left a virtual disk still attached to that cloned machines. I think you be better off with vMware Data Protection which is free, the downside to this is that your need a recommended 1.5TB of free space but the benefits out-way the sacrifice in storage

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文