Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Property cannot be found on this object

548 views
Skip to first unread message

Carlos

unread,
Mar 11, 2009, 6:11:13 AM3/11/09
to
I am trying to execute de next script in powershell, but i receive the error:
 
Property 'VirtualQuantity' cannot be found on this object; make sure it exists and is settable.
At C:\Users\Administrator\Desktop\sample1.ps1:15 char:6
+ $Mem. <<<< VirtualQuantity = [string]1024
 
What can be the cause? Thanks in advance
 
get-wmiobject -namespace root\virtualization Msvm_VirtualSystemManagementService
$NewVM = gwmi -namespace root\virtualization Msvm_ComputerSystem | where {$_.ElementName -like "vir02"}
 
## First you need to locate the active settings of a virtual machine
$NewVM = gwmi -namespace root\virtualization Msvm_ComputerSystem | where {$_.ElementName -like "vir02"}
$VMSettingData = get-wmiobject -namespace root\virtualization Msvm_VirtualSystemSettingData -filter "SystemName = `'$($NewVM.Name)`'"
 
## Then find all the resources allocated to this VM. One particular resource is the Virtual Memory resource
$Vmem = gwmi -namespace root\virtualization Msvm_VirtualSystemSettingDataComponent | where {$_.PartComponent -like "*memory*"}
 
## Find an instance of Msvm_MemorySettingData that matches with $VMem.PartComponent
$Mem =  gwmi -namespace root\virtualization Msvm_MemorySettingData | where {$_.__PATH -like $($Vmem.PartComponent) }
 
## Now modify the quantity of RAM
$Mem.VirtualQuantity = [string]1024
$Mem.Reservation = [string]1024
$Mem.Limit = [string]1024
 
## Commit Changes
$VM_Service.ModifyVirtualSystemResources($NewVM.__PATH, $Mem.psbase.getText(1))

Marco Shaw [MVP]

unread,
Mar 11, 2009, 7:49:08 AM3/11/09
to

> ## Now modify the quantity of RAM
> $Mem.VirtualQuantity = [string]1024
> $Mem.Reservation = [string]1024
> $Mem.Limit = [string]1024

At this point, once you've created the object and have saved it into
$mem, do this to see what properties are supported:

$mem|get-member -type property

It is possibly that $mem is $null due to a logic error.

I've also run into problems with Hyper-V. Make 100% sure you're running
a patched version, and not the beta packaged with Windows Server 2008.

Marco

--
*Microsoft MVP - Windows PowerShell
https://mvp.support.microsoft.com/profile/Marco.Shaw
*Co-Author - Sams Windows PowerShell Unleashed 2nd Edition
*PowerShell Co-Community Director - http://www.powershellcommunity.org
*Blog - http://marcoshaw.blogspot.com

Carlos

unread,
Mar 11, 2009, 12:40:17 PM3/11/09
to
Thanks Marco,
yes, $mem was null due to a logic error, thanks!

One more question: what is the difference between VirtualQuantity,
Reservation and Limit, properties of Msvm_MemorySettingData that I can
change trough a powershell script?

"Marco Shaw [MVP]" <marco.shaw@NO_SPAMgmail.com> escribió en el mensaje
news:ubizp9jo...@TK2MSFTNGP05.phx.gbl...

Marco Shaw [MVP]

unread,
Mar 11, 2009, 12:55:59 PM3/11/09
to
Carlos wrote:
> Thanks Marco,
> yes, $mem was null due to a logic error, thanks!
>
> One more question: what is the difference between VirtualQuantity,
> Reservation and Limit, properties of Msvm_MemorySettingData that I can
> change trough a powershell script?

These properties are listed here:
http://msdn.microsoft.com/en-us/library/cc136856(VS.85).aspx

Let us know if that helps.

Carlos

unread,
Mar 11, 2009, 1:53:55 PM3/11/09
to
Thanks Marco :)
is there a relation between burstable RAM and guaranteed RAM that are available in other virtualization systems, and this properties (VirtualQuantity, Reservation and Limit),? I dont understand very well the meaning of them.
 
 
"Marco Shaw [MVP]" <marco.shaw@NO_SPAMgmail.com> escribió en el mensaje news:%23RPrIpm...@TK2MSFTNGP04.phx.gbl...

Marco Shaw [MVP]

unread,
Mar 11, 2009, 1:57:51 PM3/11/09
to
Carlos wrote:
> Thanks Marco :)
> is there a relation between burstable RAM and guaranteed RAM that are
> available in other virtualization systems, and this properties
> (VirtualQuantity, Reservation and Limit),? I dont understand very well
> the meaning of them.

I think you should go asking this in a Hyper-V forum:
http://social.technet.microsoft.com/Forums/en-US/winserverhyperv/threads/

0 new messages