remove everything after first space in string

I have a .txt file and in this text file I have a list of macines that also have a description. Example:

PC12345 FIN - Finance Department
PC09876 HR - Human Resource Department

I want to grab just the PC name and delete everything else.

$text = get-content "C:\Temp\machines.txt"
foreach ($string in $text) {$string.Substring(0,$string.IndexOf(' ')) | out-file "C:\Temp\clean.txt" -append}

When I run this code it removes everything after the "second space" so I'm left with this:

PC12345 FIN
PC09876 HR

If I run the script a second time it does not remove the FIN or HR. How come?