Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Note: Not all environments use the home directory attribute. Also, if a user goes idle for a period of time, network drive letters go into a disconnected state and until the user attempts to access them. In both of these situations, a test for a user accessing the share may fail. Another issue might be if the user is logged on to multiple workstations as I'm not sure if each separate logged on location is reported with this method.
:IDgetLoggedIn BoxText("Finding Logged in Machines...") ErrorMode(@OFF) oUser = ObjectOpen(StrCat("WinNT://" , Domain , "/" , User, ",user")) ErrorMode(@CANCEL) If oUser == 0 Then IDGetLoggedInMess=StrCat("Cannot locate Domain: " , Domain , " or user account: " , User, " does not exists.") If oUser == 0 Then Return userHome = oUser.HomeDirectory If userHome == "" Then IDGetLoggedInMess=StrCat("Home Server for user ", User," not specified.") If userHome == "" Then Return sName = Arrayize(userHome, "\") fService = ObjectOpen(StrCat("WinNT://" , Domain , "/" , sName[2] , "/LanmanServer")) ss = fService.Sessions LoggedOn = "" hEnum = ObjectCollectionOpen(ss) While 1 Session = ObjectCollectionNext(hEnum) If Session == 0 Then Break If StrLower(Session.User) == StrLower(User) LoggedOn = StrCat(LoggedOn ,@TAB, Session.Computer) EndIf ObjectClose(Session) EndWhile ObjectCollectionClose(hEnum) If LoggedOn == "" IDGetLoggedInMess=StrCat("User: " , User," is not logged on.") Else IDGetLoggedInMess=LoggedOn EndIf ObjectClose(fService) ObjectClose(oUser) Return
Article ID: W17091
File Created: 2007:07:03:14:28:16
Last Updated: 2007:07:03:14:28:16