The Core Technologies Blog

Professional Software for Windows Services / 24×7 Operation


ChatGPT Knows Windows Services

ChatGPT Knows Windows Services

Like many folks this holiday season, we’ve been playing with OpenAI’s ChatGPT — the surprisingly conversational AI engine taking the world by storm.

We were particularly interested in what ChatGPT thinks of Windows Services, which are highly technical and often difficult to explain. Our company has been wrestling with them for years! 🙂

The rest of this article focuses on four questions we asked ChatGPT. For each question, we present the AI’s response and review the quality of the answer.

What is a Windows Service?

We figured we’d start with the basics. Here’s how ChatGPT defined a Windows Service:

  A Windows service is a program that is designed to run in the background and perform tasks without user interaction. Services are typically used to perform tasks that need to be run continuously, even when no user is logged in to the system.

Services are managed through the Windows Services Control Manager, which allows you to start, stop, and configure services on your system. You can access the Services Control Manager by going to the “Services” snap-in for the Microsoft Management Console (MMC).

Some examples of common Windows services include:

  • The Print Spooler, which manages print jobs and controls access to printers.

  • The Task Scheduler, which is used to schedule tasks to run at a specific time or when certain conditions are met.

  • The Windows Event Log, which records system events and allows you to view and manage event logs.

  • The Windows Update service, which checks for and installs updates for the operating system and installed applications.

Overall, Windows services are a useful tool for running background tasks and automating various system tasks and processes. They can help to improve the performance and reliability of your system, and can be configured to start automatically when the system starts up.

That’s a great answer. It’s accurate, provides examples and avoids the use of technical jargon. Impressive!

But many sites are great with definitions, which may be easier to source and regurgitate. Let’s increase the difficulty.

Why would I run an application as a Windows Service?

Next, we wanted to see how the AI tackles a real-world question that we are often presented with. Indeed, folks browsing our products often wonder why they should convert their application to run as a service.

ChatGPT posited:

  There are several reasons why you might run an application as a Windows Service:

  1. To perform tasks in the background: By running as a Windows Service, an application can perform tasks in the background, even when no user is logged on to the system. This can be useful for tasks that need to run continuously or on a schedule, such as data backup, virus scanning, or monitoring system performance.

  2. To provide services to other programs: By running as a Windows Service, an application can provide services to other programs, such as database access, web server functionality, or messaging capabilities.

  3. To improve system performance: By running in the background as a Windows Service, an application can help improve system performance by offloading tasks from the main user interface and allowing other programs to run more efficiently.

  4. To enhance security: By running as a Windows Service with a lower level of privileges than the main user interface, an application can help enhance security by preventing unauthorized access to system resources.

  5. To reduce maintenance: Because Windows Services run in the background and do not require user intervention, they can help reduce maintenance by running automatically and requiring less attention than other types of programs.

In summary, running an application as a Windows Service can be useful for performing tasks in the background, providing services to other programs, improving system performance, enhancing security, and reducing maintenance.

Another excellent answer!

We’ve been advising customers of the benefits of Windows Services for years and that response aligns with our thinking.

Let’s keep going. How does ChatGPT respond to a plea for help?

My Windows Service is stuck in the “Stopping” state. How do I fix it?

This is an issue faced by many of our customers (it’s covered in the Windows Services FAQ).

ChatGPT suggested a few practical remedies:

  If your Windows Service is stuck in the “Stopping” state and is not stopping or shutting down as expected, there are a few steps you can try to fix the issue:

  • Restart the service: Sometimes, simply restarting the service can resolve the issue. To restart the service, go to the Services control panel, right-click on the service, and select “Restart” from the menu.

  • End the process manually: If restarting the service does not resolve the issue, you can try ending the process manually. To do this, go to the Task Manager and find the process associated with the service. Right-click on the process and select “End task” to stop it.

  • Check the service logs: The service logs may provide information about why the service is not stopping as expected. To view the service logs, go to the Services control panel, right-click on the service, and select “Properties”. Then, go to the “Log On” tab and click the “Event Viewer” button to view the service logs.

  • Check for dependency issues: If the service has dependencies on other services, and those dependencies are not stopping as expected, this can cause the service to get stuck in the “Stopping” state. To check for dependency issues, go to the Services control panel, right-click on the service, and select “Properties”. Then, go to the “Dependencies” tab to see a list of services that the service depends on. If one of those services is not stopping as expected, this could be the cause of the issue.

  • Check for errors or issues in the service code: If none of the above steps resolve the issue, there may be an error or issue in the service code that is preventing it from stopping as expected. In this case, you may need to review the service code and try to identify and fix any errors or issues.

Another solid response. ChatGPT is 3 for 3!

But can the AI tell us something we don’t already know?

Tell me something obscure but useful about Windows Services

ChatGPT responded:

  One obscure but useful feature of Windows Services is the ability to specify a “dependency” on another service. When you specify a service as a dependency for another service, the dependent service will automatically start whenever the required service starts, and will automatically stop whenever the required service stops.

For example, suppose you have a service that performs data backups for your system. You might want this service to run every night at midnight, after all other user activity on the system has ceased. In this case, you could specify the “Workstation” service as a dependency for your backup service. The Workstation service is a built-in Windows service that manages network connections and file and printer sharing on the system. By specifying the Workstation service as a dependency, you can ensure that your backup service will only start when all network activity has stopped and all files are closed, which can help ensure that the backup process is successful.

This feature can be useful for setting up complex service dependencies and ensuring that services start and stop in the correct order. You can specify dependencies for a service using the “Dependencies” tab in the service’s properties in the Services control panel.

Interesting. This is the first time we’ve seen ChatGPT trip up.

While the ability to set a dependency is an advanced/obscure feature, there are a trio of problems with the answer:

  1. When you specify a service as a dependency for another service, it’s true that the dependent service will automatically start whenever the required service starts. However, despite what ChatGPT says, the dependent service will not stop when you stop the required service. The dependent service may keep running.

  2. Next, the example is inaccurate. Setting the backup service to depend on the Workstation service will not “ensure that your backup service will only start when all network activity has stopped and all files are closed”. That’s because the Workstation service doesn’t start or stop based on network activity.

  3. Finally, you cannot “specify dependencies for a service using the Dependencies tab in the service’s properties in the Services control panel”. In reality, that view is read-only and you can’t update dependencies there:

    Workstation service dependencies

But even more worrisome, the faulty answer has the air of authority. It will certainly seem plausible to folks unfamiliar with service dependencies — who will not be able to spot the inaccuracies!

Let’s try one more.

How do I find out who stopped my Windows Service?

This time, ChatGPT’s advice was on point:

  To find out who stopped your Windows Service, you can check the service logs in the Event Viewer. The service logs can provide information about when the service was stopped and who stopped it.

To view the service logs in the Event Viewer:

  1. Press the Windows key + R to open the Run dialog, then type “eventvwr.msc” and press Enter. This will open the Event Viewer.

  2. In the Event Viewer, expand the “Windows Logs” tree on the left and select the “System” log.

  3. In the System log, look for entries related to your service. These will typically be listed under the “Service Control Manager” source.

  4. Look for entries with the “Information” level that indicate that the service was stopped. These entries should include information about the time the service was stopped and the account that stopped it.

Keep in mind that the service logs may only contain information about the most recent service stops. If the service was stopped a long time ago, the log entries may have been purged.

You can also check the service’s properties in the Services control panel to see if the service is set to automatically start when the system starts up. If the service is set to start automatically, this could indicate that the service was stopped intentionally by an administrator or another service.

Conclusion: ChatGPT does a good job of answering questions involving Windows Services

Despite providing misleading advice in one situation, it seems that ChatGPT can be a credible source of information about Windows Services.

Indeed, in all our tests, ChatGPT’s provided answers that were relevant, free of techno-babble and full of actionable advice.

What’s your experience with ChatGPT?

Please leave a comment to let us know!

Posted in Windows Services | Tagged , , | 2 Comments

2 Responses to ChatGPT Knows Windows Services

  1. Andrew Burrell says:

    Nice article. I was thinking of how ChatGPT could help translate content in EventViewer – now that would be a welcome revelation! Half the time of looking in Event logs is trying to work out what events are relevant to the issue and then what they are actually pinpointing to.

    In you third question, I’ve never seen an Event Viewer button in the “Log On” tab. That would be another welcome feature!

  2. Thanks Andrew.

    Good catch on the third question. We missed that “hallucination“…

Leave a Reply

Your email address will not be published. Required fields are marked *