Table of contents
  1. Gists
    1. Sync Chrome Bookmarks
  2. Installing
    1. Install 7.3
      1. DotNet CLI
      2. MSI
      3. Winget
  3. Run
    1. powershell core 7+
    2. OS powershell 5
  4. Update
    1. Winget
    2. MSI
  5. Environment
    1. There are three scopes of what is called Environment Variables:
    2. To get a list of variables
    3. Set $env variable
      1. Set ENV Persistently
  6. WSL
    1. get a list of distros
    2. run wsl
  7. JSON
    1. ConvertFrom-Json
      1. USING POWERSHELL TO WRITE JSON
      2. USING POWERSHELL TO READ JSON
      3. USING POWERSHELL TO ITERATE THROUGH JSON
  8. XML
    1. Write
    2. Read
    3. Iterate
  9. Read From txt File
  10. Find cmdlets / functions
  11. Invoke-WebRequest
    1. get file http
    2. Download File From Web
  12. For Each / foreach / ForEach-Object
  13. Run In Parallel / Async
  14. Get-ChildItem cmdlet
  15. Map Network Drive / New-PSDrive / Remove-PSDrive
    1. cmd Net Use
  16. Quick Scripts
    1. Get Proxy Settings
    2. lock screen
    3. Get version
    4. Run As Admin
      1. Get Execution Policy
    5. Rename and Expand .zip
    6. Execute / Start / Run process / Application
      1. Run with no exit
    7. Handle Expected Error
    8. Search Piped String
      1. Creating a File in Each Sub-Folder in a Directory using the ForEach Statement
    9. Reading the Contents of each Text File in Sub-Directories
    10. Getting Services and Starting Them using the ForEach-Object CmdLet
    11. Reading Data from CSV using the ForEach() Method
    12. Don’t Sleep
    13. Answer / Reply to Yes(y) No(n) Prompt
  17. Basic Commands




Gists

Sync Chrome Bookmarks

used to sync bookmarks file to a repo to update on both mac and windows using bash and powershell when account can not sync due to admin
restrictions


Installing

You can launch PowerShell 7 via the Start Menu or $env:ProgramFiles\PowerShell\<version>\pwsh.exe
You can launch PowerShell 5 via the Start Menu or $env:WINDIR\System32\WindowsPowerShell\v1.0

Install 7.3

PowerShell 7.3 installs to a new directory and runs side-by-side with Windows PowerShell 5.1.

PowerShell 7.3 is an in-place upgrade that replaces PowerShell 7.0 and lower.

  • Separate installation path and executable name.
    Is installed in the $env:WINDIR\System32\WindowsPowerShell\v1.0
    PowerShell 7 is installed in the $env:ProgramFiles\PowerShell\7
    The new location is added to your PATH, which allows you to run both Windows PowerShell 5.1 and PowerShell 7.
    In Windows PowerShell, the PowerShell executable is
    named powershell.exe.
    In version 6 and newer, the executable is named pwsh.exe.
    The new name makes it easy to support side-by-side execution of both versions

  • Separate PSModulePath.
    By default, Windows PowerShell and PowerShell 7 store modules in different locations.
    PowerShell 7 combines those locations in the $Env:PSModulePath environment variable.
    When you import a module by name, PowerShell checks the location that $Env:PSModulePath specifies.
    This feature allows PowerShell 7 to load both Core and Desktop modules.

  • Separate profiles for each version.
    A PowerShell profile is a script that runs when PowerShell starts.
    This script customizes the PowerShell environment by adding commands, aliases, functions,
    variables, modules, and PowerShell drives.
    In Windows PowerShell 5.1, the profile’s location is $HOME\Documents\WindowsPowerShell.
    In PowerShell 7, the profile’s location is
    $HOME\Documents\PowerShell.

  • Separate event logs. Windows PowerShell and PowerShell 7 log events to separate Windows event logs.

  • When you’re reviewing a PowerShell session, it’s important to determine which version you’re using.
    To determine the current version, enter $PSVersionTable in the PowerShell console, and then
    select Enter.
    PowerShell displays the version numbers for various components, including the main PowerShell version number.


DotNet CLI

 dotnet tool install --global PowerShell

MSI

 msiexec.exe /package PowerShell-7.3.2-win-x64.msi /quiet ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=1 ADD_FILE_CONTEXT_MENU_RUNPOWERSHELL=1 ENABLE_PSREMOTING=1 REGISTER_MANIFEST=1
 USE_MU=1 ENABLE_MU=1 ADD_PATH=1

Winget

winget install Microsoft.PowerShell

Run

powershell core 7+

 pwsh testscript_writefile.ps1

OS powershell 5

 powershell testscript_writefile.ps1

Update

Winget

winget upgrade Microsoft.PowerShell

MSI

msiexec.exe /fmu .\PowerShell-7.3.0-win-x64.msi USE_MU=1 ENABLE_MU=1

Environment

 $Env:

Env is actually a virtual PowerShell drive and environment variables are items on it.
There is a special provider Get-PSProvider -PSProvider Environment
that implements this method of accessing to environment in powershell.

There are three scopes of what is called Environment Variables:

[System.EnvironmentVariableTarget]::Machine
[System.EnvironmentVariableTarget]::User
[System.EnvironmentVariableTarget]::Process

To get a list of variables

[System.Environment]::GetEnvironmentVariables($scope)
# This will mix all scopes in one output
[System.Environment]::GetEnvironmentVariables()

Set $env variable

$env:AZURE_RESOURCE_GROUP = 'MyTestResourceGroup'
[System.Environment]::SetEnvironmentVariable($varName, $varValue, $scope)

If $scope is Machine or User, it will try to store data, otherwise it will throw an exception.

You can run
Get-ChildItem -Path 'Env:\
and this is exactly the same as
[System.Environment]::GetEnvironmentVariables()
without specifying scope.

Set ENV Persistently

[System.Environment]::SetEnvironmentVariable('ResourceGroup', 'AZ_Resource_Group')

WSL

get a list of distros

wslconfig /l

run wsl

wsl

JSON

ConvertFrom-Json

USING POWERSHELL TO WRITE JSON

$obj = @{
    "PropertyName" = "PropertyValue"
    "ObjectName" = @{
        "ObjectPropertyName" = "ObjectPropertyValue"
    }
}

# Convert object to JSON
$json = $obj | ConvertTo-Json

# Save JSON to file
$json | Set-Content -Path C:\alkane\example.json

USING POWERSHELL TO READ JSON

# Load JSON file
$json = Get-Content -Path C:\alkane\example.json -Raw | ConvertFrom-Json

# Access JSON properties
$json.PropertyName
$json.ObjectName.PropertyName

USING POWERSHELL TO ITERATE THROUGH JSON

$obj = @{
    "ObjectName1" = @{
        "Object1PropertyName1" = "Object1PropertyValue1"
        "Object1PropertyName2" = "Object1PropertyValue2"
    }
    "ObjectName2" = @{
        "Object2PropertyName1" = "Object2PropertyValue1"
        "Object2PropertyName2" = "Object2PropertyValue2"
    }
}

# Convert object to JSON
$json = $obj | ConvertTo-Json

# Save JSON to file
$json | Set-Content -Path C:\alkane\example.json

XML

Write

# Create new XML document
$xml = New-Object -TypeName System.Xml.XmlDocument

# Create root node
$root = $xml.CreateElement("RootNode")
$xml.AppendChild($root)

# Create child node with attribute and value
$child = $xml.CreateElement("ChildNode")
$child.SetAttribute("AttributeName", "AttributeValue")
$child.InnerText = "Inner text"
$root.AppendChild($child)

# Save XML to file
$xml.Save("C:\alkane\example.xml")

Read

# Load XML file
[xml]$xml = Get-Content -Path C:\alkane\example.xml

# Access XML elements and attributes
$xml.RootNode.ChildNode.AttributeName
$xml.RootNode.ChildNode.InnerText

Iterate

# Create new XML document
$xml = New-Object -TypeName System.Xml.XmlDocument

# Create root node
$root = $xml.CreateElement("RootNode")
$xml.AppendChild($root)

# Create child node with attribute and value
$child = $xml.CreateElement("ChildNode")
$child.SetAttribute("AttributeName", "AttributeValue1")
$child.InnerText = "Inner text 1"
$root.AppendChild($child)

# Create another child node with attribute and value
$child = $xml.CreateElement("ChildNode")
$child.SetAttribute("AttributeName", "AttributeValue2")
$child.InnerText = "Inner text 2"
$root.AppendChild($child)

# Save XML to file
$xml.Save("C:\alkane\example.xml")

Read From txt File

$content = get-content C:\alkane.txt -tail 3

foreach ($line in $content)
{
    write-host $line
}

Find cmdlets / functions

#Find cmdlets
Get-Command | where-object CommandType -eq "Cmdlet"

#Find functions
Get-Command | where-object CommandType -eq "Function"

Invoke-WebRequest

Invoke-WebRequest -Uri "http://www.contoso.com" -OutFile "C:\path\file"

get file http

wget "http://www.contoso.com" -outfile "file"

Download File From Web

$WebClient = New-Object System.Net.WebClient
$WebClient.DownloadFile("https://www.contoso.com/file", "C:\path\file")

For Each / foreach / ForEach-Object

# Create an array of folders
$folders = @('C:\Folder', 'C:\Program Files\Folder2', 'C:\Folder3')

# Perform iteration to create the same file in each folder
foreach ($i in $folders)
{
    Add-Content -Path "$i\SampleFile.txt" -Value "This is the content of the file"
}

or

$folders = @('C:\Folder', 'C:\Program Files\Folder2', 'C:\Folder3')
$folders | ForEach-Object (Add-Content -Path "$_\SampleFile.txt" -Value "This is the content of the file")

or

$folders = @('C:\Folder', 'C:\Program Files\Folder2', 'C:\Folder3')
$folders.ForEach({
    Add-Content -Path "$_\SampleFile.txt" -Value "This is the content of the file"
})

Run In Parallel / Async

powershell.exe Get-ChildItem C:\Users\$env:UserName\source\repos\GitHub\Veridian\Google\Default | ForEach-Object -Parallel { Remove-Item "$_" -Force -Recurse | Out-Null }
powershell.exe Get-ChildItem  "C:\Users\$env:UserName\AppData\Local\Google\Chrome\User Data\Default" | Where-Object Name -NotIn @( 'Cache', 'Code Cache', 'databases', 'Extension State', 'File System', 'IndexedDB', 'WebStorage', 'Sessions', 'Service Worker', 'Web Applications', 'Default') | ForEach-Object -Parallel { Copy-Item "$_" -Destination C:\Users\$env:UserName\source\repos\GitHub\Veridian\Google\Default -Recurse -Force }

Get-ChildItem cmdlet

you can confirm that the files were created or update inside each of the subfolders

Get-ChildItem -Recurse -Path C:\ARCHIVE_VOLUMES -Include backupstate.txt | Select-Object Fullname,CreationTime,LastWriteTime,Length

Map Network Drive / New-PSDrive / Remove-PSDrive

New-PSDrive -Persist -Name T -PSProvider FileSystem -Root \\ss.test-dev.net\BPAXTON_TEST -Scope Global
Remove-PSDrive -Name T -Force -PSProvider FileSystem -Scope Global

cmd Net Use

net use x: "\\ss.test-dev.net\BPAXTON_TEST"
net use /delete x:

Quick Scripts

Get Proxy Settings

 netsh winhttp show proxy
 reg query "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" | findstr "ProxyServer AutoConfigURL"
  (Get-ItemProperty -Path 'Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings')
(Get-ItemProperty -Path 'Registry::HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings').ProxyEnable

lock screen

$xCmdString = { rundll32.exe user32.dll,LockWorkStation }

Invoke-Command $xCmdString

Get version

$PSVersionTable

Run As Admin


if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]"Administrator"))
{
    Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`" `"$args`"" -Verb RunAs; exit
}
Start-Process -FilePath 'C:\Users\Brandon003842\Downloads\ConnectUtility_2.30.9_Logitech.exe' -WorkingDirectory 'C:\Users\Brandon003842\LogiTech' -Verb RunAs

Get Execution Policy

 Get-ExecutionPolicy
If it returns Restricted, then run

Set-ExecutionPolicy AllSigned
or
Set-ExecutionPolicy Bypass -Scope Process

You can configure the following policy settings:

  • AllSigned: Limits script execution on all signed scripts.
    This setting requires that all scripts are signed by a trusted publisher, including scripts that you write on the local computer.
    It
    prompts you before running scripts from publishers that you haven’t yet classified as trusted or untrusted.
    However, verifying the signature of a script doesn’t eliminate the possibility of that
    a script being malicious.
    It simply provides an extra check that minimizes this possibility.

  • Default: Sets the default execution policy, which is Restricted for Windows clients and RemoteSigned for Windows servers.

  • RemoteSigned: This is the default execution policy for Windows server computers.
    Scripts can run, but the policy requires a digital signature from a trusted publisher on scripts and
    configuration files that have been downloaded from the internet.
    This setting doesn’t require digital signatures on scripts that are written on the local computer.

  • Restricted: This is the default execution policy for Windows client computers. It permits running individual commands, but it doesn’t allow
    scripts.

  • Unrestricted: This is the default execution policy for non-Windows computers, which you can’t change.
    It allows unsigned scripts to run.
    This policy warns the user before running scripts and
    configuration files that aren’t from the local intranet zone.

  • Undefined: Indicates that there isn’t an execution policy set in the current scope.
    If the execution policy in all scopes is Undefined, the effective execution policy is Restricted for
    Windows clients and RemoteSigned for Windows Server.

Mine v7 was saved at C:\Users\1527151437E\AppData\Local\Microsoft\WindowsApps\pwsh.exe

To change the execution policy in PowerShell, use the following command:

Set-ExecutionPolicy -ExecutionPolicy <PolicyName>

Rename and Expand .zip

Rename-Item .\Ubuntu.appx .\Ubuntu.zip
Expand-Archive .\Ubuntu.zip .\Ubuntu

Execute / Start / Run process / Application

Start-Process test.exe
#or
Invoke-Expression -Command "path...test.exe"

Run with no exit

 Start-Process pwsh -ArgumentList '-noexit -noprofile -command "powershell C:\Ruby32-x64\bin\ridk"'

Handle Expected Error

ps notepad -ErrorAction SilentlyContinue | kill -PassThru
  • without aliases

    Get-Process notepad -ErrorAction SilentlyContinue | Stop-Process -PassThru
    

Search Piped String

Select-String -Path "Users\*.csv" -Pattern "Joe"

Creating a File in Each Sub-Folder in a Directory using the ForEach Statement

# Define the TOP-level folder
$TOP_FOLDER = "C:\ARCHIVE_VOLUMES"

# Get all sub folders recursively
$Child_Folders = Get-ChildItem -Path $TOP_FOLDER -Recurse | Where-Object { $_.PSIsContainer -eq $true }

# Create a text file in each sub-folder and add the current date/time as value.
foreach ($foldername in $Child_Folders.FullName)
{
    (get-date -Format G) | Out-File -FilePath "$( $foldername )\BackupState.txt" -Force
}

Reading the Contents of each Text File in Sub-Directories

## Find all BackupState.txt files in C:\ARCHIVE_VOLUMES
$files = Get-ChildItem -Recurse -Path C:\ARCHIVE_VOLUMES -Include 'BackupState.txt' | Select-Object DirectoryName,FullName

## Read the contents of each file
foreach ($file in $files)
{
    Write-Output ("$( $file.DirectoryName ) last backup time - " + (Get-Content $file.FullName))
}

Getting Services and Starting Them using the ForEach-Object CmdLet

## Get a list of automatic services that are stopped.
$services = Get-Service | Where-Object { $_.StartType -eq "Automatic" -and $_.Status -ne "Running" }

## Pass each service object to the pipeline and process them with the Foreach-Object cmdlet
$services | ForEach-Object {
    try
    {
        Write-Host "Attempting to start '$( $_.DisplayName )'"
        Start-Service -Name $_.Name -ErrorAction STOP
        Write-Host "SUCCESS: '$( $_.DisplayName )' has been started"
    }
    catch
    {
        Write-output "FAILED: $( $_.exception.message )"
    }
}

Reading Data from CSV using the ForEach() Method

# Import list of Firstname and Lastname from CSV file
$newUsers = Import-Csv -Path .\Employees.csv

Add-Type -AssemblyName System.Web

# Process the list
$newUsers.foreach(
        {
            # Generate a random password
            $password = [System.Web.Security.Membership]::GeneratePassword((Get-Random -Minimum 20 -Maximum 32), 3)
            $secPw = ConvertTo-SecureString -String $password -AsPlainText -Force

            # Formulate a username
            $userName = '{0}{1}' -f $_.FirstName.Substring(0, 1), $_.LastName

            try
            {
                # Build new user attributes
                $newUser = @{
                    GivenName = "$( $_.FirsName )"
                    Surname = "$( $_.LastName )"
                    Name = $userName
                    AccountPassword = $secPw
                }
                New-ADUser @newUser

                Write-Output "User '$( $userName )' has been created."
            }
            catch
            {
                Write-Output $_.Exception.Message
            }
        }
)

Don’t Sleep

 param($minutes = 900)
 $myShell = New-Object -com "Wscript.Shell"
 $start = 0
 echo $start
 for ($i = 0; $i -lt $minutes; $i++) {
     $start += 1;
     echo $start;
     Start-Sleep -Seconds 30
     $myShell.sendkeys(" ")
 }

or

 Echo "Keep-alive with Scroll Lock..."
 $WShell = New-Object -com "Wscript.Shell"
 $start = 0
 while ($true)
 {
     $start += 1;
     echo $start;
     $WShell.sendkeys("{SCROLLLOCK}")
     Start-Sleep -Milliseconds 100
     $WShell.sendkeys("{SCROLLLOCK}")
     Start-Sleep -Seconds 100
 }

Answer / Reply to Yes(y) No(n) Prompt

 foreach ($i in $files)
 {
     'y' | powershell -c "Remove-Item $i -Force -ErrorAction silentlycontinue"
 }

Basic Commands

Command nameAliasDescription
Set-Locationcd, chdir, slSets the current working location to a specified location.
Get-Contentcat, gc, typeGets the content of the item at the specified location.
Add-ContentacAdds content to the specified items, such as adding words to a file.
Set-ContentscWrites or replaces the content in an item with new content.
Copy-Itemcopy, cp, cpiCopies an item from one location to another.
Remove-Itemdel, erase, rd, ri, rm, rmdirDeletes the specified items.
Move-Itemmi, move, mvMoves an item from one location to another.
Set-ItemsiChanges the value of an item to the value specified in the command.
New-ItemniCreates a new item.
Start-JobsajbStarts a Windows PowerShell background job.
Compare-Objectcompare, difCompares two sets of objects.
Group-ObjectgroupGroups objects that contain the same value for specified properties.
Invoke-WebRequestcurl, iwr, wgetGets content from a web page on the Internet.
Measure-ObjectmeasureCalculates the numeric properties of objects, and the characters, words, and lines in string objects, such as files …
Resolve-PathrvpaResolves the wildcard characters in a path, and displays the path contents.
Resume-JobrujbRestarts a suspended job
Set-Variableset, svSets the value of a variable. Creates the variable if one with the requested name does not exist.
Show-CommandshcmCreates Windows PowerShell commands in a graphical command window.
Sort-ObjectsortSorts objects by property values.
Start-ServicesasvStarts one or more stopped services.
Start-Processsaps, startStarts one or more processes on the local computer.
Suspend-JobsujbTemporarily stops workflow jobs.
Wait-JobwjbSuppresses the command prompt until one or all of the Windows PowerShell background jobs running in the session are …
Where-Object?, whereSelects objects from a collection based on their property values.
Write-Outputecho, writeSends the specified objects to the next command in the pipeline. If the command is the last command in the pipeline,…


Command aliasCmdlet nameDescription of command
%ForEach-ObjectPerforms an operation against each item in a collection of input objects.
?Where-ObjectSelects objects from a collection based on their property values.
acAdd-ContentAppends content, such as words or data, to a file.
asnpAdd-PSSnapInAdds one or more Windows PowerShell snap-ins to the current session.
catGet-ContentGets the contents of a file.
cdSet-LocationSets the current working location to a specified location.
chdirSet-LocationSets the current working location to a specified location.
clcClear-ContentDeletes the contents of an item, but does not delete the item.
clearClear-HostClears the display in the host program.
clhyClear-HistoryDeletes entries from the command history.
cliClear-ItemDeletes the contents of an item, but does not delete the item.
clpClear-ItemPropertyDeletes the value of a property but does not delete the property.
clsClear-HostClears the display in the host program.
clvClear-VariableDeletes the value of a variable.
cnsnConnect-PSSessionReconnects to disconnected sessions
compareCompare-ObjectCompares two sets of objects.
copyCopy-ItemCopies an item from one location to another.
cpCopy-ItemCopies an item from one location to another.
cpiCopy-ItemCopies an item from one location to another.
cppCopy-ItemPropertyCopies a property and value from a specified location to another location.
curlInvoke-WebRequestGets content from a webpage on the Internet.
cvpaConvert-PathConverts a path from a Windows PowerShell path to a Windows PowerShell provider path.
dbpDisable-PSBreakpointDisables the breakpoints in the current console.
delRemove-ItemDeletes files and folders.
diffCompare-ObjectCompares two sets of objects.
dirGet-ChildItemGets the files and folders in a file system drive.
dnsnDisconnect-PSSessionDisconnects from a session.
ebpEnable-PSBreakpointEnables the breakpoints in the current console.
echoWrite-OutputSends the specified objects to the next command in the pipeline. If the command is the last command in the pipeline, the objects are displayed in the console.
epalExport-AliasExports information about currently defined aliases to a file.
epcsvExport-CsvConverts objects into a series of comma-separated (CSV) strings and saves the strings in a CSV file.
epsnExport-PSSessionImports commands from another session and saves them in a Windows PowerShell module.
eraseRemove-ItemDeletes files and folders.
etsnEnter-PSSessionStarts an interactive session with a remote computer.
exsnExit-PSSessionEnds an interactive session with a remote computer.
fcFormat-CustomUses a customized view to format the output.
flFormat-ListFormats the output as a list of properties in which each property appears on a new line.
foreachForEach-ObjectPerforms an operation against each item in a collection of input objects.
ftFormat-TableFormats the output as a table.
fwFormat-WideFormats objects as a wide table that displays only one property of each object.
galGet-AliasGets the aliases for the current session.
gbpGet-PSBreakpointGets the breakpoints that are set in the current session.
gcGet-ContentGets the contents of a file.
gciGet-ChildItemGets the files and folders in a file system drive.
gcmGet-CommandGets all commands.
gcsGet-PSCallStackDisplays the current call stack.
gdrGet-PSDriveGets drives in the current session.
ghyGet-HistoryGets a list of the commands entered during the current session.
giGet-ItemGets files and folders.
gjbGet-JobGets Windows PowerShell background jobs that are running in the current session.
glGet-LocationGets information about the current working location or a location stack.
gmGet-MemberGets the properties and methods of objects.
gmoGet-ModuleGets the modules that have been imported or that can be imported into the current session.
gpGet-ItemPropertyGets the properties of a specified item.
gpsGet-ProcessGets the processes that are running on the local computer or a remote computer.
groupGroup-ObjectGroups objects that contain the same value for specified properties.
gsnGet-PSSessionGets the Windows PowerShell sessions on local and remote computers.
gsnpGet-PSSnapInGets the Windows PowerShell snap-ins on the computer.
gsvGet-ServiceGets the services on a local or remote computer.
guGet-UniqueReturns unique items from a sorted list.
gvGet-VariableGets the variables in the current console.
gwmiGet-WmiObjectGets instances of Windows Management Instrumentation (WMI) classes or information about the available classes.
hGet-HistoryGets a list of the commands entered during the current session.
historyGet-HistoryGets a list of the commands entered during the current session.
icmInvoke-CommandRuns commands on local and remote computers.
iexInvoke-ExpressionRuns commands or expressions on the local computer.
ihyInvoke-HistoryRuns commands from the session history.
iiInvoke-ItemPerforms the default action on the specified item.
ipalImport-AliasImports an alias list from a file.
ipcsvImport-CsvCreates table-like custom objects from the items in a CSV file.
ipmoImport-ModuleAdds modules to the current session.
ipsnImport-PSSes sionImports commands from another session into the current session.
irmInvoke-RestMethodSends an HTTP or HTTPS request to a RESTful web service.
isepowershell_ise.exeExplains how to use the PowerShell_ISE.exe command-line tool.
iwmiInvoke-WMIMethodCalls Windows Management Instrumentation (WMI) methods.
iwrInvoke-WebRequestGets content from a web page on the Internet.
killStop-ProcessStops one or more running processes.
lpOut-PrinterSends output to a printer.
lsGet-ChildItemGets the files and folders in a file system drive.
manhelpDisplays information about Windows PowerShell commands and concepts.
mdmkdirCreates a new item.
measureMeasure-ObjectCalculates the numeric properties of objects, and the characters, words, and lines in string objects, such as files of text.
miMove-ItemMoves an item from one location to another.
mountNew-PSDriveCreates temporary and persistent mapped network drives.
moveMove-ItemMoves an item from one location to another.
mpMove-ItemPropertyMoves a property from one location to another.
mvMove-ItemMoves an item from one location to another.
nalNew-AliasCreates a new alias.
ndrNew-PSDriveCreates temporary and persistent mapped network drives.
niNew-ItemCreates a new item.
nmoNew-ModuleCreates a new dynamic module that exists only in memory.
npsscNew-PSSessionConfigurationFileCreates a file that defines a session configuration.
nsnNew-PSSessionCreates a persistent connection to a local or remote computer.
nvNew-VariableCreates a new variable.
ogvOut-GridViewSends output to an interactive table in a separate window.
ohOut-HostSends output to the command line.
popdPop-LocationChanges the current location to the location most recently pushed to the stack. You can pop the location from the default stack or from a stack that you create by using the Push-Location cmdlet.
psGet-ProcessGets the processes that are running on the local computer or a remote computer.
pushdPush-LocationAdds the current location to the top of a location stack.
pwdGet-LocationGets information about the current working location or a location stack.
rInvoke-HistoryRuns commands from the session history.
rbpRemove-PSBreakpointDeletes breakpoints from the current console.
rcjbReceive-JobGets the results of the Windows PowerShell background jobs in the current session.
rcsnReceive-PSSessionGets results of commands in disconnected sessions.
rdRemove-ItemDeletes files and folders.
rdrRemove-PSDriveDeletes temporary Windows PowerShell drives and disconnects mapped network drives.
renRename-ItemRenames an item in a Windows PowerShell provider namespace.
riRemove-ItemDeletes files and folders.
rjbRemove-JobDeletes a Windows PowerShell background job.
rmRemove-ItemDeletes files and folders.
rmdirRemove-ItemDeletes files and folders.
rmoRemove-ModuleRemoves modules from the current session.
rniRename-ItemRenames an item in a Windows PowerShell provider namespace.
rnpRename-ItemPropertyRenames a property of an item.
rpRemove-ItemPropertyDeletes the property and its value from an item.
rsnRemove-PSSessionCloses one or more Windows PowerShell sessions (PSSessions).
rsnpRemove-PSSnapinRemoves Windows PowerShell snap-ins from the current session.
rujbResume-JobRestarts a suspended job
rvRemove-VariableDeletes a variable and its value.
rvpaResolve-PathResolves the wildcard characters in a path, and displays the path contents.
rwmiRemove-WMIObjectDeletes an instance of an existing Windows Management Instrumentation (WMI) class.
sajbStart-JobStarts a Windows PowerShell background job.
salSet-AliasCreates or changes an alias (alternate name) for a cmdlet or other command element in the current Windows PowerShell session.
sapsStart-ProcessStarts one or more processes on the local computer.
sasvStart-ServiceStarts one or more stopped services.
sbpSet-PSBreakpointSets a breakpoint on a line, command, or variable.
scSet-ContentReplaces the contents of a file with contents that you specify.
selectSelect-ObjectSelects objects or object properties.
setSet-VariableSets the value of a variable. Creates the variable if one with the requested name does not exist.
shcmShow-CommandCreates Windows PowerShell commands in a graphical command window.
siSet-ItemChanges the value of an item to the valu