PowerShell 4.0: Improves task Automation

Source: Internet
Author: User

Windows Server 2012 R2 introduces the new PowerShell version. PowerShell 4.0 makes people feel mature. It turns out that it carries many new features that help administrators, including changing default implementation policies and some new parameters.

Expected Status Configuration

The biggest change in PowerShell 4.0 is the introduction of the new Windows PowerShell expected state configuration, which controls the computer configuration mode by centrally managing computers that execute similar functions.

The expected status configuration function is completely PowerShell-no GUI. To use this function, the Administrator must create a PowerShell script for the computing role or function. This script defines which configurations should be applied to the node, and the roles and other configuration data to be installed on the node.

Create a Microsoft operating framework MOF file when the script is run. In this case, you can configure the specified node in the MOF file. A mof file is a mechanism used to transfer WMI objects between Windows Management specifications or computers.

Changes in default policy enforcement

The first major change made by Microsoft is to change the default implementation policy. The execution policy is disabled by default for all earlier PowerShell versions. In the past, PowerShell scripts failed to run unless the Administrator chose to run different execution policies.

By default, PowerShell 4.0 performs remote logon on Windows Server 2012 R2. However, Windows 8.1 is disabled. This means that the Windows server administrator does not have to change the execution policy. As long as the script is signed, the PowerShell script can be run. Windows 8.1 will continue to disable the execution policy to reduce your chances of being attacked by PowerShell scripts.

PowerShell 4.0 Parameters

Microsoft also added many new PowerShell 4.0 parameters, including RepeatIndefinitely. In addition, Microsoft also created the RunNow parameter, which is associated with Register-ScheduledJob and Set-ScheduledJob cmdlets. This parameter simplifies the immediate execution of a scheduled task.

Another new parameter, PipelineVariable, is particularly useful for administrators who build PowerShell scripts. The PipelineVariable parameter is based on the concept of building, and puts the results of a series of pipeline commands into a variable. PipelineVariable is a common PowerShell parameter. The content of this variable can be referenced in the script.

Another useful new parameter, Passthru, is used to create a PowerShell script that allows PowerShell to display any objects that have been modified through commands. The Passthru parameter is used in Enable-JobTrigger and Disable-JobTrigger lelets.

PowerShell 4.0 was initially compatible only with Windows Server 2012 R2 and Windows 8.1, but it is rumored that version 4.0 will eventually be compatible with earlier Windows versions.

You can download the PowerShell 4.0 preview as part of the Windows Management Framework preview, windows Management Framework installation has severe compatibility problems with Exchange servers, SharePoint servers, Windows Small Business servers, and some system center products. Microsoft may release patches in the future to solve these incompatibility issues.

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.