PowerShell 5.0: small changes that will make a big difference

Windows PowerShell 5.0 includes a large number of new features and capabilities that enhance overall operation. Although some features will only appeal to hardcore PowerShell developers, other new features and capabilities will be of greater interest. One of them is remote file editing.

For some time, administrators could create a remote session on another Windows server through PowerShell. The new remote file editing feature exploits this feature. It allows you to create a remote session and then edit a file on the remote computer.

Creating a remote session is almost the same as before. You can use the Enter-PSSession command , followed by the -ComputerName parameter and the name of the target system. Then simply enter the PSEdit command followed by the path and file name on the remote system.

If, for example, you want to edit a file named C: \ Files \ File.txt on a system called Server1, the commands you will use will be:

Enter-PSSession -ComputerName Server1

PSEdit C: \ Files \ File.txt

Desired State Configuration

The DSC (Desired State Configuration) PowerShell feature has also been updated.

For those who are not familiar with DSC, be aware that this feature allows administrators to compare Windows servers with a desired state, and then take corrective action if the configuration of the servers in question no longer matches the desired one.

DSC has been around for a while now, but Microsoft has added a parameter to allow it to be throttled. Indeed, the DSC function often runs on a large number of servers simultaneously, which consumes an excessive amount of system resources.

The throttling limit allows administrators to limit the number of simultaneous DSC operations and hence the use of system resources.

The syntax used in the DSC feature remains the same as in previous versions, but with one difference: Microsoft has added a command-line switch called -ThrottleLimit. This switch must be followed by the desired maximum number of simultaneous DSC operations.

Correct the little details

The most interesting changes brought by PowerShell 5.0 probably concern its interface, not the set of commands.

The criticism of Windows PowerShell is that the copy and paste function sometimes gave unpredictable results. Microsoft has completely revised it.

The new feature was introduced in the Windows 10 Insider Preview. If you open the Windows PowerShell Properties page, you will notice that a new tab called Experimental has been added to the interface.
In Windows PowerShell, one of the big problems with the copy-and-paste function was that when you selected multiple lines of code to copy, the program would treat each line one at a time instead of processing the code block.

For example, if you copied a long four-line command to the screen and then pasted it into the PowerShell interface, the program would insert line breaks between each line, resulting in a number of error messages. With PowerShell 5.0, a simple check box activates the line break, eliminating the problem.

Another problem with previous versions of the PowerShell interface is that when you resize the window, portions of the controls were sometimes hidden beyond the window boundaries. In version 5.0, when you minimize a window, the displayed text adapts to its new dimensions without any portion being hidden.

Leave a Reply

Your email address will not be published. Required fields are marked *