Get-SCDirectoryChildItem

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

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

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

Path

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

Path

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

VMHost

Required? true
Accept Pipeline Input? true (ByValue)
Position? named
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.

Examples

1: Get the files and subdirectories for the specified path on a VMM host.
PS C:\> $VMHost = Get-SCVMHost -ComputerName "VMHost01"
PS C:\> Get-SCDirectoryChildItem -VMHost $VMHost -Path "C:\"
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.
2: Get the subdirectories for the specified path on a library server.
PS C:\> $LibServ = Get-SCLibraryServer -VMMServer "VMMServer01.Contoso.com" -ComputerName "FileServer01.Contoso.com"
PS C:\> Get-SCDirectoryChildItem -LibraryServer $LibServ -Path "\\FileServer01.Contoso.com\MSSCVMMLibrary"
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".

See Also