Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

Read-SCGuestInfo

Updated: November 1, 2013

Applies To: System Center 2012 R2 Virtual Machine Manager

Read-SCGuestInfo

Retrieves the value associated with a key in a guest operating system.

Syntax

Parameter Set: MultipleKvpKeys
Read-SCGuestInfo [-VM] <VM> -KvpMap <Hashtable> [ <CommonParameters>]

Parameter Set: SingleKvpKey
Read-SCGuestInfo [-VM] <VM> [-Key] <String> [ <CommonParameters>]




Detailed Description

The Read-SCGuestInfo cmdlet retrieves the value associated with a key (key/value pair) in a guest operating system.

Parameters

-Key<String>

Specifies the key in a key/value pair (KVP).


Aliases

none

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-KvpMap<Hashtable>

Specifies a hash table of key/value pairs (KVPs) corresponding to the KVP values exposed by Hyper-V.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VM<VM>

Specifies a virtual machine object.


Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters.

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • String

Examples

1: Get the IntegrationServicesVersion value for a specified key for a virtual machine.

The first command gets the virtual machine object named $VM01 and stores the object in the $VM variable.

The second command returns the IntegrationServicesVersion key/value pair for virtual machine VM01.


PS C:\> $VM = Get-SCVirtualMachine -Name "VM01"PS C:\> Read-SCGuestInfo -VM $VM -Key "FullyQualifiedDomainName"

2: Get the IntegrationServicesVersion value for a specified key for a virtual machine by using the pipeline operator.

This command returns the IntegrationServicesVersion key/value pair for virtual machine VM01.


PS C:\> Get-SCVirtualMachine -Name "VM01" | Read-SCGuestInfo -Key IntegrationServicesVersion

3: Get multiple KVP values based on specified keys for a virtual machine.

The first command creates an array named $ValuesMap.

The second and third commands add values to the $ValuesMap array.

The fourth command gets the virtual machine object named VM02 and stores the object in the $VM variable.

The last command returns the IntegrationServicesVersion and NetworkAddressIPv4 key/value pairs for virtual machine VM02.


PS C:\> $ValuesMap = @{}PS C:\> $ValuesMap.Add("NetworkAddressIPv4", $null)PS C:\> $ValuesMap.Add("IntegrationServicesVersion", $null)PS C:\> $VM = Get-SCVirtualMachine "VM02"PS C:\> Read-SCGuestInfo -VM $vm -KvpMap $ValuesMap

4: Read multiple data types through a hashtable.

The first command gets the virtual machine object named VM03 and stores the object in the $VM variable.

The second command creates an array named $ValuesMap.

The third command adds NetworkAddressIPv4 to the $ValuesMap array.

The fourth command gets the NetworkAddressIPv4 key/value pair for VM03.

The fifth command adds NetworkAddressIPv6 to the $ValuesMap array.

The sixth command gets the NetworkAddressIPv6 key/value pair for VM03.

The seventh command creates an array named $ValuesMap2 which contains NetworkAddressIPv4 and FullyQualifiedDomainName.

The last command returns the key/value pairs for NetworkAddressIPv4 and FullyQualifiedDomainName for VM03.


PS C:\> $VM = Get-SCVirtualMachine -Name "VM03"PS C:\> $ValuesMap = @{}PS C:\> $ValuesMap.Add("NetworkAddressIPv4", $null)PS C:\> Read-SCGuestInfo -VM $VM -KvpMap $ValuesMapPS C:\> $ValuesMap.Add("NetworkAddressIPv6", $null)PS C:\> Read-SCGuestInfo -VM $VM -KvpMap $ValuesMapPS C:\> $ValuesMap2 = @{"NetworkAddressIPv4" = $null; "FullyQualifiedDomainName" = $null}PS C:\> Read-SCGuestInfo -VM $VM -KvpMap $ValuesMap2

5: Read keys that do not exist.

The first command gets the virtual machine object named VM01 and stores the object in the $VM variable.

The second, fourth, and sixth commands each create a set of keys that are null and stores the set in the $KeysDoNotExist variable.

The third, fifth, and seventh commands read the KVPMap in $KeysDoNotExist and displays the results to the user.


PS C:\> $VM = Get-SCVirtualMachine -Name "VM01"PS C:\> $KeysDoNotExist = @{"o1ff1" = $null; "o1ff2" = $null; "o1ff3" = $null ; "o1ff4" = $null }PS C:\> Read-SCGuestInfo -VM $VM -KVPMap $KeysDoNotExistPS C:\> $KeysDoNotExist = @{"off4" = $null; "o1ff2" = $null; "o1ff3" = $null ; "o1ff4" = $null }PS C:\> Read-SCGuestInfo -VM $VM -KVPMap $KeysDoNotExistPS C:\> $KeysDoNotExist = @{"o1ff1" = $null; "o1ff2" = $null; "off4" = $null ; "o1ff4" = $null }PS C:\> Read-SCGuestInfo -VM $VM -KVPMap $KeysDoNotExist

Related topics

 
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.