?
Solved

Disconnect Sessio

Posted on 2010-01-05
9
Medium Priority
?
364 Views
Last Modified: 2013-11-26
II need to disconnect a active session in a planned way. I used the object winmgmts but I not found the disconnect function but only the her'is a way to disconnect a session?
0
Comment
Question by:riccomondo
  • 5
  • 4
9 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 26188497
Are you talking about ASP.NET session or something else. Please descibe in details.
0
 

Author Comment

by:riccomondo
ID: 26188726
I'm using console application. The application starts from Sheduler, to do something and, at end, should disconnect the session.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 26188823
Forgive my ignorance but i still dont understand what session in involved with a console application.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:riccomondo
ID: 26195763
Sorry, the Windows session. I would just disconnect the user from the session from my Windows application
0
 

Author Comment

by:riccomondo
ID: 26200158
Curretly, I use the following code to Logoff the Windows session; I would like instead to disconnect instead of logoff.

    Private Sub Logoff()
        'Value   (Meaning)
        '0 (0x0) Log Off
        '4 (0x4) Forced Log Off (0 + 4)
        '1 (0x1) Shutdown
        '5 (0x5) Forced Shutdown (1 + 4)
        '2 (0x2) Reboot
        '6 (0x6) Forced Reboot (2 + 4)
        '8 (0x8) Power Off
        '12 (0xC) Forced Power Off (8 + 4)
        If My.Computer.FileSystem.FileExists(localDir & "CSC\Automatic.txt") = True Then
            Dim t As Single
            Dim objWMIService, objComputer As Object
            AddMessage("Logoff Windows user")
            'Now get some privileges
            objWMIService = GetObject("Winmgmts:{impersonationLevel=impersonate,(Debug,Shutdown)}")
            For Each objComputer In objWMIService.InstancesOf("Win32_OperatingSystem")
                t = objComputer.Win32Shutdown(4, 0)
                If t <> 0 Then
                    AddMessage("Error occurred during logoff!!!")
                End If
            Next
        End If
    End Sub
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 26200267
Is your console application running on the local computer? Does it close when its finished? What exactly you mean by disconnect? Is it a Terminal Services session?
0
 

Author Comment

by:riccomondo
ID: 26205285
What I'm exactly referring to is the action that happens after you click the button "Disconnect" if you are in the Users tab of the Task Manager.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 26208087
Not sure about that. If you are using impersonation to run a program in a different security context then logof that user using the impersonation itself. Is it Vista?
0
 

Accepted Solution

by:
riccomondo earned 0 total points
ID: 26390134
Unfortunately I think this problem is too complicated to explain and then close it
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question