For system, network and cloud administrators
Windows PowerShell comes useful in my daily routine. This is a small step on showing you how to get started with Windows PowerShell and running PowerShell scripts. Let us begin :).
Alternatively, you can also run Windows PowerShell via cmd
by typing “PowerShell”.
Create a new file called run_script but with a .ps1
extension. We’ll just output a simple “Hello, admin!” message using the Write-Host
command:
Write-Host "Hello, admin!"
Once you’ve finished writing your own first PowerShell script, you’ll need to run it. Inside your PowerShell console, navigate to where (using the cd
command) you’ve saved your .ps1 script and execute it:
.\run_script.ps1
Alternatively, you can run the script by navigating to where you’ve saved it using your file browser/explorer, right-clicking it and choosing “Run with PowerShell”.