How to run the PowerShell script

Source: Internet
Author: User

The new version of PowerShell with the advent of Windows Server R2. Now the only way to use PowerShell 4.0 is to get and use the Windows Management Framework 4.0.

PowerShell is most helpful and useful for Windows virtualization tasks. A five-part series on the TechNet blog is the hottest online database on this topic. With this information, you can find a wealth of details about the PowerShell scripting Automation multiple virtualization settings, configuration, and maintenance tasks.

The TechNet Series article provides the basics of running PowerShell scripts

The contents of the TechNet series provide a good overview of the role of PowerShell in the virtualized world. The series also outlines the graphical PowerShell interface, provides a script that maps worker process IDs to VMS, describes how to create a script using PowerShell WMI to create a virtual hard disk (VHD), and how to obtain an IP address for a Hyper-V virtual machine. How to turn off the client virtual machines in Hyper-V and how to create a complete virtual network in Hyper-V.

As long as you have enough time and enthusiasm, you can use PowerShell to do a lot of things. The real benefit, of course, is that you can automate repetitive tasks. The higher the duplication of tasks, the higher the utilization rate.

CodePlex provides hyper-V scripting

Extensible switches in Windows Server 2012 and Windows Server R2 are easier to use than earlier versions of the virtual infrastructure. Switch extensions also mean that you can use updates and enhancements without wasting your effort doing repetitive work.

The CodePlex PowerShell Management library provides the best information you can find and connect to VMS through more than 100 cmdlet here, observe and operate machine status, back up or export VMS, and process VHD files, and so on.

Hyper-V has its own cmdlet collection

Figure 1. Hyper-V PowerShell script

Hyper-V 3.0 and 150 PowerShell cmdlets. You can use PowerShell to display available resources and how to run and use them, which requires you to enter the following command in a normal PowerShell run environment: Get-command–module Hyper-V (Figure 1).

Additional details of the cmdlet can be obtained after attaching the-name *search* to the command. * is a wildcard and you can replace it with the Chengxiang you want to search for, such as add, find, and so on. The Get-help cmdlet can be followed by three types of output:-examples (code instance),-detailed (verbose output), and-full (all information). Therefore, Get-help Add_vmnetworkadapter-examples displays a PowerShell script instance that adds a network adapter to the virtual machine.

When using PowerShell to access the Hyper-V module, you need to start the feature in advance and enter the following command:

Add-windowsfeature Hyper-V-includemanagementtools

As an administrator, you must also run the PowerShell console to interact and manage with Hyper-V, so be sure to follow these simple steps as quickly as possible.

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.