There are many different ways to do this, so it would help if we knew why/where you are trying to do this. Are you doing it in the logon script? Are you trying to export all user's display names?