Partager via


Add-SCLibraryShare

Add-SCLibraryShare

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

Syntax

Parameter Set: Default
Add-SCLibraryShare [-SharePath] <String> [-AddDefaultResources] [-Credential <PSCredential> ] [-Description <String> ] [-JobGroup <Guid]> ] [-JobVariable <String> ] [-PROTipID <Guid]> ] [-RunAsynchronously] [-VMMServer <ServerConnection> ] [ <CommonParameters>]

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

Parameters

-AddDefaultResources

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Credential<PSCredential>

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.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Description<String>

States a description for the specified object.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-JobGroup<Guid]>

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.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-JobVariable<String>

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PROTipID<Guid]>

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RunAsynchronously

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-SharePath<String>

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"

Aliases

none

Required?

true

Position?

1

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 (https://go.microsoft.com/fwlink/p/?LinkID=113216).

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.

  • LibraryShare

Examples

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

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.

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

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

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

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

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 }

Find-SCLibraryShare

Get-SCDependentLibraryResource

Get-SCLibraryShare

Get-SCVMMServer

Read-SCLibraryShare

Remove-SCLibraryShare

Restart-SCJob

Set-SCLibraryShare