Powershell on the command line

1. how it is used on the command line

2. how it is used for programming and scripting work

3. (likely) how it is used in the cloud like azure

These notes are for command line


# file array
$x = dir 

# first entry
$x1 = $x[0]

# find its type
$x1 | Get-type

# find the methods
$x1 | Get-Member

# Get all file (objects) recursively
dir *.sql -Recurse

# Select that have changed since
dir *.sql -Recurse | where -Property CreationTime -gt '9/1/2020'

#note the time format is locale sensitive

This link on commandlets in powershell could be useful

1. Use "exit" at the command line to quit

2. To start a powershell use the windows search icon to look for "powershell"



#The following will give you the attributes
get-alias | get-member

#Then you can chose the objects 
#whose attribute matches to what you like
get-alias | Where-Object -Property ReferencedCommand -Like "*var*"

Get-Variables - Global variables such as version number etc.
Get-Module - Show modules
Get-Command - Show commandlets in a module
Get-Help
Get-Help -examples
Get-Member - Show me the attributes of an object
Select-Object First
Get-alias - Show aliases
Get-PSProviders - show drives
Get-ComputerInfo

You have things like

min

max

average

etc....


Lists registered public repos
PS C:\satya\data\code\power-shell> Get-PSRepository

Name        InstallationPolicy   SourceLocation
----        ------------------   --------------
PSGallery   Untrusted            https://www.powershellgallery.com/api/v2

Module for MS Teams

Create a new chat with MS Teams Powershell module

Search for: Create a new chat with MS Teams Powershell module

MS Docs: Powershell for MS Teams