This example shows how .NET can be used to start and stop Windows Services programmatically without having to use System Exec commands.
Description System Exec does not allow for the command prompt to be ran as an administrator. To get around this, an application and installer must be created or LabVIEW itself has to be ran as an administrator. This example provides a workaround to control Services using .NET. The benefit is that it can elevate the permissions for the application to gain access to certain Services without having to build an executable or having to run LabVIEW as an administrator as you would with System Exec. It uses runas and net commands to configure the process through .NET. The default configuration is set to turn on/off Windows Themes. This was inspired from lavag.org.
Note: Disabling some Services can cause unexpected system behavior. Research any Services prior to running this VI. Requirements
LabVIEW 2012(or compatible)
Steps to Implement or Execute Code
Open and configure the Front Panel controls
Run the VI
Additional Information or References
**This document has been updated to meet the current required format for the NI Code Exchange.**