The username is get from logged user. If there is nobody logged, so ocs inventory show nobody and retrive no information.
There is no better way to do because in many case, you can have allready more than one user account (administrator and one simple user account for exemple) and there is no way to know who use the computer. In an Active Directory group, you can have 400 account able to connect on the computer too.