If you are a posix person stuck in a Windows environment or just a command line type of person you need to start using PowerShell.
The first step to be able to do any actual scripting is to allow script execution on your machine.
This allows any local scripts to run, but requires downloaded scripts to be signed.
Time to try it out. Write the following to helloworld.ps1:
Write-Host "Hello PowerShell"
Navigate to the directory where you put the helloworld.ps1 file and run the following command:
You should now see "Hello PowerShell" written to your console.
If you are a tinkerer you probably want to do some customization of the console as the next step.
PowerShell has the notion of a user profile. Your profile is a file where you can set up your environment according to your personal preferences, just like a .bashrc file under Linux.
To find out where PowerShell is looking to find you profile, type the following in your console:
If you quickly want to create a profile you can use the $profile variable as the argument to your favourite editor, like so:
Here is an example of a profile which customizes the colors used:
$settings = (Get-Host).PrivateData
$settings.ErrorBackgroundColor = "Red"
$settings.ErrorForegroundColor = "White"
$settings.WarningBackgroundColor = "Red"
$settings.WarningForegroundColor = "White"
$ui = (Get-Host).UI.RawUI
$ui.BackgroundColor = "White"
$ui.ForegroundColor = "Black"
# Make sure to clear the screen so that the entire console is redrawn with
# the new background color
If you want to reload your profile without restarting the console you can run the following command