Use TaskScheduler to create a windows plan and a windows Service

Source: Internet
Author: User

Use TaskScheduler to create a windows plan and a windows Service

Microsoft. win32.TaskScheduler. dll class library remember using Microsoft. win32.TaskScheduler; /// <summary> /// create a windows scheduled task /// </summary> /// <param name = "taskName"> Task name </param> /// <param name = "stateTime"> execution time </param> public static void CreateTask (string taskName, dateTime stateTime) {try {// scheduled Task Service TaskService ts = new TaskService (); // create a scheduled task TaskDefinition td = ts. newTask (); td. registrationInfo. descrip Tion = "DTU executes unexecuted tasks"; // task description td. registrationInfo. author = "EcpDtu"; // task Author // time of execution TimeTrigger tt = new TimeTrigger (); tt. startBoundary = DateTime. now. addSeconds (5); // stateTime. addHours (4); // start time tt. endBoundary = DateTime. now. addSeconds (10); // stateTime. addHours (8); // end execution time td. triggers. add (tt); // Add the trigger to the task // create an execution operation var exe = new ExecAction ("RunTask.exe", null, ConfigurationManager. appSetting S ["RunTask_path"]); // Add the execution operation to the operation of the scheduled task. td. actions. add (exe); // register the scheduled task ts. rootFolder. registerTaskDefinition (taskName, td);} catch (Exception ex) {MsgHelper. errorWriteLog ("create scheduled task error _ CreateTask (string name)" + ex. message );}} /// <summary> /// query the scheduled task /// </summary> /// <param name = "taskName"> </param> public static void RetrieveTestTask (string taskName) {// TaskService ts = new TaskService (); Task t = ts. GetTask (taskName); if (t! = Null) {Console. writeLine ("Task Name = {0}", t. name); Console. writeLine ("Task Execution Time = {0}", t. lastRunTime); Console. writeLine ("Task Last Run Result = {0}", t. lastTaskResult); Console. writeLine ("Task Next Execution Time = {0}", t. nextRunTime) ;}}/// <summary> // delete a scheduled task /// </summary> public static void DeleteTestTask (string taskName) {// TaskService ts = new TaskService (); ts. rootFolder. deleteTask (taskName );}

Create a user in windows

Your initial username should be Administrator, which is the highest level Administrator user. After creating a new Administrator user, the user cannot directly access the user, however, when you log out of the current user, you can see the user and click to enter.
Users with General permissions or Restricted Users can be created only when common administrator users exist. You can also create a second administrator user. No matter what users you create, this user is no longer hidden.
When there are multiple users, the user will stay on the user selection page at startup. You can enter the user desktop only when you click a user. It is worth mentioning that, on the user selection interface, press Ctrl + Alt + Del to display your original user Administrator.
If you want to enter your desired user name and password at startup, you can change the user logon or logout mode to cancel the use of the welcome screen. The user interface is automatically stopped at the next startup. The difference is that the user input box is displayed, and the default user name is the one you just logged on to when you shut down the system.

Highest Administrator user name: Administrator
Please, you entered Administartor. The computer is stupid, and it does not recognize anything wrong.

Create a WINDOWS user in DOS

If you do not know the ADMINISTRATOR password, it is very difficult to do it. I know little about it, but it is also a little bit of effort to help you.
"So I want to know if I can create a new user for WINDOWS in DOS? How can we achieve this ?"
Yes. After is enabled, run-CMD and enter: net user: the user name {password}/add you created. Note the space and password.
Then: net localgroup administrators the user name/add you created, so that you can upgrade the user you created to an administrator user
Then, you can change the password of the original administrator user:
Net user new password of the original Administrator Account
I have been thinking about whether to use tourists to enter the security mode, create administrator users, and change the original administrator user password, my computer visitors cannot enter the security mode. I don't think I have the permission to create administrator users if I enter the security mode. So I think it's hard for you to think about it. Maybe someone else can do it, but I am too fond of it.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.