Quantcast
Channel: Virtual Machine Manager – General forum
Viewing all articles
Browse latest Browse all 4089

SCVMM 2012 - Error with PowerShell command 'Get-SCVirtualNetworkAdapterConfiguration'

$
0
0


Hi

I am writing a PowerShell script that creates a service from a service template, modifying the network adapter settings in the service configuration before it is deployed.  I am following the example provided on this Technet page closely:

http://technet.microsoft.com/en-us/library/hh801320

Unfortunately when the script attempts to read the NIC configuration, I get the error :

Cannot convert the "ServiceVM00002.<ourdomain>" value of type "Microsoft.SystemCenter.V
irtualMachineManager.BaseVMConfiguration" to type "Microsoft.SystemCenter.VirtualMachineManag
er.VMConfiguration".

My Script:

#
# Get connection to vmm server
$vmmserver = Get-SCVMMServer -ComputerName "<VMMServer>"

# Get Objects
$Cloud = Get-SCCloud
$ServiceTemplate = get-scservicetemplate -Name "Service Template 1"

# Create Temporary Service Config
$SvcCfgName = "Temp_SVC_Config_" + (get-date -format "ddHHmmss")
$ServiceConfig = New-SCServiceConfiguration -ServiceTemplate $ServiceTemplate -Name $SvcCfgName -Cloud $Cloud -Description "Temp Service Config"

# Get the Computer Tier Object
$TierConfig = Get-SCComputerTierConfiguration -ServiceConfiguration $ServiceConfig

# Get the VMConfiguration within the Tier
$VMConfig = Get-SCVMConfiguration -ComputerTierConfiguration $TierConfig

# Get NIC Setings
$VNAConfig = Get-SCVirtualNetworkAdapterConfiguration -VMConfiguration $VMConfig


Full Error Message:

Get-SCVirtualNetworkAdapterConfiguration : Cannot bind parameter 'VMConfiguration'. Cannot co
nvert the "ServiceVM00002.<ourdomain>" value of type "Microsoft.SystemCenter.V
irtualMachineManager.BaseVMConfiguration" to type "Microsoft.SystemCenter.VirtualMachineManag
er.VMConfiguration".
At C:\SCVMM 2012 PowerShell\Example4Forum.ps1:20 char:71+ $VNAConfig = Get-SCVirtualNetworkAdapterConfiguration -VMConfiguration <<<<  $VMConfig+ CategoryInfo          : InvalidArgument: (:) [Get-SCVirtualNetworkAdapterConfiguration 
   ], ParameterBindingException+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.SystemCenter.VirtualM 
   achineManager.Cmdlets.GetVNICConfigurationCmdlet

Thanks in advance for your help


Viewing all articles
Browse latest Browse all 4089

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>