Use Powershell to read XML comments

view full story

http://serverfault.com – So I'm working on a way to use Powershell to get a list of scheduled tasks. Through my research, I determined that the only way to get "most" tasks is to use SCHTASKS. This command does allow for XML output which you can push right into a variable: $tasks = [xml](SCHTASKS /QUERY /XML ONE) Now, the problem comes up is that the task name is stored as an XML comment. When added to tasks object, all of this data is stored under the "#comment" key. Using normal addressing rules, you would be accessing: $tasks.Tasks.#comment The above doesn't work of course because the number sign is a special (HowTos)