Don't attempt to enforce ownership/permissions in windows

This commit restricts the fix from pull request #8417 to non-windows
minions, and also applies it to file.copy.