Powershell commands for beginners..
Hello buddy,welcome to my blog. since powershell is a great stuff to learn ,i had listed some of the
basic commands you can use in powershell..
Don't worry even if you don't know anything like how to start..Just focus on running the below
commands,at the end you will end up as an intermediate.
Open powershell and try it out, don't memorize💠experiment yourself you will learn better ..
Some of the following Command will only work,when you run Powershell as administrator,so run it
as admin as first step.
[See : How to run Powershell as Administrator]
The first step is to Change your location to C..,type the following command
Set-location c:\ - Will change the location to c directory
if we wish to change the location to d then i need to type the following command set-location d:\
Next,To find all the items in the directory,we can use
get-childitem - It will display all the items like .dll files,.exe files inside the directory,for example
:running get-childitem c:\Windows\System32 will display all the .dll files and other items inside that folder.
Running the command Clear will clear the items in the Powershell window.
Here,comes the main part
[type the following commands after get-help suffix will make you "master of Powershell"
which means,if you wish to become master of powershell then type get-help followed by the below commands
for example : get-help get-alias
get-help where-object,etc..]
To get all the alias,type the command get-alias
It will display the alias..
the items that are on the left side or the shortcut symbols we can use to do the required tasks,which will be very much useful in minimizing your typing effort..
% -> Foreach-Object
? -> Where-Object
ac -> Add-Content
asnp -> Add-PSsnapin
cat -> Get-content
cd -> Change-directory
CFS -> ConvertFrom-String
chdir -> Set-location
clc -> Clear-Content
Clear,cls-> Clear-Host
clhy-> Clear-History
Cli -> Clear-Item
clp-> Clear-ItemProperty
clv-> Clear-Variable
cnsn -> Connect-PSSession
Compare -> Compare-Object
Copy,cp,cpi -> Copy-Item
Cpp ->Copy-ItemProperty
curl -> Invoke-WebRequest
cvpa -> Convert-path
dbp -> disable-PSBreakpoint
del -> Remove-Item
diff -> compare-Object
dir -> get-childitem
dnsn -> disconnect-PSSession
ebp -> enable-PSBreakpoint
echo -> write-Output
epal -> Export-Alias
epcsv -> export-Csv
epsn -> Export-PSSession
erase -> Remove-Item
etsn -> Enter-PSSession
exsn -> Exit-PSSession
fc -> Format-Custom
fhx -> Format-Hex
ft -> Format-table
fw -> Format -Wide
gal -> get-alias
gbp -> Get-PSBreakpoint
gc -> get-Content
gcb -> get-Clipboard
gci -> Get-ChildItem
gc -> get-Content
gcm -> get-command
gcs -> Get-PSStack
gdr -> get-PSdrive
ghy ->get-History
gi -> get-item
gin -> Get-Computerinfo
gjb -> Get-Job
gl ->get-location
gm -> get-member
gmo ->get-Module
gp -> get-ItemProperty
gps -> get-Process
gpv -> Get -ItemPropertyValue
group ->Group-Object
gsn -> get-PSSession
gsnp -> get-PSSnapin
gsv -> get-Service
gtz ->Get-timezone
gu -> Get -Unique
gv -> Get-variable
gwmi -> Get-WmiObject
h,Histroy ->Get-History
icm -> Invoke-Command
iex -> Invoke -Expression
ihy -> Invoke-History
li => Invoke-Item
ipal -> Import-Alias
ipcsv -> Import-CSV
ipmo ->Import-Module
ipsn -> Import-PSSession
irm -> Import-ResetMethod
ise -> powershell_ise.exe
iwmi -> Invoke-WmiMethod
iwe -> Import-WebRequest
kill -> Stop-Process
ip-> Out-Printer
ls -> Get-ChildItem
man -> help
md -->MkDir
measure -> Measure-Object
mi -> Move-Item
mp -> Move-Property
mv -> Move-Item
nal -> New-Alias
ndr ->New-PSDrive
ni -> New-Item
nmo -> New-Module
npssc -> New-PSSessionConfigurationFile
nsn -> New-PSSession
nv->New-Variable
ogv -> Out-GridView
oh ->Out-Host
popd ->Pop-Location
ps ->Get-Process
pushd->Push-Location
pwd ->Get-Location
r ->Invoke-History
rbp -> Remove-BreakPoint
rcgp ->Receive-job
rm ->Remove-Item
rmo -> Remove-Module
rni -> remove-Item
rnp -> Remove-ItemProperty
rsn -> Remove-PSSession
rsnp ->Remove-PSSnapin
rujb -> Resume-Job
rv -> Remove-Variable
rvpa ->Resolve-path
rwmi -> Remove-WMIObject
sajb -> Start-Job
sal -> Set-Alias
saps -> Start-Process
sasv -> Start-Service
sbp ->Set-BreakPoint
scb -> Set-ClipBoard
select -> Select -Object
set -> Set-Variable
shcm -> Show-Command
si ->Set-Item
sl ->Set-Location
sleep -> Start-Sleep
sls -> Set-String
sort -> Sort-Object
sp -> Set-ItemProperty
spjb -> Stop-Job
spps -> Stop-Process
spsv -> Stop-Services
start -> Start-Service
stz -> Set-TimeZone
sujb -> Suspend-Job
sv -> Set-Variable
swmi -> Set-WmiInstance
tee -> tee-Object
trcm -> Trace-Command
type -> Get-Content
wget -> Invoke-WebRequest
where -> Where-Object
wjb -> Wait-Job
write -> Write-Output
To get the alternative command for the same process,for example if we need to get what are the commands we can use instead of Get-Process(i.e.,we can get the process using two ways),we can use the parameter called Definition
So,running get-alias -Definition get-Process
will display the list of alternative words we can use to get the process,in our case it will display the following items
gps -> GetProcess
ps -> get-process
in the sameway,we can use any cmdlet to check what the alternative is for..
Example 2: Running following command will display the alternative for stop process
get-alias -Definition stop-process
kill -> Stop-Process
spps -> Stop-Process
To get other commands,then simply type get-help followed by the process you wish to do..
for example : if you wish to know the command for write operation,then simply execute
get-help "write" or get-help "*write"
you can also use the word -detailed as suffix to the above command( i.e., get-help "write" -detailed) will display the help in detail.
You can also use the suffix examples to get the examples on how you can use the command.
for example : get-help "write" -examples
will display the list of examples..
in the above way,you can use the help to find everything and code wiser.
I don't like to write and show every other commands & what it will do, because i want you to
discover yourself. But don't run the type of commands like get-service | stop-service
2) restart-computer,etc because it will immediately damage your system. on that case you can use -whatif command which won't execute,but will display what will happen when you do such tasks.
Remember there will get-help command inside the powershell as your trusted friend when
you need help at any time,any where..
if you can't find what you need,then search online by running get-help (type your task here) -online.
i.e.,running get-help get-service -online
will collect the resource from internet (microsoft servers)
you can also visit powershell.org community to ask your questions there, there will be people who
loves to help us ( i said us,because not everything will be known to everyone, & there will be suituation
where beginners like you will answer the toughest questions easily.which are very hard to mvp's..So don't forget to give it a try,it will boost your Skills )
Tip : When you feel why commands are not working or displaying error,then always makesure you are running Powershell as admin.
As,said earlier don't memorize..! just work out, use forums if you need any help ,you will find new way of mastering yourself✌✌✌✌
Good luck😊😊😊.
Hello buddy,welcome to my blog. since powershell is a great stuff to learn ,i had listed some of the
basic commands you can use in powershell..
Don't worry even if you don't know anything like how to start..Just focus on running the below
commands,at the end you will end up as an intermediate.
Open powershell and try it out, don't memorize💠experiment yourself you will learn better ..
Some of the following Command will only work,when you run Powershell as administrator,so run it
as admin as first step.
[See : How to run Powershell as Administrator]
The first step is to Change your location to C..,type the following command
Set-location c:\ - Will change the location to c directory
if we wish to change the location to d then i need to type the following command set-location d:\
Next,To find all the items in the directory,we can use
get-childitem - It will display all the items like .dll files,.exe files inside the directory,for example
:running get-childitem c:\Windows\System32 will display all the .dll files and other items inside that folder.
Running the command Clear will clear the items in the Powershell window.
Here,comes the main part
[type the following commands after get-help suffix will make you "master of Powershell"
which means,if you wish to become master of powershell then type get-help followed by the below commands
for example : get-help get-alias
get-help where-object,etc..]
To get all the alias,type the command get-alias
It will display the alias..
the items that are on the left side or the shortcut symbols we can use to do the required tasks,which will be very much useful in minimizing your typing effort..
% -> Foreach-Object
? -> Where-Object
ac -> Add-Content
asnp -> Add-PSsnapin
cat -> Get-content
cd -> Change-directory
CFS -> ConvertFrom-String
chdir -> Set-location
clc -> Clear-Content
Clear,cls-> Clear-Host
clhy-> Clear-History
Cli -> Clear-Item
clp-> Clear-ItemProperty
clv-> Clear-Variable
cnsn -> Connect-PSSession
Compare -> Compare-Object
Copy,cp,cpi -> Copy-Item
Cpp ->Copy-ItemProperty
curl -> Invoke-WebRequest
cvpa -> Convert-path
dbp -> disable-PSBreakpoint
del -> Remove-Item
diff -> compare-Object
dir -> get-childitem
dnsn -> disconnect-PSSession
ebp -> enable-PSBreakpoint
echo -> write-Output
epal -> Export-Alias
epcsv -> export-Csv
epsn -> Export-PSSession
erase -> Remove-Item
etsn -> Enter-PSSession
exsn -> Exit-PSSession
fc -> Format-Custom
fhx -> Format-Hex
ft -> Format-table
fw -> Format -Wide
gal -> get-alias
gbp -> Get-PSBreakpoint
gc -> get-Content
gcb -> get-Clipboard
gci -> Get-ChildItem
gc -> get-Content
gcm -> get-command
gcs -> Get-PSStack
gdr -> get-PSdrive
ghy ->get-History
gi -> get-item
gin -> Get-Computerinfo
gjb -> Get-Job
gl ->get-location
gm -> get-member
gmo ->get-Module
gp -> get-ItemProperty
gps -> get-Process
gpv -> Get -ItemPropertyValue
group ->Group-Object
gsn -> get-PSSession
gsnp -> get-PSSnapin
gsv -> get-Service
gtz ->Get-timezone
gu -> Get -Unique
gv -> Get-variable
gwmi -> Get-WmiObject
h,Histroy ->Get-History
icm -> Invoke-Command
iex -> Invoke -Expression
ihy -> Invoke-History
li => Invoke-Item
ipal -> Import-Alias
ipcsv -> Import-CSV
ipmo ->Import-Module
ipsn -> Import-PSSession
irm -> Import-ResetMethod
ise -> powershell_ise.exe
iwmi -> Invoke-WmiMethod
iwe -> Import-WebRequest
kill -> Stop-Process
ip-> Out-Printer
ls -> Get-ChildItem
man -> help
md -->MkDir
measure -> Measure-Object
mi -> Move-Item
mp -> Move-Property
mv -> Move-Item
nal -> New-Alias
ndr ->New-PSDrive
ni -> New-Item
nmo -> New-Module
npssc -> New-PSSessionConfigurationFile
nsn -> New-PSSession
nv->New-Variable
ogv -> Out-GridView
oh ->Out-Host
popd ->Pop-Location
ps ->Get-Process
pushd->Push-Location
pwd ->Get-Location
r ->Invoke-History
rbp -> Remove-BreakPoint
rcgp ->Receive-job
rm ->Remove-Item
rmo -> Remove-Module
rni -> remove-Item
rnp -> Remove-ItemProperty
rsn -> Remove-PSSession
rsnp ->Remove-PSSnapin
rujb -> Resume-Job
rv -> Remove-Variable
rvpa ->Resolve-path
rwmi -> Remove-WMIObject
sajb -> Start-Job
sal -> Set-Alias
saps -> Start-Process
sasv -> Start-Service
sbp ->Set-BreakPoint
scb -> Set-ClipBoard
select -> Select -Object
set -> Set-Variable
shcm -> Show-Command
si ->Set-Item
sl ->Set-Location
sleep -> Start-Sleep
sls -> Set-String
sort -> Sort-Object
sp -> Set-ItemProperty
spjb -> Stop-Job
spps -> Stop-Process
spsv -> Stop-Services
start -> Start-Service
stz -> Set-TimeZone
sujb -> Suspend-Job
sv -> Set-Variable
swmi -> Set-WmiInstance
tee -> tee-Object
trcm -> Trace-Command
type -> Get-Content
wget -> Invoke-WebRequest
where -> Where-Object
wjb -> Wait-Job
write -> Write-Output
To get the alternative command for the same process,for example if we need to get what are the commands we can use instead of Get-Process(i.e.,we can get the process using two ways),we can use the parameter called Definition
So,running get-alias -Definition get-Process
will display the list of alternative words we can use to get the process,in our case it will display the following items
gps -> GetProcess
ps -> get-process
in the sameway,we can use any cmdlet to check what the alternative is for..
Example 2: Running following command will display the alternative for stop process
get-alias -Definition stop-process
kill -> Stop-Process
spps -> Stop-Process
To get other commands,then simply type get-help followed by the process you wish to do..
for example : if you wish to know the command for write operation,then simply execute
get-help "write" or get-help "*write"
you can also use the word -detailed as suffix to the above command( i.e., get-help "write" -detailed) will display the help in detail.
You can also use the suffix examples to get the examples on how you can use the command.
for example : get-help "write" -examples
will display the list of examples..
in the above way,you can use the help to find everything and code wiser.
discover yourself. But don't run the type of commands like get-service | stop-service
2) restart-computer,etc because it will immediately damage your system. on that case you can use -whatif command which won't execute,but will display what will happen when you do such tasks.
Remember there will get-help command inside the powershell as your trusted friend when
you need help at any time,any where..
if you can't find what you need,then search online by running get-help (type your task here) -online.
i.e.,running get-help get-service -online
will collect the resource from internet (microsoft servers)
you can also visit powershell.org community to ask your questions there, there will be people who
loves to help us ( i said us,because not everything will be known to everyone, & there will be suituation
where beginners like you will answer the toughest questions easily.which are very hard to mvp's..So don't forget to give it a try,it will boost your Skills )
Tip : When you feel why commands are not working or displaying error,then always makesure you are running Powershell as admin.
As,said earlier don't memorize..! just work out, use forums if you need any help ,you will find new way of mastering yourself✌✌✌✌
Good luck😊😊😊.