Ja, du verstehst die Funktion falsch. Damit wird keine ID vergeben, sondern damit wird der Prozess gesucht, der die übergebene Id hat (und wenn dieser nicht existiert, eben eine Exception geworfen). Es macht also keinen Sinn, im Programmcode nach einer festen Id zu suchen (da diese von Windows bei jedem Programmstart selbständig vergeben wird - schau einfach im Task-Manager nach, evtl. mußt du "PID" noch als Spalte hinzufügen).
Was ist denn der Sinn bei deinem Code alle möglichen Process-Methoden auszuprobieren?