Follow these steps to build and execute our first PowerShell script:
- Open the Start menu and type Windows PowerShell ISE. Right-click to launch this tool as an administrator. Windows PowerShell ISE is an editor for PowerShell scripts that is much more useful than opening a simple text editor such as Notepad in order to build our script:
- Navigate to File | New from the menus in order to open a blank .ps1 script file.
- In your first line, type the following: Write-Host "Hello! Here is the current date and time:".
- From the toolbar menu, click the green arrow that says Run Script. Alternatively, you can simply press the F5