Set-SCPackageMapping

Applies To: System Center 2012 - Virtual Machine Manager

Set-SCPackageMapping

Updates a package mapping object.

Syntax

Parameter Set: LocalFile
Set-SCPackageMapping -LocalFile <String> -PackageMapping <PackageMapping> [-VMMServer <ServerConnection> ] [ <CommonParameters>]

Parameter Set: PackageFile
Set-SCPackageMapping -PackageMapping <PackageMapping> -UsePackageFileMapping [-VMMServer <ServerConnection> ] [ <CommonParameters>]

Parameter Set: TargetObject
Set-SCPackageMapping -PackageMapping <PackageMapping> [-TargetObject <ClientObject> ] [-VMMServer <ServerConnection> ] [ <CommonParameters>]

Detailed Description

The Set-SCPackageMapping cmdlet updates a package mapping object. To create a package mapping object, see New-SCPackageMapping.

For more information about Set-SCPackageMapping, type: "Get-Help Set-SCPackageMapping -online".

Parameters

-LocalFile<String>

Specifies the location of an exported package.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PackageMapping<PackageMapping>

Specifies a package mapping object.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-TargetObject<ClientObject>

Specifies the object to which you want to map a resource.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-UsePackageFileMapping

Indicates that the package file is uploaded.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VMMServer<ServerConnection>

Specifies a VMM server object.

Aliases

none

Required?

false

Position?

named

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.

Examples

1: Update a package mapping object.

The first command gets the template package at the specified path.

The second command creates a package mapping object for the package stored in $TemplatePackage and stores the object in the $Mappings variable.

The third command gets a mapping object by package ID and stores the object in the $Mapping variable.

The fourth command gets the virtual hard disk object named VHD01 and stores the object in the $Resource variable.

The last command binds the mapping stored in $Mapping to the object stored in $Resource (VHD01).

PS C:\> $TemplatePackage = Get-SCTemplatePackage -Path "C:\TemplateExports\ServiceTemplate01.new.xml"
PS C:\> $Mappings = New-SCPackageMapping -TemplatePackage $TemplatePackage
PS C:\> $Mapping = $Mappings | where {$_.PackageID -eq "VHD01.vhd"}
PS C:\> $Resource = Get-SCVirtualHardDisk -Name "VHD01.vhd"
PS C:\> Set-SCPackageMapping -PackageMapping $Mapping -TargetObject $Resource

New-SCPackageMapping