A small step in PowerShell learning, a big step in the work

Source: Internet
Author: User

Now the title can not afford the occasional, basically there is no visitors and traffic. This article first basin of the public number , can be reproduced, but need to indicate the source and the author nine Uncle

This article refers to the Basin's public number , as the source code is also published there.

This article does not pretend to be forced, only to talk dry goods. I hope that as a system engineer or itpro you, join in the study of PowerShell in the ranks.

We use PowerShell to make a small program. What functions do you implement? We use it to view the scheduled tasks for Windows. Perform some common operational operations on scheduled tasks.

First of all, we look at the interface, if the interface is not satisfied, then basically do not look down. PowerShell made the graphical program, the standard styling is this look, there are changes, but not too much. (If you want a more personalized, customized graphical interface, but this is the UI and art work, I believe most people are not competent)

650) this.width=650; "src=" Http://www.ny9s.com/wp-content/uploads/2016/05/051016_0232_1.png "id=" exifviewer-img-1 "Style=" border:0px;margin:0px;padding:0px; "/>

What are the graphical tools for PowerShell development?

First, let's introduce the development tool PowerShell Studio 2015, which is used today, and this is another development tool that I used in addition to the ISE. It is very simple to write a graphical interface compared to Ise. The basic thing to do is to drag and drop the control. In Microsoft's script library, there are also many authors who use this tool to develop. And it's very easy to get started. If you are writing PowerShell, you also want to write a graphical program. Then PowerShell Studio 2015 is the best choice, not one.

Why PowerShell has to write graphical tools

I think we all know that in the enterprise, as a small engineer, you are not a person in the fight, you will meet a lot of people a lot of things. If you can only write command-line scripts to get the job done, of course. But to know that more people don't understand this, they need simple tools to do basic work, so writing a graphical tool can help you improve your social status. "People are worth what they need."

Project background: When you do this tool, the cause is very strange. That's because I have a Windows 8 computer as a file server. Using WINDOWS8 as a file server is a very simple task, but there are also problems. That is, the disk is moving, causing me to worry about the hard drive life, but also more annoying noise.

So for the initial purpose, I just want to optimize the system and solve the problem of WINDOWS8 the old read disk .

You see, the demand is so wonderful. In the basin of the group also probably understand some methods, no outside stop some services, to deal with some planning tasks.

But new questions come, and Windows8 's planning tasks are far more than you might think . If you want to take a look at every planning task and learn, it's clear that the mouse step by bit has consumed all the patience.

This tool is not too complex to write, I feel I am less efficient, probably in less than a day.

650) this.width=650; "src=" Http://www.ny9s.com/wp-content/uploads/2016/05/051016_0232_2.png "id=" exifviewer-img-2 "Style=" border:0px;margin:0px;padding:0px; "/>

Project goal: for the above reasons, I have made this gadget and the goal is clear

    1. for a specific number of services, That is, let the WINDOWS8 hard disk constantly read the service, I set some buttons, one click Off.

    2. to list all the scheduled tasks, I need to show all the data in one view, which is not available in the Microsoft original MMC.

    3. You can select and select multiple deletions without scheduling tasks. or disable it

I think the program as a graphical primer is good, the overall only 278 lines. I will also provide the original code. Easy for everyone to learn.

650) this.width=650; "src=" Http://www.ny9s.com/wp-content/uploads/2016/05/051016_0232_3.png "id=" exifviewer-img-3 "Style=" border:0px;margin:0px;padding:0px; "/>

Note the details:

200 lines can not be introduced in line, before reading the code, you need to have a certain understanding of PowerShell, or can read PowerShell. After all, the PowerShell is graphically based on PowerShell.

By the way, in the form of load, we set the following statement to solve the problem of insufficient permissions when running the PS1 file, which is somewhat risky, but relatively simple. You can try it.

650) this.width=650; "src=" Http://www.ny9s.com/wp-content/uploads/2016/05/051016_0232_4.png "style=" border:0px; margin:0px;padding:0px; "/>

Give me a chestnut:

For example, this one-button off xxx, the interface is such, the role is to click a button to achieve a variety of functions.

650) this.width=650; "src=" Http://www.ny9s.com/wp-content/uploads/2016/05/051016_0232_5.png "id=" exifviewer-img-4 "Style=" border:0px;margin:0px;padding:0px; "/>

In PowerShell Studio, we double-click the SuperFetch button to get to the button's "click" Action. This can be configured for actions that are made after clicking the "SuperFetch" button.

As you can see, here's a click to close the service. Just two cmd commands. Invoking the cmd command in PowerShell requires you to run it in a cmd/c way.

650) this.width=650; "src=" Http://www.ny9s.com/wp-content/uploads/2016/05/051016_0232_6.png "id=" exifviewer-img-5 "Style=" border:0px;margin:0px;padding:0px; "/>

The tool was done before Lunar New Year, but the article was not written until the end of March. No, you can't.

Microsoft Cloud Solution High-end top group "236804566" to share the achievement of cattle B road


Welcome to Sina Weibo @ Fat nine uncle

    • "Microsoft System Center R2 Private Cloud Deployment" is now available


This article is from the "Nine uncle-Microsoft Private Cloud" blog, please make sure to keep this source http://jiushu.blog.51cto.com/972756/1771692

A small step in PowerShell learning, a big step in the work

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.