Hyper-v and Powershell, in Virtual Server 2005
ASP Developer Network - Brought to you by Steve Radich and BitShop, Inc. - http://www.bitshop.com

Menu

ASPDeveloper.Net / VirtualServerFAQ.COM

Make sure you go to our home page for:

* Virtual Server 2005 FAQ
* ASP.Net 2.0 Information
* ASP.Net 2.0 Streaming Tutorials
* ASP.Net 2.0 HTML based Tutorials

Made possible by Business Internet Technology Shop (BitShop)



View :  Show duplicate posts
Virtual Server 2005

Recent Virtual Server 2005 posts

VM in VM
Virtual Machine"s NIC getting disabled
SLES Linux SMP
Linux guest SMP
VHD compacting
Failover Guest Cluster -- "The process cannot access the file because it is being used by another process."
top web hosting service hosting reviews rank
VS 2005 backup options
Virtual Server vs. Hyper-V
shadow copies - children
IIS install
New to VS2005
Virtual Image in Virtual Image
Hyper-V: Harddisk I/O on host
Virtualization learning
Hyper-V with VLAN (one NIC to many VLAN)
Vitual Network Manager
Trouble getting Hyper-V Virtual Network to work with second Network Adapter
VS and Win7
Convert server to VM using VSMT
Add Solution

Latest Topics

Table Of Contents


Post Reply |  This is Spam! | Mark as Spam

Hyper-v and Powershell

Source: microsoft.public.virtualserver
Sent: 02/08/2009
From: Colin Bruce
Message:

Dear All,

I hope this is the right group and apologies if it isn't.

I need to create a number of Hyper-V Virtual Machines and I thought I would
script it with Powershell. I thought that would be quicker than just creating
them by hand. Ah well I'll know better next time. Anyway, I now have a script
but only works once. When now VMs exist the script works but when I try to
create a second or third VM it fails in various places. The code in each of
the places is pretty much the same so I'll only quote a snippet. Here is the
code to allocate the number or processors.

$VProc = gwmi -namespace root\virtualization
Msvm_VirtualSystemSettingDataComponent | where {$_.PartComponent -like
"*processor*"}
$Proc = gwmi -namespace root\virtualization Msvm_ProcessorSettingData |
where {$_.__PATH -like $($VProc.PartComponent) }
$Proc.VirtualQuantity = $NProcs
$Result = $VSManagementService.ModifyVirtualSystemResources($NewVM_PATH,
$Proc.psbase.getText(1))

When I create the first VM it is fine but when I create a second one I get:

Property 'VirtualQuantity' cannot be found on this object; make sure it exists
and is settable.
At E:\Shared\Hyper-V\Hyper-V Clone.ps1:264 char:7
+ $Proc.V <<<< irtualQuantity = $NProcs
You cannot call a method on a null-valued expression.
At E:\Shared\Hyper-V\Hyper-V Clone.ps1:265 char:94
+ $Result = $VSManagementService.ModifyVirtualSystemResources($NewVM_PATH,
$Pro
c.psbase.getText( <<<< 1))

This has me beaten I'm afraid.

Any advice will be appreciated.
--
Best wishes...
Colin Bruce
Coventry University



Post Reply |  This is Spam! | Mark as Spam

Related Messages


Post Reply |  This is Spam! | Mark as Spam


Table Of Contents



Other groups

 
Virtual PC (Mac)(3592) Virtual PC(12844) Virtual PC (French)(496)
Virtual Server 2005(6245)
Search
in:
Our Sponsors
Virtual Server 2005 Info Here!
http://www.aspdeveloper.net
Virtual Server 2005 Info Here!
http://www.aspdeveloper.net
Virtual Server 2005 Info Here!
http://www.aspdeveloper.net
Virtual Server 2005 Info Here!
http://www.aspdeveloper.net
Virtual Server 2005 Info Here!
http://www.aspdeveloper.net
rss Wiki rss Blogs rss Articles rss Image galleries rss File galleries rss Forums rss Maps rss Directories
ASP Developer Network (since 1996) - Brought to you by Steve Radich and BitShop, Inc. - http://www.bitshop.com
Copyright © 1997-2005 by BitShop, Inc. All Rights Reserved.
No content may be reproduced in any form without written permission from BitShop, Inc.
We will be honored to assist with reproduction rights on our material if you contact us.
We also can provide print articles for your magazine, private training seminars at your site, and conference presentations.

Thank you for visiting. Please bookmark our site if you found it useful!
If you wish to make a donation it will help further the development of these free resources: