script to pull the user or users logged into a windows VM

Does anyone have a SAM script that would extract the users logged into a windows VM.