I have some code:
$foo = someFunction This outputs a warning message which I want to redirect to $null:
$foo = someFunction > $null The problem is that when I do this, while successfully supressing the warning message, it also has the negative side-effect of NOT populating $foo with the result of the function.
How do I redirect the warning to $null, but still keep $foo populated?
Also, how do you redirect both standard output and standard error to null? (In Linux, it's 2>&1.)

someFunction, you might change it appropriately.2>/dev/null 1>/dev/null; The redirect you've shown redirects stderr to the same place as stdout -- which may be/dev/null, or may be a regular file.