Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Service to Logoff/Disconnect/Reboot Computer

Service to Logoff/Disconnect/Reboot Computer

Scheduled Pinned Locked Moved Visual Basic
databasewindows-adminquestion
3 Posts 2 Posters 8 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Member 14623989
    wrote on last edited by
    #1

    I have a service that will perform some kind of action depending on what the SessionChangeDescription is. The service is installed on a computer that autologs in. To make this happen this registry value needs to be set and is set during OnStart: Key: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon Value: AutoAdminLogon Data: 1 There is a Windows Form that will allow a domain user to log in and the service will change the AutoAdminLogon value to a 0. When a power outage occurs and power is restored the PC, the computer does not autologon cause the registry value AutoAdminLogon is not set back to a 1 yet. I normally just send a logoff, tsdiscon, or restart to the computer through SCCM and it will autolog again. These are my questions: 1. Is it possible to logoff or disconnect a session through the service at a logon screen? 2. Is it possible to trigger one of the SessionChangeDescription without any session changes? 3. Restart the computer through the service? What I have tried: At OnStart, get the AutoAdminLogon value and if it a 0, then do one of these: ExitWindowsEx function, WTSDisconnectSession function, wmi to logoff a session, tsdiscon.exe, logoff.exe, shutdown.exe, and LockWorkstation function. None of them work. If I do the same through SCCM, the computer autologs in.

    M S 2 Replies Last reply
    0
    • M Member 14623989

      I have a service that will perform some kind of action depending on what the SessionChangeDescription is. The service is installed on a computer that autologs in. To make this happen this registry value needs to be set and is set during OnStart: Key: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon Value: AutoAdminLogon Data: 1 There is a Windows Form that will allow a domain user to log in and the service will change the AutoAdminLogon value to a 0. When a power outage occurs and power is restored the PC, the computer does not autologon cause the registry value AutoAdminLogon is not set back to a 1 yet. I normally just send a logoff, tsdiscon, or restart to the computer through SCCM and it will autolog again. These are my questions: 1. Is it possible to logoff or disconnect a session through the service at a logon screen? 2. Is it possible to trigger one of the SessionChangeDescription without any session changes? 3. Restart the computer through the service? What I have tried: At OnStart, get the AutoAdminLogon value and if it a 0, then do one of these: ExitWindowsEx function, WTSDisconnectSession function, wmi to logoff a session, tsdiscon.exe, logoff.exe, shutdown.exe, and LockWorkstation function. None of them work. If I do the same through SCCM, the computer autologs in.

      M Offline
      M Offline
      Member 14623989
      wrote on last edited by
      #2

      Nevermind. Looks like I guessed a bunch of times and was able to figure it out. Even though in SCCM, I only use tsdiscon and the account used is the SYSTEM account, it works. It doesn't apply in this scenario. Using tsdiscon 1 (Session 1) works or WTSDisconnectSession function with a 1 for Session 1 also works.

      1 Reply Last reply
      0
      • M Member 14623989

        I have a service that will perform some kind of action depending on what the SessionChangeDescription is. The service is installed on a computer that autologs in. To make this happen this registry value needs to be set and is set during OnStart: Key: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon Value: AutoAdminLogon Data: 1 There is a Windows Form that will allow a domain user to log in and the service will change the AutoAdminLogon value to a 0. When a power outage occurs and power is restored the PC, the computer does not autologon cause the registry value AutoAdminLogon is not set back to a 1 yet. I normally just send a logoff, tsdiscon, or restart to the computer through SCCM and it will autolog again. These are my questions: 1. Is it possible to logoff or disconnect a session through the service at a logon screen? 2. Is it possible to trigger one of the SessionChangeDescription without any session changes? 3. Restart the computer through the service? What I have tried: At OnStart, get the AutoAdminLogon value and if it a 0, then do one of these: ExitWindowsEx function, WTSDisconnectSession function, wmi to logoff a session, tsdiscon.exe, logoff.exe, shutdown.exe, and LockWorkstation function. None of them work. If I do the same through SCCM, the computer autologs in.

        S Offline
        S Offline
        Stefan Robin
        wrote on last edited by
        #3

        Are you looking to build a successful career as an Azure Architect Technologies? Microsoft certifications are the go-to standard by which employers can assess your skills and credentials. By taking the AZ-303 exam, you will be able to prove that you have the experience necessary to take on any potential project.

        This guide is about steps you can take before having your AZ-303 questions answered.

        Who is the AZ-303 Azure Architect Technologies Exam For?

        The AZ-303 exam is designed for individuals with some experience architecting complex solutions for Azure. The AZ-303 certification exam aims to prove that you know how to handle scenarios that could arise for Architects who design solutions for the cloud. It's no surprise that preparing yourself for the AZ-303 exam is not easy. That's why it takes more than just a quick Google search to discover how to become an Azure Architect Technologies.

        What Do I Need To Know About The AZ-303 Exam?

        The Microsoft AZ-303 exam is a 3-hour, 70-question assessment that tests your knowledge of architecture principles, patterns, and practices. The exam is divided into three sections: Section 1 includes 35 questions and covers Azure AD/Office 365 integration, Azure Resource Management (ARM) constructs, advanced networking constructs, and hybrid cloud concepts. Section 2 includes 35 questions and covers Azure Active Directory (Azure AD) identity foundations, Microsoft Intune, and cloud identity & access infrastructure. Section 3 includes 20 questions and covers architecting for availability and disaster recovery in the Microsoft Cloud.

        What is the AZ-303 Certification Exam Format?

        AZ-303 exam questions are broken down into 3 sections you'll need to take one at a time. The first two sections are 70 questions each, and there is a short break between each section. The third section of the AZ-303 exam consists of 20 questions and is to be taken immediately after the second section. That's 100 total questions, so you

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups