• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
Think PowerShell

Think PowerShell

PowerShell for IT Pros

  • About
    • Who I Am
    • Why I Blog
    • Privacy Policy
  • Resources
    • More PowerShell Sites
    • Post Series Index
  • Get Help
  • Show Search
Hide Search

Beginner

PowerShell Aliases: Save Time But Use Wisely

Aaron Rothstein · February 11, 2016 · 4 Comments

PowerShell Get-Alias result screenshot

When typing interactive PowerShell commands, some cmdlets can be lengthy. Save yourself some time by making use of a PowerShell cmdlet’s Alias.

PowerShell is designed for readability

A big PowerShell strength is its readability. Cmdlets follow a standard Verb-Noun format and avoid any acronyms that aren’t considered common knowledge. By simply looking at a command, you can quickly understand what it is intended to do.

Readability is very important when you are creating a finished script that will be reviewed, used, and updated by others. But what about when you are simply performing some interactive work from a PowerShell prompt? You can tab autocomplete a cmdlet, but that still requires a minimum amount of typing and you may need to tab through a few cmdlets before you get to the one you want. Save yourself some time and typing by using a cmdlet’s Alias.

PS C:\Users\aaron> Get-Service -DisplayName 'Windows Update'

Status     Name        DisplayName 
------     ----        ----------- 
Stopped    wuauserv    Windows Update

[Read more…] about PowerShell Aliases: Save Time But Use Wisely

Use Test-NetConnection to Replace Ping

Aaron Rothstein · February 10, 2016 · 13 Comments

Test-NetConnection results.

The first post in my PowerShell Beginner series “Daily Tasks, The PowerShell Way“, get started with PowerShell by replacing some classic but obsolete command line tools such as ping.exe, tracert.exe, and more by using Test-NetConnection.

How to start using PowerShell?

There is SO much one can do with PowerShell, often one of the questions is where to start. Why not with tasks you are likely to perform once if not multiple times daily? This is the first post in a PowerShell Beginner series aimed at highlighting tasks that you may currently be doing by GUI or old command line tools and showing how to do them the PowerShell way.

[Read more…] about Use Test-NetConnection to Replace Ping

PowerShell Comments: Give Your Script Context

Aaron Rothstein · February 4, 2016 · Leave a Comment

PowerShell Multi-line Comment example.

PowerShell code tells you how, but the PowerShell comments tell you why. Here are the ways to comment your PowerShell and some accompanying best practices.

Mystery code

Here is a scenario all too familar: You are heads down, writing an awesome script. Since you are writing it you know exactly how it works and why you made the design decisions you did. You are so clever! The code is so obvious that it pretty much explains itself to someone reading it.

Now here’s how reality usually goes: A peer needs to make a change to your script. They wonder what the variable name $m represents. They try to trace flow of your script, constantly having to scan to find the function definition you created. Why did you create a special function for that? Couldn’t that be done with the <insert applicable cmdlet name here> cmdlet? What are the prerequisites for this code to run? Does it require a minimum version level of PowerShell? And the questions go on and on.

Even if you as the author come back to review it months down the road, can you reliably remember the logic you used to design and write it?

[Read more…] about PowerShell Comments: Give Your Script Context

PowerShell Execution Policy Explained

Aaron Rothstein · February 3, 2016 · 7 Comments

 

PowerShell Execution Policy Error

Before you can run a PowerShell script, you will need to check the PowerShell Execution Policy setting and possibly change it. Here’s how.

[Read more…] about PowerShell Execution Policy Explained

Windows PowerShell ISE: Develop Your Scripts

Aaron Rothstein · February 2, 2016 · Leave a Comment

Windows PowerShell ISE splash start.

Windows PowerShell ISE (Integrated Scripting Environment) is a bundled script editor  for PowerShell. Here is why you should use it.

Beyond the PowerShell Prompt

PowerShell is a command line tool at its core. It can be used to its fullest extent from an interactive shell prompt. But beyond ad-hoc work, cmdlet exploration and command one-liners, you should be using a script editor for building more complex PowerShell scripts. Luckily, beginning with PowerShell v2 the Windows PowerShell ISE has been included as a companion PowerShell script development environment. The rest of this post is specifically referencing Windows PowerShell ISE v5 (Windows 10), but a lot of these features are included in earlier versions too.

[Read more…] about Windows PowerShell ISE: Develop Your Scripts

  • « Go to Previous Page
  • Page 1
  • Page 2
  • Page 3
  • Page 4
  • Page 5
  • Go to Next Page »

Primary Sidebar

Aaron

Think PowerShell

Copyright © 2025 · Monochrome Pro on Genesis Framework · WordPress · Log in