EDUCBA Logo

EDUCBA

MENUMENU
  • Explore
    • EDUCBA Pro
    • PRO Bundles
    • Featured Skills
    • New & Trending
    • Fresh Entries
    • Finance
    • Data Science
    • Programming and Dev
    • Excel
    • Marketing
    • HR
    • PDP
    • VFX and Design
    • Project Management
    • Exam Prep
    • All Courses
  • Blog
  • Enterprise
  • Free Courses
  • Log in
  • Sign Up
Home Data Science Data Science Tutorials PowerShell Tutorial PowerShell Commands
 

PowerShell Commands

Updated June 1, 2023

PowerShell Commands

 

 

What are PowerShell Commands?

The following article provides an outline for PowerShell Commands. PowerShell is an automated object-oriented scripting language. System administrators widely use it. PowerShell is built on .Net, a framework. It uses a common language run-time, and this framework accepts and returns. NET Framework objects. It also introduces a feature of a cmdlet, a simple command-line tool built into a shell. It is open-source and cross-platform. The cmdlets can access data from different data stores, like a file system or registry. The cmdlets can be added by a third-party provider as well.

Watch our Demo Courses and Videos

Valuation, Hadoop, Excel, Mobile Apps, Web Development & many more.

Basic PowerShell Commands

The following are the basic PowerShell commands:

1. Get-Help

This is the most important command any Windows admin can use. This command can be used to get help with other commands. To get information about other commands, this command is useful. Windows will display the full command syntax.

Get-Help(PowerShell Commands)

2. Set-Execution Policy

To prevent any malicious code from executing in the PowerShell environment, Microsoft has disabled scripting.

To control this level of security, users can make use of this command and then change it to any of the following:

  • Restricted: This default Set option locks PowerShell to enter only interactively.
  • All signed: This mode allows all scripts to run only when a trusted publisher signs them.
  • Remote signed: This mode allows locally created PowerShell scripts to run if this option is set.
  • Unrestricted: By doing so, the execution policy will have all restrictions lifted.

cself-execution policy(PowerShell Commands)

3. Get-Execution Policy

When the admin is not familiar with the server, they must understand the execution policy used to run the script, which can be found by using the Get-Execution policy.

Get-Execution Policy(PowerShell Commands)

4. Get-Process

This command can get a list of all running processes, displaying all currently running processes.

Get-Process(PowerShell Commands)

5. Stop-Process

Sometimes a process may be stuck. Using Get-Process, the process’s id can be found, and the user can terminate this process using the Stop-Process command. The name of the process id can be used to terminate the ongoing process.

Stop Process(PowerShell Commands)

6. Select-Object

Numerous properties are included in the CSV file whenever an object is exported. The select command assists in filtering and narrowing down specific objects of interest. This command allows you to specify some specific properties for inclusion. For instance, you can utilize the following command to generate a CSV file containing the system names and their respective statuses.

Select Object

7. Get-Event Log

To parse the computer event logs, PowerShell is widely used. This is because it provides many parameters that help in finding the log by providing a -log switch followed by the log file’s name.

Get-Event Log

8. Export CSV

Exporting the data from PowerShell into a CSV file is easy and can be accessed easily using Excel. The user needs to specify the output filename to which the data can be exported as a CSV file.

Export CSV

9. Convert To-HTML

PowerShell can provide system information and generate reports that anyone can share. You can achieve this by utilizing the Convert To-HTML function. To use this command, the user can easily pipe the output from another command into Convert To-HTML. In addition, users can use a Property switch, which helps control the output, which includes an HTML file.

Convert To-HTML

10. Get-Service

Executing this command will generate a list of all installable services. If the user wants some specific service, they can append the -Name switch and then name it.

Get-Service

Intermediate PowerShell Commands

Below is the list of Intermediate PowerShell Commands:

  • Dir: It gets all files and folders in a file system drive.
  • Epsn: This command imports commands from different sessions and saves them in the Windows PowerShell module.
  • fl: It formats the output list of properties in which all properties appear on a new line.
  • Get-Job: It gets the Windows PowerShell background jobs running in the current session.
  • Get-Member: It helps in getting the properties and methods of the object.
  • Get-Item Property: It receives the property of a specified item.
  • Invoke-Command: It runs the commands on local and remote computers.
  • Invoke-WMI Method: It calls the Windows Management Instrumentation method.
  • New-PSDrive: It creates temporary and persistent mapped network drives.
  • Out-Host: It sends output to the command line.

Advanced PowerShell Commands

These advanced commands for PowerShell help obtain information in different formats and configure security.

  • Get-Unique: This is a cmdlet that fetches unique objects from a sorted list of objects.
  • Measure-Object: This cmdlet can get properties of passed output for functions like min, max, size, count, line, etc.
  • Where-Object: This cmdlet selects objects with particular property values from a collection of objects passed to it.
  • Start-Sleep: This is also a cmdlet that suspends the activity in a script or session for a particular period.
  • Invoke-Expression: It performs a command or expression to the local computer.

Tips and Tricks to Use PowerShell Command

  • Make use of unique $variables. The variables can store and manipulate the data. It increases the flexibility and reuse of code.
  • Use Start-Transcript and Stop-Transcript to enable logging in your scripts.
  • Make use of Try and Catch to improve script resilience.
  • Use Import-CSV and Export-CSV links for importing and exporting data. You can make your own scripts.
  • For repetitive actions, use for each. Users can repeat blocks which can help in automating large manual tasks.

Conclusion

PowerShell Commands is a potent tool that helps the admin for monitoring and other purposes. It is analog in Linux and is also known as bash scripting. PowerShell offers cmdlets that enable command-line management of computers. It also provides access to data scores like registry and certificate scores. It also has a rich parser which helps in developing scripting language. Hence it helps in managing all activities with ease of command.

Recommended Articles

This has been a guide to PowerShell Commands. Here we discussed the concept, basic to advanced commands, and tips and tricks to use PowerShell Commands. You can also go through our other Suggested Articles to learn more –

  1. What are the Uses of Powershell?
  2. Guide To PowerShell String Functions
  3. How to Use PowerShell? | PowerShell Scripts with Examples
  4. Complete Guide to PowerShell Get-Item

Primary Sidebar

Footer

Follow us!
  • EDUCBA FacebookEDUCBA TwitterEDUCBA LinkedINEDUCBA Instagram
  • EDUCBA YoutubeEDUCBA CourseraEDUCBA Udemy
APPS
EDUCBA Android AppEDUCBA iOS App
Blog
  • Blog
  • Free Tutorials
  • About us
  • Contact us
  • Log in
Courses
  • Enterprise Solutions
  • Free Courses
  • Explore Programs
  • All Courses
  • All in One Bundles
  • Sign up
Email
  • [email protected]

ISO 10004:2018 & ISO 9001:2015 Certified

© 2025 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

By continuing above step, you agree to our Terms of Use and Privacy Policy.
*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

EDUCBA Login

Forgot Password?

🚀 Limited Time Offer! - ENROLL NOW