# TWAPI example
# Change the specified Windows service to start under a specific account
# Usage example: tclsh changeserviceaccount.example SERVICENAME PASSWORD

package require twapi

if {$argc != 3} {
    puts stderr "Usage: [info nameofexecutable] $argv0 SERVICENAME ACCOUNT PASSWORD"
    exit 1
}

# Convert the service name to the internal name
set svcname [twapi::get_service_internal_name [lindex $argv 0]]
# Get account and password
set account [lindex $argv 1]
set password [lindex $argv 2]

twapi::set_service_configuration $svcname -account $account -password $password
