Use LINQ expression to make code more readable.

Removed two Foreach statements to loop over the user and machine
Environment Variables by using LINQ expressions.