使用 PowerShell 自动化 Virtual PC 2007?

发布于 2024-07-24 01:59:05 字数 1696 浏览 13 评论 0原文

这基本上是这个问题的重复,但接受的答案是“否”,我想保持这个问题开放,直到得到实际答案,而不是接受“否”并放弃。

Stephen Rose 通过 Twitter DM 告诉我使用 PowerShell 启动和停止 Virtual PC VM 并执行以下操作运行安装、自动更新和病毒扫描,但他尚未回应我的请求,要求提供任何描述如何执行此操作的资源链接。

我已经开始学习 PowerShell,但我不知道如何获取或使用 Virtual PC 中的虚拟机列表上的任何信息。

编辑: Windows Virtual PC(Windows 7 XP 模式) 与 Virtual PC 2007 不同。我运行 Windows 7 作为主机操作系统,但我仍在使用 Virtual PC 2007,因为我需要维护能够在没有新的 Windows Virtual PC 的 Vista 或 XP 主机上运行来宾计算机。 我简单地安装了 Windows Virtual PC 来检查一下,它必须对我的虚拟映像进行大量转换。 @x0n ($vpc = new-object -com virtualpc.application) 的建议在我的系统上产生以下错误:

New-Object : Cannot load COM type virtualpc.application.
At line:1 char:18
+ $vpc = new-object <<<<  -com virtualpc.application
    + CategoryInfo          : InvalidType: (:) [New-Object], PSArgumentException
    + FullyQualifiedErrorId : CannotLoadComObjectType,Microsoft.PowerShell.Commands.NewObjectCommand

编辑 2: 我使用了 这个答案列出了我系统上的所有 COM 对象,但找不到任何看起来像虚拟 PC 的对象。 所以现在我认为“不可能”的答案可能是正确的,但我仍然会保留这个问题,以防有人对让 PowerShell 与 Virtual PC 2007 一起工作有任何进一步的建议。 ,我正在强烈考虑跳转到 Windows 7 中的新 Windows Virtual PC,并且不用担心让我的所有虚拟机与早期版本的 Windows 兼容。

This is basically a duplicate of this question, but the accepted answer was "no" and I would like to keep this question open until getting an actual answer instead of accepting "NO" and giving up.

Stephen Rose told me via Twitter DM to use PowerShell to start and stop Virtual PC VM's and do things like run installations, automatic updates and virus scans, but he hasn't yet responded to my request for any links to resources that describe how to do so.

I've started learning PowerShell, but I can't figure out how to get or work with any information on the list of VM's within Virtual PC.

Edit: Windows Virtual PC (Windows 7 XP Mode) is not the same as Virtual PC 2007. I am running Windows 7 as my host OS, but I'm still using Virtual PC 2007 because I need to maintain the ability to run the guest machines on Vista or XP hosts that won't have the new Windows Virtual PC. I installed Windows Virtual PC briefly to check it out and it had to do a bunch of conversions on my virtual images. The suggestion by @x0n ($vpc = new-object -com virtualpc.application) produces the following error on my system:

New-Object : Cannot load COM type virtualpc.application.
At line:1 char:18
+ $vpc = new-object <<<<  -com virtualpc.application
    + CategoryInfo          : InvalidType: (:) [New-Object], PSArgumentException
    + FullyQualifiedErrorId : CannotLoadComObjectType,Microsoft.PowerShell.Commands.NewObjectCommand

Edit 2: I used Jeff's code from this answer to list all the COM objects on my system and couldn't find any that looked like they were Virtual PC. So now I'm thinking that the "it's not possible" answer may be correct, but I'm still going to leave this question open in case anyone has any further suggestions for getting PowerShell to work with Virtual PC 2007. In the mean time, I'm strongly considering making the jump to the new Windows Virtual PC in Windows 7 and just not worrying about keeping all my virtual machines compatible with earlier versions of Windows.

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

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

发布评论

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

评论(3

箜明 2024-07-31 01:59:05

为了在虚拟机中测试我自己的一些软件,我使用 AutoIt (http://www.autoitscript.com/autoit3 /)来启动虚拟机,并在虚拟机中我再次使用它来启动和控制我的应用程序。 通信是使用虚拟机内的共享文件夹完成的(编写要执行的 AutoIt 脚本,应用程序的输出如日志)。

它不是 Powershell,但也许这会有所帮助。 :)

问候,

塞巴斯蒂安

To test some of my own software within a VM I use AutoIt (http://www.autoitscript.com/autoit3/) to start the VM, and within the VM I use it again to start and control my application. Communication is done using a shared folder within the VM (writing the AutoIt script to execute, output of the application like a log).

It's not Powershell, but maybe this helps anyway. :)

Regards,

Sebastiaan

陌伤浅笑 2024-07-31 01:59:05

这是您要找的吗? 我使用的是安装了“虚拟 Windows XP”功能的 Windows 7(实际上是 vpc 2007)。

[E] PS> $vpc = new-object -com virtualpc.application
[E] PS> $vpc

HostInfo                    : System.__ComObject
VirtualMachines             : System.__ComObject
VirtualNetworks             : System.__ComObject
UnconnectedNetworkAdapters  : System.__ComObject
SupportDrivers              : System.__ComObject
Tasks                       : System.__ComObject
MinimumMemoryPerVM          : 4
MaximumMemoryPerVM          : 3071
SuggestedMaximumMemoryPerVM : 2763
MaximumFloppyDrivesPerVM    : 1
MaximumSerialPortsPerVM     : 2
MaximumParallelPortsPerVM   : 1
MaximumNetworkAdaptersPerVM : 4
MaximumNumberOfIDEBuses     : 2
DefaultVMConfigurationPath  : G:\Users\Oisin\AppData\Local\Microsoft\Windows Virtual PC\Virtual Machines\
SearchPaths                 : {}
USBDeviceCollection         : System.__ComObject
Name                        : Windows Virtual PC
Version                     : 6.1.7084.0
UpTime                      : 2

Is this what you're looking for? I'm on Windows 7 that has the "virtual windows xp" feature installed (which is effectively vpc 2007).

[E] PS> $vpc = new-object -com virtualpc.application
[E] PS> $vpc

HostInfo                    : System.__ComObject
VirtualMachines             : System.__ComObject
VirtualNetworks             : System.__ComObject
UnconnectedNetworkAdapters  : System.__ComObject
SupportDrivers              : System.__ComObject
Tasks                       : System.__ComObject
MinimumMemoryPerVM          : 4
MaximumMemoryPerVM          : 3071
SuggestedMaximumMemoryPerVM : 2763
MaximumFloppyDrivesPerVM    : 1
MaximumSerialPortsPerVM     : 2
MaximumParallelPortsPerVM   : 1
MaximumNetworkAdaptersPerVM : 4
MaximumNumberOfIDEBuses     : 2
DefaultVMConfigurationPath  : G:\Users\Oisin\AppData\Local\Microsoft\Windows Virtual PC\Virtual Machines\
SearchPaths                 : {}
USBDeviceCollection         : System.__ComObject
Name                        : Windows Virtual PC
Version                     : 6.1.7084.0
UpTime                      : 2
小糖芽 2024-07-31 01:59:05

看起来可以使用 MS Virtual Server 2005。 以下文章详细介绍了如何使用 PowerShell 脚本自动创建虚拟映像:

从第 2 部分中,在虚拟机上的配置测试部分中,似乎可以传输文件并安排脚本运行。 以这些文章为基础,应该可以像 lordbrain 描述的 VMware 映像一样自动构建 MS 虚拟映像。

It look like it may be possible to automate the creation of virtual images using MS Virtual Server 2005. The following articles detail the use of PowerShell scripts to automate the creation of virtual images:

From part 2, in the section Configuration Tests on a Virtual Machine, it seems possible to transfer files and schedule scripts to run. Using these articles as a basis, it should be possible to automate the building of a MS virtual image in the same way as lordbrain described for a VMware image.

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