What is PowerShell? How to use PowerShell commands? This post from MiniTool Partition Wizard offers you a list of PowerShell commands and introduces the 10 best PowerShell commands to you.
What Is PowerShell
PowerShell, also known as cmdlets, is an interactive Command-Line Interface (CLI) and automation engine designed by Microsoft to help design system configurations and automate administrative tasks.
It allows users to access Command Prompt, PowerShell Commands, .NET Framework API, Windows Management Instrumentation, and Windows Component Object Model. Compared to Command Prompt, PowerShell is more powerful, functional, and flexible. At the same time, it has a bit of a learning curve.
If you want to get a full list of PowerShell commands, you can refer to this SS64 page. It offers a PowerShell cheat sheet listed by the A-Z index. If you want to know the full basic PowerShell commands, you can refer to this Microsoft developer blog.
What Is Windows PowerShell? How About Windows PowerShell VS CMD?
10 Best PowerShell Commands
In this part, I will introduce the 10 best Windows PowerShell commands you should know.
If you don’t know how to use PowerShell commands, Get-Help can help you. It can find necessary information for the command, concepts, and functions, identify alias, scripts, and more. For example, if you want to know how to use PowerShell command Get-Process, you can execute this command: Get-Help Get-Process.
This command can do what Task Manager does. It can retrieve and show a list of all the active system processes with their identifiers (IDs) and then stop or restart them. If you want to stop a process, execute the following PowerShell commands:
- Get-Process (it will show all the running system processes and you need to find the ID associated with the process you want to stop)
- Get-Process -ID * | Stop-Process (replace * with the ID of the process you want to stop)
If you want to start a process, you can use the Start-Process command. The command syntax is Start-Process + process name.
This command lets you view all the PowerShell commands installed on your computer. It also allows you to find features with a specific name and CommandType. For example, if you want to find cmdlets (CommandTypes) that start with A (Name), you can use the following command: Get-Command -Name A* -CommandType cmdlet.
What command can be used to run exe from PowerShell? If you’re trying to figure it out, this post is what you need. It provides 3 ways on PowerShell run exe.
This command lets you view your computer's status and list of services. By default, it will return all the (stopped and running) services. You can also use the parameters to specify and find services depending on their status, name, and dependent services.
For example, Get-Service -Name "Win*". This command will find all services starting with the name Win.
This command can search through directories. If you want to view all the top-level folders in the C:\ directory, the command is Get-ChildItem "C:\". If you want to view all the sub-folders and files in a certain folder, you can use this command Get-ChildItem -Path "folder path".
This command lets you copy-paste files and folders and their contents to a different directory. The command syntax is as follows: Copy-Item + path 1 -Destination + path 2. For example, Copy-Item "E:\Folder1" -Destination "E:\Folder2" -Recurse. This will copy E:\Folder1 and its contents to E:\Folder2.
The -Recurse parameter is necessary. Without it, PowerShell will only copy the top-level folder (Folder1) and files specified in the command.
If you want to move a folder or file, you can use the Move-Item command. Its syntax is similar to Copy-Item. If you want to delete a file or folder, you can use the Remove-Item command and the syntax is as follows: Remove-Item + file path.
This command lets you view the content of an item. The syntax is as follows: Get-Content + file path. If you want to delete the contents of a specified file without deleting the file itself, you can use the Clear-Content command. The syntax is as follows: Clear-Content -Path + file path.
This command allows you to change the security levels for script execution so that you can avoid the “execution script is disabled on this system” error.
If you need to execute an unsigned script, you need to execute the following command in an elevated PowerShell prompt: Set-ExecutionPolicy RemoteSigned. Other valid Set-ExecutionPolicy values include Restricted, AllSigned, and Unrestricted.
This command can take the output file for the specified command and converts it to a CSV file. You can use it if you want to export and present PowerShell output in a more organized way. For example, Get-Process | Export-CSV PSprocess.csv. This command will create a psporcess.csv file with all the active processes' data.
If you would rather create an HTML report, you can use this command. For example, Get-Process | ConvertTo-HTML > PSprocess.html. Then, you can access the exported HTML file in the current working directory (C:\Users\username by default).
How to check disk space PowerShell Windows 10/11? Now, you come to the right place. This post focuses on PowerShell get disk space and provides an alternative.
MiniTool Partition Wizard can help you clone the system, manage disks better, and recover data. If you have this need, you can download it from the official website.
User Comments :Post Comment