/// <summary> /// Return all the logged users on the computer. Note that local system account will /// also be returned /// </summary> /// <param name="force">True to ignore any cache</param> /// <returns>ALl the logged users</returns> public async Task <IEnumerable <User> > getAllLoggedUsers(bool force = false) { TimeSpan diff = DateTime.Now - lastUsersFetch; if (force || diff.TotalMilliseconds > maxCacheLife || cachedUsers == null) { cachedUsers = await WMIExecutor.getLoggedUsers(this); lastUsersFetch = DateTime.Now; } return(cachedUsers); }
/// <summary> /// Return all the logged users on the computer. Note that local system account will /// also be returned /// </summary> /// <returns>ALl the logged users</returns> public static async Task <IEnumerable <User> > getAllLoggedUsers(Computer computer) { return(await WMIExecutor.getLoggedUsers(computer)); }
/// <summary> /// Return the logged users on the computed. Note that only real user accounts will /// be returned /// </summary> /// <returns>The logged user</returns> public static async Task <IEnumerable <User> > getLoggedUsers(Computer computer) { return((await WMIExecutor.getLoggedUsers(computer)).Where(u => u.SIDType == 1)); }