A Practical Guide to Get, Set, New, Invoke, Start, Add, Copy, Clear & More
There are PowerShell verb names used to make cmdlets predictable.
PowerShell provides many standard verbs such as Get, Set, New, Find, Search,
Read, Invoke, Start, Add, Clear, Close, Copy, and Enter. Each verb represents
a different type of operation. For example, Get is generally used to retrieve
information, Set modifies an existing configuration, New creates a new object,
Start begins a service or process, and Copy creates a copy of an existing file
or resource. Understanding these verbs helps administrators predict what a
command is likely to do.
1. Get - retrieve information
This is probably the most important PowerShell verb.
Get-Service
Get a particular service:
Get-Service -Name Spooler
Get processes:
Get-Process
Get local users:
Get-LocalUser
Think:
Get = Show me information.
2. Set — change something
For example:
Set-Service -Name Spooler -StartupType Automatic
You're changing the startup type of the Spooler service.
You'll see something like:
Name State StartMode ---- ----- --------- Spooler Running Auto
- Name → service name
- State → whether it's currently Running or Stopped
- StartMode → how Windows starts it (Auto, Manual, Disabled)
Even you check by GUI -> win + r -> services.msc -> Find Print Spooler or Spooler -> right click on this service -> Properties
Think:
Set = Change existing information.
3. New — create something
Create a folder:
New-Item -Path C:\Data\Test -ItemType Directory
Create a file:
New-Item -Path C:\Data\Test.txt -ItemType File
In Active Directory:
New-ADUser -Name "John Smith" -SamAccountName jsmith
Think:
New = Create something that doesn't
exist yet.
4. Find — find a resource
A good PowerShell example is:
Find-Module -Name Pester
This searches the PowerShell Gallery for the module.
Another example:
Find-Command -Name Get-ADUser
This helps find which module provides a command.
Think:
Find = Locate a PowerShell resource.
5. Search — search data/resources
For Active Directory:
Search-ADAccount -LockedOut
This searches AD for locked-out accounts.
Another
useful example:
Search-ADAccount -PasswordExpired
Think:
Search = Search for specific
conditions/data.
Important: Find and Search aren't interchangeable.
The exact availability of these verbs depends on the installed
module/cmdlets.
6. Read — read input/data
A common example is:
Read-Host "Enter your username"
It waits for the administrator to enter something.
For
example:
$name = Read-Host "Enter your name"
Then:
$name
Think:
Read = Receive/read information.
7. Invoke — execute something
This is extremely important for System Administrators.
For
example, execute a command on a remote server:
Invoke-Command -ComputerName SERVER01 -ScriptBlock {
Get-Service
}
PowerShell connects to SERVER01 and executes:
Get-Service
You
can also invoke a command locally:
Invoke-Command -ScriptBlock {
Get-ComputerInfo
}
Think:
Invoke = Execute something.
8. Start — start something
Start a Windows service:
Start-Service -Name Spooler
Start a process:
Start-Process notepad.exe
Think:
Start = Start an operation/process/service.
9. Add — add something
Add a user to a local group:
Add-LocalGroupMember -Group "Administrators" -Member "Atul"
For Active Directory:
Add-ADGroupMember -Identity "IT-Users" -Members tom
Think:
Add = Add an object/member to something.
10. Clear — clear contents
Clear a text file without deleting the file:
Clear-Content C:\Data\log.txt
The file remains, but its contents are removed.
Clear
the PowerShell screen:
Clear-Host
Usually you'll
see:
cls
which is an alias for Clear-Host.
Think:
Clear = Remove existing contents without necessarily deleting the
object.
11. Close — close something
For example, with SMB:
Close-SmbSession -SessionId 5
This closes a particular SMB session.
Think:
Close = Close an existing connection/session/resource.
12. Copy — copy something
Copy a file:
Copy-Item C:\Data\report.txt C:\Backup\
Copy a folder:
Copy-Item C:\Data C:\Backup -Recurse
Think:
Copy = Create a copy somewhere else.
For Currently Logged-in User
Get-CimInstance Win32_LoggedOnUser
13. Enter — enter a session
This one is particularly important for Windows administration.
Enter-PSSession -ComputerName SERVER01
You'll enter an interactive PowerShell session on SERVER01.
Your
prompt may change to something like:
[SERVER01]: PS C:\Users\Administrator>
Now:
Get-Service
runs on SERVER01,
not your local computer.
To leave:
Exit-PSSession
Think:
Enter = Enter an interactive session/environment.
The pattern you should remember
PowerShell cmdlets generally follow:
VERB - Noun
For Example:
Get - Service Set - Service Start - Service Stop - Service Get - Process Stop - Process Start - Process Get - LocalUser New - LocalUser Set - LocalUser Remove - LocalUser
This makes PowerShell much easier to learn.
Instead of memorizing
hundreds of commands individually, understand the verb + noun pattern.
💡 Why PowerShell?
For a Windows Administrator, PowerShell isn't just about knowing
commands. It's about using automation and scripting to troubleshoot systems,
manage users and services, collect information, and perform repetitive
administrative tasks efficiently.





0 comments:
Post a Comment
For Any Tech Updates, Hacking News, Internet, Computer, Technology and related to IT Field Articles Follow Our Blog.