I was writing a console app that wanted to retrieve the same memory settings that show up in task manager. Here are the 4 properties, you just have to divide them by 1024 to get the Megabyte size.
Memory Usage = WorkingSetSize (WMI Property)
Peak Memory Usage = PeakWorkingSetSize (WMI Property)
VM Size = PageFileUsage
Peak VM Size = PeakPageFileSystem