Get-SCDirectoryChildItem

Applies To: System Center 2012 - Virtual Machine Manager

Get-SCDirectoryChildItem

Gets all files and subdirectories in the specified directory on a virtual machine host or on a library server managed by VMM.

Syntax

Parameter Set: FromLibraryServer
Get-SCDirectoryChildItem -LibraryServer <LibraryServer> -Path <String> [ <CommonParameters>]

Parameter Set: FromVMHost
Get-SCDirectoryChildItem -Path <String> -VMHost <Host> [ <CommonParameters>]

Detailed Description

The Get-SCDirectoryChildItem gets all files and subdirectories immediately under the specified directory on a virtual machine host or on a library server managed by System Center Virtual Machine Manager (VMM). If you specify a share path (such as \\ServerName\ShareName\Directory\FileName), the subdirectories of the share path are returned.

If you use the Get-SCDirectoryChildItem cmdlet to retrieve files and subdirectories on a library server, you must specify a path to a valid library share. For example, the share path to the default library share installed by Setup when you first install VMM is: \\VMMServerName.DomainName.com\MSSCVMMLibrary

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

Parameters

-LibraryServer<LibraryServer>

Specifies a VMM library server object.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Path<String>

Specifies the destination path for the operation.

Example formats:

Local path -Path "F:\"

UNC path -Path "\\Library\Templates"

Volume GUID path -Path "\\?\Volume{4703c1ea-8ae7-11db-b473-00123f7603e3}\"

VMware ESX path "Path "[storage1]\MyVMwareFolderForVMs\MyVM.vmx"

Citrix XenServer path - Path "Local storage[99b6212f-b63d-c676-25f9-d6c460992de7]"

Wildcards are supported for "Get" cmdlets and when you specify the UNC path:

Example format:

UNC path -Path "\\VMHostServer\MyVMs\*VM*"

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VMHost<Host>

Specifies a virtual machine host object. VMM supports Hyper-V hosts, VMware ESX hosts, and Citrix XenServer hosts.

For more information about each type of host, type: "Get-Help Add-SCVMHost -detailed". See the examples for a specific cmdlet to determine how that cmdlet uses this parameter.

Aliases

none

Required?

true

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.

  • VMHostFileInformation

Examples

1: Get the files and subdirectories for the specified path on a VMM host.

The first command gets the host object named VMHost01 from the VMM database and stores the object in the $VMHost variable.

The second command displays the name and other information about each file and subdirectory immediately under the C:\ drive on VMHost01.

PS C:\> $VMHost = Get-SCVMHost -ComputerName "VMHost01"
PS C:\> Get-SCDirectoryChildItem -VMHost $VMHost -Path "C:\"

2: Get the subdirectories for the specified path on a library server.

The first command gets the library server object named FileServer01 from VMMServer01 and stores the object in the $LibServ variable.

The second command displays the name, parent directory, and other information about each file stored in the directory for the default library share on FileServer01. You must specify the complete path to the library share.

NOTE: This example assumes that the default VMM library share (MSSCVMMLibrary) is used in your environment. To get the names of library shares, type: "Get-SCLibraryShare | select Name".

PS C:\> $LibServ = Get-SCLibraryServer -VMMServer "VMMServer01.Contoso.com" -ComputerName "FileServer01.Contoso.com"
PS C:\> Get-SCDirectoryChildItem -LibraryServer $LibServ -Path "\\FileServer01.Contoso.com\MSSCVMMLibrary"

Get-SCLibraryServer

Get-SCVMHost