Add-SCLibraryShare

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

Description

The Add-SCLibraryShare cmdlet adds Windows shares on the file system of a library server to the System Center 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.

For more information about Add-SCLibraryShare, type: "Get-Help Add-SCLibraryShare -online".

Parameters

SharePath

Required? true
Accept Pipeline Input? false
Position? 0
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"

AddDefaultResources

Required? false
Accept Pipeline Input? false
Position? named
Indicates that the default resources for a library share are added.

Credential

Required? false
Accept Pipeline Input? false
Position? named
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".

Description

Required? false
Accept Pipeline Input? false
Position? named
States a description for the specified object.

JobGroup

Required? false
Accept Pipeline Input? false
Position? named
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. 

JobVariable

Required? false
Accept Pipeline Input? false
Position? named
Specifies that job progress is tracked and stored in the variable named by this parameter. 

PROTipID

Required? false
Accept Pipeline Input? false
Position? named
Specifies the ID of the PRO tip that triggered this action. This allows for auditing of PRO tips.

RunAsynchronously

Required? false
Accept Pipeline Input? false
Position? named
Indicates that the job runs asynchronously so that control returns to the command shell immediately. 

VMMServer

Required? false
Accept Pipeline Input? true (ByValue)
Position? named
Specifies a VMM server object.

Examples

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. 
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.

See Also