dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Page 2 of 4 FirstFirst 1234 LastLast
Results 16 to 30 of 51

Thread: How to Detect if a Remote Computer is logged on?

  1. #16
    L.J. Johnson Guest

    Re: How to Detect if a Remote Computer is logged on?

    Tor,

    > Is there a way to check if a remote Win2K computer is logged on?
    > The purpose is to see if computers are ocupied or if they are "free" for
    > access...


    This is turning out to be more difficult than I would I thought...

    You can set the Audit Policy on each W2K machine (Local Security Settings
    ==> Local Policies ==>Audit Policy ==> Audit Logon Events to audit both
    success and failure. Then, using the registry functions (which work for
    remote machines), you can grab all the applicable items from the security
    event log of the remote computer (you can grab just the eventIDs you need --
    Logon/Logoff is 529, I think).

    A little text parsing should then give you a 90% solution. It still probably
    won't handle the case where the user just hit the reset button, then didn't
    login. You text parsing should be able to check if they hit the reset, but
    *did* logon (ie, there will be a logon event without a logout, but then a
    more recent logon).

    I passed the question to a friend who is deep into the Windows internals,
    and here is his response...

    ****************************************************************************
    ***
    >> Is there a way, *without* installing some program on each machine, to
    >> tell whether a particular machine has an interactive user logged in (or

    is
    >> sitting at the Ctrl-Alt-Delete prompt)? It should also be able to
    >> distinguish if a machine is simply locked, or the user has logged out.


    > In a word: No. The closest you can get remotely is NetWkstaUserEnum(),
    > but that includes all non-network logons -- i.e., services, too.
    >
    > If you want "guaranteed", you'll have to install a GINA notify DLL
    > (works only with MS GINA, and only on NT 5 and up) or a GINA stub (loads
    > of hassle, may conflict with non-MS GINAs), or a driver (that works
    > fine). In fact, just that functionality is part of some of our drivers
    > here, but to rewrite it in a stand-alone sample, and to give it a
    > user-mode-callable IOCTL interface takes more time than I have right
    > now.


    --
    L.J. Johnson, Slightly Tilted Software
    Microsoft MVP (Visual Basic)
    LJJohnson@SlightlyTiltedSoftware.com or LJJohnson@mvps.org
    <http://www.SlightlyTiltedSoftware.com>
    Ask The NT Pro at <http://www.devx.com/gethelp>



  2. #17
    L.J. Johnson Guest

    Re: How to Detect if a Remote Computer is logged on?

    Tor,

    > Is there a way to check if a remote Win2K computer is logged on?
    > The purpose is to see if computers are ocupied or if they are "free" for
    > access...


    This is turning out to be more difficult than I would I thought...

    You can set the Audit Policy on each W2K machine (Local Security Settings
    ==> Local Policies ==>Audit Policy ==> Audit Logon Events to audit both
    success and failure. Then, using the registry functions (which work for
    remote machines), you can grab all the applicable items from the security
    event log of the remote computer (you can grab just the eventIDs you need --
    Logon/Logoff is 529, I think).

    A little text parsing should then give you a 90% solution. It still probably
    won't handle the case where the user just hit the reset button, then didn't
    login. You text parsing should be able to check if they hit the reset, but
    *did* logon (ie, there will be a logon event without a logout, but then a
    more recent logon).

    I passed the question to a friend who is deep into the Windows internals,
    and here is his response...

    ****************************************************************************
    ***
    >> Is there a way, *without* installing some program on each machine, to
    >> tell whether a particular machine has an interactive user logged in (or

    is
    >> sitting at the Ctrl-Alt-Delete prompt)? It should also be able to
    >> distinguish if a machine is simply locked, or the user has logged out.


    > In a word: No. The closest you can get remotely is NetWkstaUserEnum(),
    > but that includes all non-network logons -- i.e., services, too.
    >
    > If you want "guaranteed", you'll have to install a GINA notify DLL
    > (works only with MS GINA, and only on NT 5 and up) or a GINA stub (loads
    > of hassle, may conflict with non-MS GINAs), or a driver (that works
    > fine). In fact, just that functionality is part of some of our drivers
    > here, but to rewrite it in a stand-alone sample, and to give it a
    > user-mode-callable IOCTL interface takes more time than I have right
    > now.


    --
    L.J. Johnson, Slightly Tilted Software
    Microsoft MVP (Visual Basic)
    LJJohnson@SlightlyTiltedSoftware.com or LJJohnson@mvps.org
    <http://www.SlightlyTiltedSoftware.com>
    Ask The NT Pro at <http://www.devx.com/gethelp>



  3. #18
    Chris Dengler Guest

    Re: How to Detect if a Remote Computer is logged on?

    PMFJI but I've been watching this thread with some interest ...

    Doesn't the logged-in user create an entry in the local machine's NETBIOS
    name table? And if so, could this not be queried by emulating the remote
    calls made by nbtstat -a (or -A)?

    Of course this is dependent on a couple of assumptions but .... or am I way
    of the mark?

    ....Chris.


    "L.J. Johnson" <LJJohnson@SlightlyTiltedSoftware.com> wrote in message
    news:3b6db98e$1@news.devx.com...
    > Tor,
    >
    > > Is there a way to check if a remote Win2K computer is logged on?
    > > The purpose is to see if computers are ocupied or if they are "free" for
    > > access...

    >
    > This is turning out to be more difficult than I would I thought...
    >


    [snipped]



  4. #19
    Chris Dengler Guest

    Re: How to Detect if a Remote Computer is logged on?

    PMFJI but I've been watching this thread with some interest ...

    Doesn't the logged-in user create an entry in the local machine's NETBIOS
    name table? And if so, could this not be queried by emulating the remote
    calls made by nbtstat -a (or -A)?

    Of course this is dependent on a couple of assumptions but .... or am I way
    of the mark?

    ....Chris.


    "L.J. Johnson" <LJJohnson@SlightlyTiltedSoftware.com> wrote in message
    news:3b6db98e$1@news.devx.com...
    > Tor,
    >
    > > Is there a way to check if a remote Win2K computer is logged on?
    > > The purpose is to see if computers are ocupied or if they are "free" for
    > > access...

    >
    > This is turning out to be more difficult than I would I thought...
    >


    [snipped]



  5. #20
    L.J. Johnson Guest

    Re: How to Detect if a Remote Computer is logged on?

    Chris,

    > Doesn't the logged-in user create an entry in the local machine's NETBIOS
    > name table? And if so, could this not be queried by emulating the remote
    > calls made by nbtstat -a (or -A)?


    Starting with W2K, NetBIOS over TCP/IP (NetBT) is no longer required, nor it
    is recommended (although there are a number of good reasons to keep it,
    including programs that won't run without it). I'm not sure what effect this
    would have on nbstat, but I would suspect it wouldn't work.

    Also, I'm not sure what that would accomplish. I ran it when I wasn't logged
    on to a remote W2K workstation, then again when I was logged on. The results
    were exactly the same. And the remote W2K workstation had been logged off at
    least 4 hours.

    Also, in case anyone asks, NT/W2K/Whistler PDCs/Domain Controller do *not*
    keep up with what users/machines have logged in/logged out. I'm told this is
    a performance issue.

    --
    L.J. Johnson, Slightly Tilted Software
    Microsoft MVP (Visual Basic)
    LJJohnson@SlightlyTiltedSoftware.com or LJJohnson@mvps.org
    <http://www.SlightlyTiltedSoftware.com>
    Ask The NT Pro at <http://www.devx.com/gethelp>




  6. #21
    L.J. Johnson Guest

    Re: How to Detect if a Remote Computer is logged on?

    Chris,

    > Doesn't the logged-in user create an entry in the local machine's NETBIOS
    > name table? And if so, could this not be queried by emulating the remote
    > calls made by nbtstat -a (or -A)?


    Starting with W2K, NetBIOS over TCP/IP (NetBT) is no longer required, nor it
    is recommended (although there are a number of good reasons to keep it,
    including programs that won't run without it). I'm not sure what effect this
    would have on nbstat, but I would suspect it wouldn't work.

    Also, I'm not sure what that would accomplish. I ran it when I wasn't logged
    on to a remote W2K workstation, then again when I was logged on. The results
    were exactly the same. And the remote W2K workstation had been logged off at
    least 4 hours.

    Also, in case anyone asks, NT/W2K/Whistler PDCs/Domain Controller do *not*
    keep up with what users/machines have logged in/logged out. I'm told this is
    a performance issue.

    --
    L.J. Johnson, Slightly Tilted Software
    Microsoft MVP (Visual Basic)
    LJJohnson@SlightlyTiltedSoftware.com or LJJohnson@mvps.org
    <http://www.SlightlyTiltedSoftware.com>
    Ask The NT Pro at <http://www.devx.com/gethelp>




  7. #22
    Chris Dengler Guest

    Re: How to Detect if a Remote Computer is logged on?

    Ahh...okay. Come to think of it, I've only seen this with NT4 DC / WINS
    environments.

    ....Chris.

    "L.J. Johnson" wrote in message ...

    [snipped]

    > Also, I'm not sure what that would accomplish. I ran it when I wasn't

    logged
    > on to a remote W2K workstation, then again when I was logged on. The

    results
    > were exactly the same. And the remote W2K workstation had been logged off

    at
    > least 4 hours.





  8. #23
    Chris Dengler Guest

    Re: How to Detect if a Remote Computer is logged on?

    Ahh...okay. Come to think of it, I've only seen this with NT4 DC / WINS
    environments.

    ....Chris.

    "L.J. Johnson" wrote in message ...

    [snipped]

    > Also, I'm not sure what that would accomplish. I ran it when I wasn't

    logged
    > on to a remote W2K workstation, then again when I was logged on. The

    results
    > were exactly the same. And the remote W2K workstation had been logged off

    at
    > least 4 hours.





  9. #24
    Ben Neville Guest

    Re: How to Detect if a Remote Computer is logged on?

    L.J.

    I have seen the same thing on NT 4.0. The only time I have seen this happen
    is if you log on with an account which is also used for a service on the
    workstation. In this case the volatile environment subkey remains upon
    logging the interactive user out.

    In 99% of cases you will find that the accounts you use to log in
    interactivly will be different to those that you use for services. When you
    log out and the account is not used anywhere else on the system (i.e. not by
    a service) the subkey under HKEY_USERS for the particular users SID should
    disappear altogether.

    In your testing was there a service using the same account you had used for
    an interactive login.

    Will see if I can think of some other simple method.

    Rgds
    Ben

    "L.J. Johnson" <LJJohnson@SlightlyTiltedSoftware.com> wrote in message
    news:3b6d937e$1@news.devx.com...
    > Ben,
    >
    > > Enumerate the registry sub keys (SIDS) contained under HKEY_USERS. In

    each
    > > sub key look for a key called "Volatile Environment".
    > >
    > > Those with this value should belong to interactively logged on users.

    > Those
    > > without this key are normally service or batch jobs.

    >
    > Just checked on my W2k network. Logged off one of the W2K workstations.
    > However, the registry still shows the "Volatile Environment" subkey. So,

    it
    > looks like this will show that a particular user is an interactive user,

    but
    > not whether that particular user is logged on (which, AFAIK, was the point
    > of the original question -- i.e, whether *any* interactive users were

    logged
    > in currently).
    >
    > --
    > L.J. Johnson, Slightly Tilted Software
    > Microsoft MVP (Visual Basic)
    > LJJohnson@SlightlyTiltedSoftware.com or LJJohnson@mvps.org
    > <http://www.SlightlyTiltedSoftware.com>
    > Ask The NT Pro at <http://www.devx.com/gethelp>
    >
    > "Ben Neville" <bneville@programmer.net> wrote in message
    > news:3b6a0d27$1@news.devx.com...
    > > Tor,
    > >
    > > Here is one possibility.
    > >
    > >
    > > Hence if you find a volatile environment section there would normally be

    > an
    > > interactively logged on user. This can easily be done remotely.
    > >
    > > From what I have seen this works on NT4.0. I am not 100 % sure about on
    > > Win2K but it could be worth a shot.
    > >
    > > Rgds
    > > Ben
    > >
    > >
    > > "L.J. Johnson" <LJJohnson@SlightlyTiltedSoftware.com> wrote in message
    > > news:3b696b4b@news.devx.com...
    > > > Tor,
    > > >
    > > > > Is there a way to check if a remote Win2K computer is logged on?
    > > > > The purpose is to see if computers are ocupied or if they are "free"

    > for
    > > > > access...
    > > >
    > > > I don't know of a way. If you had a small ActiveX exe running on each
    > > > machine, I can think of a couple of possibilities. And, the

    > > NetWkstaUserEnum
    > > > looks interesting (I haven't used this particular API) --
    > > >
    > > > "The NetWkstaUserEnum function lists information about all users

    > currently
    > > > logged on to the workstation. This list includes interactive, service

    > and
    > > > batch logons."
    > > >
    > > > However, it doesn't give a way to distinguish between the various

    users.
    > > > Bummer.
    > > >
    > > > --
    > > > L.J. Johnson, Slightly Tilted Software
    > > > Microsoft MVP (Visual Basic)
    > > > LJJohnson@SlightlyTiltedSoftware.com or LJJohnson@mvps.org
    > > > <http://www.SlightlyTiltedSoftware.com>
    > > > Ask The NT Pro at <http://www.devx.com/gethelp>
    > > >
    > > >
    > > >

    > >
    > >

    >
    >




  10. #25
    Ben Neville Guest

    Re: How to Detect if a Remote Computer is logged on?

    L.J.

    I have seen the same thing on NT 4.0. The only time I have seen this happen
    is if you log on with an account which is also used for a service on the
    workstation. In this case the volatile environment subkey remains upon
    logging the interactive user out.

    In 99% of cases you will find that the accounts you use to log in
    interactivly will be different to those that you use for services. When you
    log out and the account is not used anywhere else on the system (i.e. not by
    a service) the subkey under HKEY_USERS for the particular users SID should
    disappear altogether.

    In your testing was there a service using the same account you had used for
    an interactive login.

    Will see if I can think of some other simple method.

    Rgds
    Ben

    "L.J. Johnson" <LJJohnson@SlightlyTiltedSoftware.com> wrote in message
    news:3b6d937e$1@news.devx.com...
    > Ben,
    >
    > > Enumerate the registry sub keys (SIDS) contained under HKEY_USERS. In

    each
    > > sub key look for a key called "Volatile Environment".
    > >
    > > Those with this value should belong to interactively logged on users.

    > Those
    > > without this key are normally service or batch jobs.

    >
    > Just checked on my W2k network. Logged off one of the W2K workstations.
    > However, the registry still shows the "Volatile Environment" subkey. So,

    it
    > looks like this will show that a particular user is an interactive user,

    but
    > not whether that particular user is logged on (which, AFAIK, was the point
    > of the original question -- i.e, whether *any* interactive users were

    logged
    > in currently).
    >
    > --
    > L.J. Johnson, Slightly Tilted Software
    > Microsoft MVP (Visual Basic)
    > LJJohnson@SlightlyTiltedSoftware.com or LJJohnson@mvps.org
    > <http://www.SlightlyTiltedSoftware.com>
    > Ask The NT Pro at <http://www.devx.com/gethelp>
    >
    > "Ben Neville" <bneville@programmer.net> wrote in message
    > news:3b6a0d27$1@news.devx.com...
    > > Tor,
    > >
    > > Here is one possibility.
    > >
    > >
    > > Hence if you find a volatile environment section there would normally be

    > an
    > > interactively logged on user. This can easily be done remotely.
    > >
    > > From what I have seen this works on NT4.0. I am not 100 % sure about on
    > > Win2K but it could be worth a shot.
    > >
    > > Rgds
    > > Ben
    > >
    > >
    > > "L.J. Johnson" <LJJohnson@SlightlyTiltedSoftware.com> wrote in message
    > > news:3b696b4b@news.devx.com...
    > > > Tor,
    > > >
    > > > > Is there a way to check if a remote Win2K computer is logged on?
    > > > > The purpose is to see if computers are ocupied or if they are "free"

    > for
    > > > > access...
    > > >
    > > > I don't know of a way. If you had a small ActiveX exe running on each
    > > > machine, I can think of a couple of possibilities. And, the

    > > NetWkstaUserEnum
    > > > looks interesting (I haven't used this particular API) --
    > > >
    > > > "The NetWkstaUserEnum function lists information about all users

    > currently
    > > > logged on to the workstation. This list includes interactive, service

    > and
    > > > batch logons."
    > > >
    > > > However, it doesn't give a way to distinguish between the various

    users.
    > > > Bummer.
    > > >
    > > > --
    > > > L.J. Johnson, Slightly Tilted Software
    > > > Microsoft MVP (Visual Basic)
    > > > LJJohnson@SlightlyTiltedSoftware.com or LJJohnson@mvps.org
    > > > <http://www.SlightlyTiltedSoftware.com>
    > > > Ask The NT Pro at <http://www.devx.com/gethelp>
    > > >
    > > >
    > > >

    > >
    > >

    >
    >




  11. #26
    Ben Neville Guest

    Re: How to Detect if a Remote Computer is logged on?

    Tor,

    Depending on how the other half of this train works out I would think your
    simplest method would be to have a component on the web server connect to
    all the computers when someone requests that information. This would however
    be entirly dependant upon how many computers you have to talk to but if its
    less than 100 or so I think it would be your easiest approach.

    Rgds
    Ben

    "Tor Arne Nilsen" <tor.arne.nilsen@vbsoftdev.net> wrote in message
    news:3b6bcfb6@news.devx.com...
    > Ben,
    > The plan with the project is to finally get a WEB Page to display witch
    > computers that are in use and witch that is free. It is supposed to be

    used
    > in a Education Organization that will be providing it as a extra service

    for
    > the students. I wan't them to be able to see if there is computers that

    are
    > available for them or if all computers are in use for the moment.
    >
    > I know that there is some pearl code out there that can do this but

    finding
    > it is not to eazy, and specialy when i don't know anything about pearl.
    >
    > Rgds
    > Tor Arne Nilsen
    >
    > "Ben Neville" <bneville@programmer.net> wrote in message
    > news:3b6b62e8@news.devx.com...
    > > Tor,
    > >
    > > If you provide a clear description of what you are looking to achieve we
    > > could give a better recommendation here.
    > >
    > > E.G. If you want to create a program to use on a supervisor type

    computer
    > > that you can run on demand then why not just create a program that

    > connects
    > > to each PC in turn and then returns the results. This could be via a web
    > > page.
    > > If you want code that sits there and constantly updates with machines as
    > > they become free you could use a service type approach which would run

    on
    > > each PC and then make some sort of notification call to supervisor
    > > application which shows where the free seats are when a seat changes

    > status.
    > > I would think this is significantly more work but it would probably

    scale
    > > better if you want to monitor hundreds of PCs.
    > >
    > > Let us know the scope of the problems and the desired behaviour of you

    are
    > > looking to achieve so we can advise what approach would work best.
    > >
    > > Rgds
    > > Ben
    > >
    > > "Tor Arne Nilsen" <tor.arne.nilsen@vbsoftdev.net> wrote in message
    > > news:3b6a3e14@news.devx.com...
    > > > Ben,
    > > >
    > > > It looks like this will work. I have bin going through the HKEY_USERS

    > and
    > > it
    > > > is the same as in NT4.0.
    > > > Is there a eazy way to implement this check as a service on a

    > WinNT/Win2K
    > > > computer. Implementation of this as a DLL should not be so hard, but

    the
    > > > eazyest way to do this should be through a service. But im not shure

    how
    > I
    > > > should get this to work.
    > > >
    > > > Any ideas?
    > > >
    > > > Rgds,
    > > > Tor Arne Nilsen
    > > >
    > > >
    > > > "Ben Neville" <bneville@programmer.net> wrote in message
    > > > news:3b6a0d27$1@news.devx.com...
    > > > > Tor,
    > > > >
    > > > > Here is one possibility.
    > > > >
    > > > > Enumerate the registry sub keys (SIDS) contained under HKEY_USERS.

    In
    > > each
    > > > > sub key look for a key called "Volatile Environment".
    > > > >
    > > > > Those with this value should belong to interactively logged on

    users.
    > > > Those
    > > > > without this key are normally service or batch jobs.
    > > > >
    > > > > Hence if you find a volatile environment section there would

    normally
    > be
    > > > an
    > > > > interactively logged on user. This can easily be done remotely.
    > > > >
    > > > > From what I have seen this works on NT4.0. I am not 100 % sure about

    > on
    > > > > Win2K but it could be worth a shot.
    > > > >
    > > > > Rgds
    > > > > Ben
    > > > >
    > > > >
    > > > > "L.J. Johnson" <LJJohnson@SlightlyTiltedSoftware.com> wrote in

    message
    > > > > news:3b696b4b@news.devx.com...
    > > > > > Tor,
    > > > > >
    > > > > > > Is there a way to check if a remote Win2K computer is logged on?
    > > > > > > The purpose is to see if computers are ocupied or if they are

    > "free"
    > > > for
    > > > > > > access...
    > > > > >
    > > > > > I don't know of a way. If you had a small ActiveX exe running on

    > each
    > > > > > machine, I can think of a couple of possibilities. And, the
    > > > > NetWkstaUserEnum
    > > > > > looks interesting (I haven't used this particular API) --
    > > > > >
    > > > > > "The NetWkstaUserEnum function lists information about all users
    > > > currently
    > > > > > logged on to the workstation. This list includes interactive,

    > service
    > > > and
    > > > > > batch logons."
    > > > > >
    > > > > > However, it doesn't give a way to distinguish between the various

    > > users.
    > > > > > Bummer.
    > > > > >
    > > > > > --
    > > > > > L.J. Johnson, Slightly Tilted Software
    > > > > > Microsoft MVP (Visual Basic)
    > > > > > LJJohnson@SlightlyTiltedSoftware.com or LJJohnson@mvps.org
    > > > > > <http://www.SlightlyTiltedSoftware.com>
    > > > > > Ask The NT Pro at <http://www.devx.com/gethelp>
    > > > > >
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >




  12. #27
    Ben Neville Guest

    Re: How to Detect if a Remote Computer is logged on?

    Tor,

    Depending on how the other half of this train works out I would think your
    simplest method would be to have a component on the web server connect to
    all the computers when someone requests that information. This would however
    be entirly dependant upon how many computers you have to talk to but if its
    less than 100 or so I think it would be your easiest approach.

    Rgds
    Ben

    "Tor Arne Nilsen" <tor.arne.nilsen@vbsoftdev.net> wrote in message
    news:3b6bcfb6@news.devx.com...
    > Ben,
    > The plan with the project is to finally get a WEB Page to display witch
    > computers that are in use and witch that is free. It is supposed to be

    used
    > in a Education Organization that will be providing it as a extra service

    for
    > the students. I wan't them to be able to see if there is computers that

    are
    > available for them or if all computers are in use for the moment.
    >
    > I know that there is some pearl code out there that can do this but

    finding
    > it is not to eazy, and specialy when i don't know anything about pearl.
    >
    > Rgds
    > Tor Arne Nilsen
    >
    > "Ben Neville" <bneville@programmer.net> wrote in message
    > news:3b6b62e8@news.devx.com...
    > > Tor,
    > >
    > > If you provide a clear description of what you are looking to achieve we
    > > could give a better recommendation here.
    > >
    > > E.G. If you want to create a program to use on a supervisor type

    computer
    > > that you can run on demand then why not just create a program that

    > connects
    > > to each PC in turn and then returns the results. This could be via a web
    > > page.
    > > If you want code that sits there and constantly updates with machines as
    > > they become free you could use a service type approach which would run

    on
    > > each PC and then make some sort of notification call to supervisor
    > > application which shows where the free seats are when a seat changes

    > status.
    > > I would think this is significantly more work but it would probably

    scale
    > > better if you want to monitor hundreds of PCs.
    > >
    > > Let us know the scope of the problems and the desired behaviour of you

    are
    > > looking to achieve so we can advise what approach would work best.
    > >
    > > Rgds
    > > Ben
    > >
    > > "Tor Arne Nilsen" <tor.arne.nilsen@vbsoftdev.net> wrote in message
    > > news:3b6a3e14@news.devx.com...
    > > > Ben,
    > > >
    > > > It looks like this will work. I have bin going through the HKEY_USERS

    > and
    > > it
    > > > is the same as in NT4.0.
    > > > Is there a eazy way to implement this check as a service on a

    > WinNT/Win2K
    > > > computer. Implementation of this as a DLL should not be so hard, but

    the
    > > > eazyest way to do this should be through a service. But im not shure

    how
    > I
    > > > should get this to work.
    > > >
    > > > Any ideas?
    > > >
    > > > Rgds,
    > > > Tor Arne Nilsen
    > > >
    > > >
    > > > "Ben Neville" <bneville@programmer.net> wrote in message
    > > > news:3b6a0d27$1@news.devx.com...
    > > > > Tor,
    > > > >
    > > > > Here is one possibility.
    > > > >
    > > > > Enumerate the registry sub keys (SIDS) contained under HKEY_USERS.

    In
    > > each
    > > > > sub key look for a key called "Volatile Environment".
    > > > >
    > > > > Those with this value should belong to interactively logged on

    users.
    > > > Those
    > > > > without this key are normally service or batch jobs.
    > > > >
    > > > > Hence if you find a volatile environment section there would

    normally
    > be
    > > > an
    > > > > interactively logged on user. This can easily be done remotely.
    > > > >
    > > > > From what I have seen this works on NT4.0. I am not 100 % sure about

    > on
    > > > > Win2K but it could be worth a shot.
    > > > >
    > > > > Rgds
    > > > > Ben
    > > > >
    > > > >
    > > > > "L.J. Johnson" <LJJohnson@SlightlyTiltedSoftware.com> wrote in

    message
    > > > > news:3b696b4b@news.devx.com...
    > > > > > Tor,
    > > > > >
    > > > > > > Is there a way to check if a remote Win2K computer is logged on?
    > > > > > > The purpose is to see if computers are ocupied or if they are

    > "free"
    > > > for
    > > > > > > access...
    > > > > >
    > > > > > I don't know of a way. If you had a small ActiveX exe running on

    > each
    > > > > > machine, I can think of a couple of possibilities. And, the
    > > > > NetWkstaUserEnum
    > > > > > looks interesting (I haven't used this particular API) --
    > > > > >
    > > > > > "The NetWkstaUserEnum function lists information about all users
    > > > currently
    > > > > > logged on to the workstation. This list includes interactive,

    > service
    > > > and
    > > > > > batch logons."
    > > > > >
    > > > > > However, it doesn't give a way to distinguish between the various

    > > users.
    > > > > > Bummer.
    > > > > >
    > > > > > --
    > > > > > L.J. Johnson, Slightly Tilted Software
    > > > > > Microsoft MVP (Visual Basic)
    > > > > > LJJohnson@SlightlyTiltedSoftware.com or LJJohnson@mvps.org
    > > > > > <http://www.SlightlyTiltedSoftware.com>
    > > > > > Ask The NT Pro at <http://www.devx.com/gethelp>
    > > > > >
    > > > > >
    > > > > >
    > > > >
    > > > >
    > > >
    > > >

    > >
    > >

    >
    >




  13. #28
    L.J. Johnson Guest

    Re: How to Detect if a Remote Computer is logged on?

    Ben,

    > I have seen the same thing on NT 4.0. The only time I have seen this

    happen
    > is if you log on with an account which is also used for a service on the
    > workstation. In this case the volatile environment subkey remains upon
    > logging the interactive user out.


    <grumble, grumble, make me walk upstairs to check...>

    Nope, sorry. Not a single service as anything but local system.

    > In 99% of cases you will find that the accounts you use to log in
    > interactively will be different to those that you use for services.


    Maybe, but not in my experience. On workstations, I often use my logon for
    the SQL Server service.

    > When you
    > log out and the account is not used anywhere else on the system (i.e. not

    by
    > a service) the subkey under HKEY_USERS for the particular users SID should
    > disappear altogether.


    Well, mine didn't (after at least 4 hours of being logged out).

    --
    L.J. Johnson, Slightly Tilted Software
    Microsoft MVP (Visual Basic)
    LJJohnson@SlightlyTiltedSoftware.com or LJJohnson@mvps.org
    <http://www.SlightlyTiltedSoftware.com>
    Ask The NT Pro at <http://www.devx.com/gethelp>




  14. #29
    L.J. Johnson Guest

    Re: How to Detect if a Remote Computer is logged on?

    Ben,

    > I have seen the same thing on NT 4.0. The only time I have seen this

    happen
    > is if you log on with an account which is also used for a service on the
    > workstation. In this case the volatile environment subkey remains upon
    > logging the interactive user out.


    <grumble, grumble, make me walk upstairs to check...>

    Nope, sorry. Not a single service as anything but local system.

    > In 99% of cases you will find that the accounts you use to log in
    > interactively will be different to those that you use for services.


    Maybe, but not in my experience. On workstations, I often use my logon for
    the SQL Server service.

    > When you
    > log out and the account is not used anywhere else on the system (i.e. not

    by
    > a service) the subkey under HKEY_USERS for the particular users SID should
    > disappear altogether.


    Well, mine didn't (after at least 4 hours of being logged out).

    --
    L.J. Johnson, Slightly Tilted Software
    Microsoft MVP (Visual Basic)
    LJJohnson@SlightlyTiltedSoftware.com or LJJohnson@mvps.org
    <http://www.SlightlyTiltedSoftware.com>
    Ask The NT Pro at <http://www.devx.com/gethelp>




  15. #30
    Ben Neville Guest

    Re: How to Detect if a Remote Computer is logged on?

    L.J.

    This is an interesting one that I am going to look at this some more so I
    can understand it better.

    I would agree that in a home/testing environment and for small businesses
    that people may use their account for services etc. For the majority of
    larger businesses this is normally not the case. In any case this does not
    appear to be the problem for you.

    Don't mean to make you walk upstairs again but when your computer first
    loads does that sid get loaded under HKEY_USERS before you log in? Does
    every user you use have this subkey hang around or just your regular user?
    It really should get unloaded entirely when you log out unless something
    else is using it. In my experience the normal thing that makes a SID hang
    around under HKEY_USERS are services but I will do some more digging as I
    want to understand what could be causing the profile to not unload
    correctly.

    I have used this method in the past successfully for a couple of major
    projects so if there is something that will cause it to break in Win2K I
    need to find a good new and simple solution.

    Tor,

    If this appears to work successfully for you you could run with it otherwise
    there is some more potential solutions being worked out on the other train
    of this thread.

    Ben

    "L.J. Johnson" <LJJohnson@SlightlyTiltedSoftware.com> wrote in message
    news:3b6f7663@news.devx.com...
    > Ben,
    >
    > > I have seen the same thing on NT 4.0. The only time I have seen this

    > happen
    > > is if you log on with an account which is also used for a service on the
    > > workstation. In this case the volatile environment subkey remains upon
    > > logging the interactive user out.

    >
    > <grumble, grumble, make me walk upstairs to check...>
    >
    > Nope, sorry. Not a single service as anything but local system.
    >
    > > In 99% of cases you will find that the accounts you use to log in
    > > interactively will be different to those that you use for services.

    >
    > Maybe, but not in my experience. On workstations, I often use my logon for
    > the SQL Server service.
    >
    > > When you
    > > log out and the account is not used anywhere else on the system (i.e.

    not
    > by
    > > a service) the subkey under HKEY_USERS for the particular users SID

    should
    > > disappear altogether.

    >
    > Well, mine didn't (after at least 4 hours of being logged out).
    >
    > --
    > L.J. Johnson, Slightly Tilted Software
    > Microsoft MVP (Visual Basic)
    > LJJohnson@SlightlyTiltedSoftware.com or LJJohnson@mvps.org
    > <http://www.SlightlyTiltedSoftware.com>
    > Ask The NT Pro at <http://www.devx.com/gethelp>
    >
    >
    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center