Windows

您可以使用 powershell 來“啟動”新的 VM 實例嗎

  • January 2, 2015

學習 powershell 並致力於使用 Hyper-v 創建 VM。我想知道是否有一種方法或一種理想的方法來安裝/設置客戶作業系統?

到目前為止,我得出的唯一結論是複制 .vhd/.vhdx 並將它們附加到新 VM。但是,我知道使用 *nix 這可能會導致整個網路設置出現問題並需要手動修復,但我認為這在 Windows 上會很好嗎?

編輯:是的,我知道 Hyper-V 的 cmdlet。這不是我要問的。有沒有辦法在新創建的虛擬機上安裝作業系統

有關從頭開始創建 VM 和安裝作業系統的範例,請參閱http://technet.microsoft.com/en-us/magazine/jj933287.aspx 。

步驟是創建 vm,配置 vm,添加源 ISO 和帶有 unmattend.xml 的磁片,然後啟動 vm

是的。PowerShell 可以用 Hyper-V 虛擬機做很多事情。從以下 CMDlet 中選擇:

Add-VMDvdDrive
Add-VMFibreChannelHba
Add-VMHardDiskDrive
Add-VMMigrationNetwork
Add-VMNetworkAdapter
Add-VMNetworkAdapterAcl
Add-VMNetworkAdapterExtendedAcl
Add-VmNetworkAdapterRoutingDomainMapping
Add-VMRemoteFx3dVideoAdapter
Add-VMScsiController
Add-VMStoragePath
Add-VMSwitch
Add-VMSwitchExtensionPortFeature
Add-VMSwitchExtensionSwitchFeature
Checkpoint-VM
Compare-VM
Complete-VMFailover
Connect-VMNetworkAdapter
Connect-VMSan
Convert-VHD
Copy-VMFile
Debug-VM
Disable-VMEventing
Disable-VMIntegrationService
Disable-VMMigration
Disable-VMRemoteFXPhysicalVideoAdapter
Disable-VMResourceMetering
Disable-VMSwitchExtension
Disconnect-VMNetworkAdapter
Disconnect-VMSan
Dismount-VHD
Enable-VMEventing
Enable-VMIntegrationService
Enable-VMMigration
Enable-VMRemoteFXPhysicalVideoAdapter
Enable-VMReplication
Enable-VMResourceMetering
Enable-VMSwitchExtension
Export-VM
Export-VMSnapshot
Get-VHD
Get-VM
Get-VMBios
Get-VMComPort
Get-VMConnectAccess
Get-VMDvdDrive
Get-VMFibreChannelHba
Get-VMFirmware
Get-VMFloppyDiskDrive
Get-VMHardDiskDrive
Get-VMHost
Get-VMHostNumaNode
Get-VMHostNumaNodeStatus
Get-VMIdeController
Get-VMIntegrationService
Get-VMMemory
Get-VMMigrationNetwork
Get-VMNetworkAdapter
Get-VMNetworkAdapterAcl
Get-VMNetworkAdapterExtendedAcl
Get-VMNetworkAdapterFailoverConfiguration
Get-VmNetworkAdapterIsolation
Get-VMNetworkAdapterRoutingDomainMapping
Get-VMNetworkAdapterVlan
Get-VMProcessor
Get-VMRemoteFx3dVideoAdapter
Get-VMRemoteFXPhysicalVideoAdapter
Get-VMReplication
Get-VMReplicationAuthorizationEntry
Get-VMReplicationServer
Get-VMResourcePool
Get-VMSan
Get-VMScsiController
Get-VMSnapshot
Get-VMStoragePath
Get-VMSwitch
Get-VMSwitchExtension
Get-VMSwitchExtensionPortData
Get-VMSwitchExtensionPortFeature
Get-VMSwitchExtensionSwitchData
Get-VMSwitchExtensionSwitchFeature
Get-VMSystemSwitchExtension
Get-VMSystemSwitchExtensionPortFeature
Get-VMSystemSwitchExtensionSwitchFeature
Grant-VMConnectAccess
Import-VM
Import-VMInitialReplication
Measure-VM
Measure-VMReplication
Measure-VMResourcePool
Merge-VHD
Mount-VHD
Move-VM
Move-VMStorage
New-VFD
New-VHD
New-VM
New-VMReplicationAuthorizationEntry
New-VMResourcePool
New-VMSan
New-VMSwitch
Optimize-VHD
Remove-VM
Remove-VMDvdDrive
Remove-VMFibreChannelHba
Remove-VMHardDiskDrive
Remove-VMMigrationNetwork
Remove-VMNetworkAdapter
Remove-VMNetworkAdapterAcl
Remove-VMNetworkAdapterExtendedAcl
Remove-VMNetworkAdapterRoutingDomainMapping
Remove-VMRemoteFx3dVideoAdapter
Remove-VMReplication
Remove-VMReplicationAuthorizationEntry
Remove-VMResourcePool
Remove-VMSan
Remove-VMSavedState
Remove-VMScsiController
Remove-VMSnapshot
Remove-VMStoragePath
Remove-VMSwitch
Remove-VMSwitchExtensionPortFeature
Remove-VMSwitchExtensionSwitchFeature
Rename-VM
Rename-VMNetworkAdapter
Rename-VMResourcePool
Rename-VMSan
Rename-VMSnapshot
Rename-VMSwitch
Repair-VM
Reset-VMReplicationStatistics
Reset-VMResourceMetering
Resize-VHD
Restart-VM
Restore-VMSnapshot
Resume-VM
Resume-VMReplication
Revoke-VMConnectAccess
Save-VM
Set-VHD
Set-VM
Set-VMBios
Set-VMComPort
Set-VMDvdDrive
Set-VMFibreChannelHba
Set-VMFirmware
Set-VMFloppyDiskDrive
Set-VMHardDiskDrive
Set-VMHost
Set-VMMemory
Set-VMMigrationNetwork
Set-VMNetworkAdapter
Set-VMNetworkAdapterFailoverConfiguration
Set-VmNetworkAdapterIsolation
Set-VmNetworkAdapterRoutingDomainMapping
Set-VMNetworkAdapterVlan
Set-VMProcessor
Set-VMRemoteFx3dVideoAdapter
Set-VMReplication
Set-VMReplicationAuthorizationEntry
Set-VMReplicationServer
Set-VMResourcePool
Set-VMSan
Set-VMSwitch
Set-VMSwitchExtensionPortFeature
Set-VMSwitchExtensionSwitchFeature
Start-VM
Start-VMFailover
Start-VMInitialReplication
Stop-VM
Stop-VMFailover
Stop-VMInitialReplication
Stop-VMReplication
Suspend-VM
Suspend-VMReplication
Test-VHD
Test-VMNetworkAdapter
Test-VMReplicationConnection

引用自:https://serverfault.com/questions/655787