使用 PowerShell 自动化 Virtual PC 2007?
这基本上是这个问题的重复,但接受的答案是“否”,我想保持这个问题开放,直到得到实际答案,而不是接受“否”并放弃。
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
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
为了在虚拟机中测试我自己的一些软件,我使用 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
这是您要找的吗? 我使用的是安装了“虚拟 Windows XP”功能的 Windows 7(实际上是 vpc 2007)。
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).
看起来可以使用 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.