-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Microsoft Exchange Server PowerShell Essentials
By :
Now that we have covered the basics of Windows PowerShell, let's write our first script. PowerShell uses the .ps1 format to save scripts. Before we get into executing scripts, let's first understand the following PowerShell Script Execution Policies that are in place to prevent unwanted scripts from being executed on your computer.
The cmdlet Set-Execution Policy helps you to change the Policy of which scripts you can run on your computer. There are four different execution policies:
Now, let's set the execution Policy to Remote Signed and verify using Get-Execution Policy cmdlet:
PS C:\> Set-ExecutionPolicy RemoteSigned PS C:\> Get-ExecutionPolicy
I am going to introduce the PowerShell Integrated Scripting Engine (ISE) that makes it easier to run scripts with features, such as syntax-coloring, tab completion, IntelliSense, visual debugging, and context sensitive Help, as compared to the PowerShell console.
The following script will query the win32_logical disk WMI class. This is a representation of a local storage device on a Windows Computer. There are six possible Drive Types, and we will use a Switch statement to get the output in text describing the type of storage:

Change the font size
Change margin width
Change background colour