foreach ($folder in $xmlfile.configuration.folders.folder) { #Do stuff }