10.3. Summary

The default install of Windows PowerShell prevents you executing PowerShell scripts and configuration files on PowerShell startup. The get-executionpolicy cmdlet allows you to find out the current setting of the Windows PowerShell execution policy.

To modify the current execution policy, you can use the set-executionpolicy cmdlet, if you have administrator privileges. I showed you alternative techniques using Regedit or editing the registry from the Windows PowerShell command line.

The read-host cmdlet allows you to accept user input. The write-host cmdlet allows you to customize the display of information in the PowerShell console.

I described the following types of operators that Windows PowerShell supports:

  • Arithmetic — Use to calculate values

  • Assignment — Use to assign one or more values to a variable

  • Comparison — Use to compare values and perform conditional tests

  • Logical — Use in statements containing more than one conditional test, to specify how those tests are to be applied

  • Unary — Use to increment or decrement variables or object properties

  • Special — Use to, for example, run commands or specify a value's datatype

I introduced the following cmdlets that you can use to work with PowerShell variables:

  • set-variable

  • new-variable

  • get-variable

  • clear-variable

  • remove-variable

Chapter 11 introduces several more features of the Windows PowerShell language.

Get Professional Windows® PowerShell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.