Below is the code I am using. It works fine for the first Write-Host, and the folder name prints. In the second Write-Host, for both $item.Folder and $item.File it prints System.Xml.XmlElement instead of the variable. What am I doing wrong?
if (Test-Path "D:\Desktop\integrityCheck.xml"){
[xml]$list = Get-Content "D:\Desktop\integrityCheck.xml"
foreach ($item in $list.Programs.Program){
Write-Host $item.Folder
Write-Host "\\appsrv1\$item.Folder\$item.File"
}
}
if (Test-Path "D:\Desktop\integrityCheck.xml"){
[xml]$list = Get-Content "D:\Desktop\integrityCheck.xml"
foreach ($item in $list.Programs.Program){
Write-Host $item.Folder
Write-Host "\\appsrv1\$item.Folder\$item.File"
}
}