Windows Classroom Series – 29/Sept/2020

Powershell Aliases

  • Navigate to the Powershell & Execute the following commands
Get-Alias
Get-Alias dir

Preview

  • To Create a New Alias
Get-Command -Noun Alias
Get-Help New-Alias -Online
Get-Help about_Aliases

Understanding Parameters in Powershell?

  • If we look into help of some cmd-lets, as shown below how to read them Preview
  • Parameter Types:
    • Optional Parameters:
      • In help docs they are surronded by square brackets Preview
      Get-Process
      Get-Process -Name notepad
      
    • Optional Positional Parameters:
      • Positional Parameters can be passed without referring the parameter with name
      • Eg:
      Get-Process -Name 'notepad'
      Get-Process 'notepad'
      
      • Positional parameters can be optional. Which is represented in red color below Preview
    • Mandatory Parameters:
      • This are the Parameters which you need to suppy
      • Execute Get-Help Copy-Item Preview
    • Switch Parameter: The presence of switch parameter makes a difference
      • Example: Get-ChildItem, Get-ChildItem -Recurse
    • Common Parameters:
      • Example Preview
      • Execute the command Get-Help about_CommonParameters Preview
    • Parameter Values:
      • We see the parameters such as
      <string> => string
      <string []> => a list of strings
      

Next Topics

  • Confirm Paramters
  • Providers
  • Splatting
  • Modules & Snap-ins
  • Powershell Gallery

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About learningthoughtsadmin