-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRead-AppInfoXMLFile.ps1
More file actions
22 lines (22 loc) · 1.07 KB
/
Read-AppInfoXMLFile.ps1
File metadata and controls
22 lines (22 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function Global:Read-AppInfoXMLFile {
param(
[Parameter(Mandatory=$true,
Position=0,
ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true)]
[string]$FullName
)
process {
#Write-LogEntry -Component $MyInvocation.MyCommand -FileName $Global:LogFileName -Severity 1 -Value "[Read-AppInfoXMLFile] Will process '$FullName'"
try {
$obj = New-Object PSObject
$obj | Add-Member XML ([xml](Get-Content -Raw -ErrorAction Stop -Path $FullName))
$obj | Add-Member Path (Split-Path -Path $FullName -Parent)
$obj | Add-Member Name (Split-Path -Path $obj.Path -Leaf)
#Write-LogEntry -Component $MyInvocation.MyCommand -FileName $Global:LogFileName -Severity 1 -Value "[Read-AppInfoXMLFile] Done processing '$FullName'"
$obj
} catch {
Write-LogEntry -Component $MyInvocation.MyCommand -FileName $Global:LogFileName -Severity 3 -Value "[Read-AppInfoXMLFile] Failed to process '$FullName'"
}
}
}