How to Detect Other Windows Logons
During an install, is there a way to detect if there are other Window users logged into the machine? I want to prevent installation if there are other users logged on.
Archive: How to Detect Other Windows Logons
How to Detect Other Windows Logons
During an install, is there a way to detect if there are other Window users logged into the machine? I want to prevent installation if there are other users logged on.
You can write a plug-in that'd use WTSEnumerateSessions or call it using the System plug-in.
Yep, I've started down that path already. I wrote a small C++ program to experiment with WTSEnumerateSessions, which works nicely.
Unfortunately, it will be a bit of a pain in NSIS due to the memory pointer it returns to an array of structures. Can you point me to any sample NSIS code that does something similar (use a pointer to walk an array of structs)?
In the plugin you already wrote, just add another function that can return the appropriate data you need to the installer via the NSIS stack.
You said you wanted to find out if another user is logged on, there's no need to return an array to the script for that. Have the plug-in check if there's more than one session and return a simple string.
If you want to return an array anyway, check out:
http://nsis.sourceforge.net/Enumerate_CD-ROM_Drives
Logged on more than one user detection
Hi JoeAcunzo,
I try to figure out as well if other users are logged on to the system at install time.
Could you please post your solution how to detect if multiple users are logged on.
Thank you very much for your help.
M.
Hello
I try to figure out as well if other users are logged on to the system at install time.
Could you please post your solution how to detect if multiple users are logged on.
i need it thanks
BUMP
Ok i try my best to fine solution and as my little knowledge in scripting i was not successes man in this case
i read whole of forum
and wiki and read me and hep file
as i don't want to create new topic with the same tile so decide to pop up this old topic the only one that discuss about detecting multiuser login in one system
what i need exactly?
i need a solution to detect if another user except current user are log in to the system or not and if it is force them to log off
i know all of you are busy but i will wait for your answer because i can;t down anything else i am newbie in everything :(
any help...
any little suggestion...
Thanks
I supplied the answer in my first reply.
please explain more how can i call WTSEnumerateSessions with system?
is there more simple way to detect if a user is log in or not? :(
!include LogicLib.nsh
#...
System::Call 'wtsapi32::WTSEnumerateSessions(i 0, i 0, i 1, *i .r0, *i .r1) i .r2'
${If} $2 != 0
${If} $1 != 1
MessageBox MB_OK "more than one user logged in"
${EndIf}
System::Call 'wtsapi32::WTSFreeMemory(i r0)'
${EndIf}
thank you very much
and worked for me
but how can i forced the other users log of after detecting other users are log in?
sorry i try it vut dowsent work correctly
in your cod wht is $2?
$2 is zero for me as it should always be.
WTSLogoffSession can be used to logoff sessions.
you said:
WTSLogoffSession can be used to log off sessions.
I used a shutdown plug in for force current user to log off
but if i understand right i can use WTSLogoffSession for forcing other user to log off. am i in true way?
Yes.
i c. so which parameter do i need to work on it?
hServer
ppSessionInfo
pCount
adn how tell this function to log off other user?
WTSEnumerateSessions will give you an array of WTS_SESSION_INFO structures and each one contains a SessionId for a given active session. Use kichik's code for the WTSEnumerateSessions function but do not call the WTSFreeMemory function before you extract the info you need from the structures that reside in $0.
Then call the WTSLogoffSession with one of the extracted SessionIds in order to logoff that session ...
Hope this helps ...
CF