Example Analysis of VB.NET Terminal Services Startup Mode
Editor to share with you an example analysis of the startup mode of VB.NET terminal services, I believe most people do not know much about it, so share this article for your reference. I hope you will gain a lot after reading this article. Let's learn about it together.
The Win32_TerminalService category provides terminal services load balancing indicators. The VB.NET Terminal Services startup mode code is as follows:
Imports System Imports System.Management Imports System.Windows.Forms Namespace WMISample Public Class CallWMIMethod Public Overloads Shared Function Main () As Integer Try Dim classInstance As New ManagementObject (_ "root\ CIMV2", _ "Win32_TerminalService", Nothing) 'Obtain [in] parameters for the method Dim inParams As ManagementBaseObject = _ classInstance.GetMethodParameters ("ChangeStartMode")' Add the input parameters. ' Execute the method and obtain the return values. Dim outParams As ManagementBaseObject = _ classInstance.InvokeMethod ("ChangeStartMode", inParams, Nothing) 'List outParams Console.WriteLine ("Out parameters:") Console.WriteLine ("ReturnValue: {0}", outParams ("ReturnValue")) Catch err As ManagementException MessageBox.Show ("An error occurred while trying to execute the WMI method:" & err.Message) End Try End Function End Class End Namespace
VB.NET Terminal Services startup mode comes with a parameter description:
The ChangeStartMode method changes the startup mode of the service. It will return one of the following integer values:
0-request has been accepted
1-request is not supported
2-the user does not have the necessary acc
3-the service cannot be terminated because other running services depend on it
4-the requested control code is invalid or the service does not accept it
5-the requested control code cannot be sent to the service because the service status (Win32_BaseService:State) is equal to 0, 1, or 2
6-Service has not been started
7-the service did not respond to the startup request in a timely manner
8-an unknown error occurred while starting the service
9-No directory path to executable service was found
10-the service is already running
11-the database responsible for adding new services is locked
12-A dependency on which the service depends has been removed from the system
13-the service cannot discover the required service from the dependent service
14-the service has been disabled by the system
15-the service does not have the correct authentication required to run on the system
16-removing the service from the system
17-the service has no thread of execution
18-there is a circular dependency when the service is started
19-there is a service with the same name running
20-there are invalid characters in the name of the service
21-invalid parameters passed for the service
22-the account running the service is either invalid or lacks permission to run the service
23-the service already exists in the service database available to the system
24-the service is currently suspended in the system
The above is all the contents of the article "sample Analysis of VB.NET Terminal Services startup mode". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!