Tag Archives: Frontrange

Cataloging Exported packages from Frontrange Enteo / DSM 7 with Powershell.

This is just a quick powershell script I threw together to catalog exported packages.

By default when you export packages from Frontrange DSM (formerly Enteo) you end up with a large list of unique id’s with no real idea which package is which.

The below quick and dirty Powershell function will enumerate the xml file in each package folder and create a catalog which you can then export to csv if you wish.

To retrieve the list of packages and names, use the following command:

(where c:export is the location of your export)

get-DSMpackages -DirectoryPath "C:Export"

This will present itself as below:

To export the file to csv, try the following:

(where c:export is the location of your export, and you wish to save the csv file to c:exportcontents.csv)

get-DSMpackages -DirectoryPath "C:Export" | Export-Csv C:Exportcontents.csv -notypeinformation

This should create the csv file and look as follows:

Below is the function:

[sourcecode language=”Powershell”]
function get-DSMpackages{
param(
[Parameter(Mandatory = $true)]
[string]$DirectoryPath)

$result=@()

foreach ($folder in Get-ChildItem $directorypath | where {$_.psiscontainer -eq $true}){

[xml]$XMLBlock = get-content "$($folder.fullname)_ExpInfo.xml"
$name=$xmlblock.dsmexport.ArrayOfMdsObject.MdsObject.Name
if ($name -eq $null){
[xml]$XMLBlock = get-content "$($folder.fullname)_ExpInfo.xml"
$name=$xmlblock.dsmexport.ArrayOfMdsObject.mdsobject[0].name
}
$entry = New-Object PSObject -Property @{
Name=$Name
GUID=$folder.name}
$result+=$entry
}#end for
return ($result | sort name)
}#end function
[/sourcecode]