Add-SCLibraryShare

Adds Windows shares on the file system of a library server to the VMM library as library shares.

Syntax

Add-SCLibraryShare
   [-VMMServer <ServerConnection>]
   [-SharePath] <String>
   [-Credential <PSCredential>]
   [-Description <String>]
   [-AddDefaultResources]
   [-JobGroup <Guid>]
   [-UseAlternateDataStream <Boolean>]
   [-RunAsynchronously]
   [-PROTipID <Guid>]
   [-JobVariable <String>]
   [<CommonParameters>]

Description

The Add-SCLibraryShare cmdlet adds Windows shares on the file system of a library server to the Virtual Machine Manager (VMM) library as library shares.

Before you can add a library share to the VMM library, you must first create the share in the Windows file system. You can, for example, use Windows Explorer to create and share a folder that you want to add to the library.

If you create a Windows share at the same level as the default library share (MSSCVMMLibrary) created by VMM Setup or on a separate library server, use the Add-SCLibraryShare cmdlet to add that share to the VMM library.

If you create a Windows folder under the default VMM library share (MSSCVMMLibrary), VMM automatically scans the share, discovers all existing objects stored on that share that qualify as library objects, and adds the library objects to the library. However, you can use the Read-SCLibraryShare cmdlet to manually refresh that share and import its contents into the VMM library.

Note: Library resources that can be discovered only by the library refresher but not created by an administrator include virtual hard disks (Windows-based .vhd files, Citrix XenServer-based .vhd files or VMware-based .vmdk files), virtual floppy disks (Windows-based .vfd files or VMware-based .flp files), ISO images (.iso files), and scripts.

Examples

Example 1: Add a Windows share as a library share object to the VMM library

PS C:\> Get-SCVMMServer -ComputerName "VMMServer01.Contoso.com"
PS C:\> Add-SCLibraryShare -SharePath "\\LibraryServer01\AllVHDs"

The first command connects to VMMServer01.

The second command adds a library share object to the library named AllVHDs (a Windows share located on LibraryServer01). This example assumes that LibraryServer01 is already a VMM library server.

Example 2: Add two Windows shares as library share objects to the VMM library

PS C:\> Get-SCVMMServer -ComputerName "VMMServer01.Contoso.com"
PS C:\> $SharePaths = "\\LibraryServer01\AllVHDs", "\\LibraryServer01\AllISOs"
PS C:\> ForEach($SharePath in $SharePaths) { Add-SCLibraryShare -SharePath $SharePath }

The first command connects to VMMServer1.

The second command stores the strings "\LibraryServer01\AllVHDs" and "\LibraryServer01\AllSOs" in the $SharePaths variable. This example assumes that LibraryServer01 is already a VMM library server.

The last command uses a ForEach loop to pass the two share names stored in $SharePaths to the Add-SCLibraryShare cmdlet, which adds each Windows share as a library share to VMM.

Note: For more information about the standard Windows PowerShell ForEach loop statement, type Get-Help about_ForEach. The ForEach loop statement is not the same as the ForEach-Object cmdlet, which uses ForEach as an alias.

Parameters

-AddDefaultResources

Indicates that the default resources for a library share are added.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Credential

Specifies a credential object or, for some cmdlets, a Run As account object that contains the user name and password of an account that has permission to perform this action. Or, in the case of Restart-SCJob, has permission to complete a restarted task.

For more information about the PSCredential object, type Get-Help Get-Credential.

For more information about Run As accounts, type Get-Help New-SCRunAsAccount.

Type:PSCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Description

Specifies a description for the library share.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-JobGroup

Specifies an identifier for a series of commands that will run as a set just before the final command that includes the same job group identifier runs.

Type:Guid
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-JobVariable

Specifies that job progress is tracked and stored in the variable named by this parameter.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-PROTipID

Specifies the ID of the Performance and Resource Optimization tip (PRO tip) that triggered this action. This parameter lets you audit PRO tips.

Type:Guid
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RunAsynchronously

Indicates that the job runs asynchronously so that control returns to the command shell immediately.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-SharePath

Specifies a path to a valid library share on an existing library server that uses a Universal Naming Convention (UNC) path.

Example format: -SharePath "\\LibServer01\LibShare"

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-UseAlternateDataStream

Specifies whether or not to use the Use AlternateDataStream.

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-VMMServer

Specifies a VMM server object.

Type:ServerConnection
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

Outputs

LibraryShare

This cmdlet returns a LibraryShare object.