Microsoft created the PowerShell for task automation and configuration management. If you want to learn the PowerShell and looking for some useful commands to start with, then watch this video till the end and you learn such 15 useful PowerShell commands for newbies.
Follow the timestamp to quickly jump to the command you want to learn--
1. Listing the drives 0:34
Get-PSDrive
To list drives with the file system
Get-PSDrive –PSProvider FileSystem
2. Listing the files in a directory 1:10
Get-ChildItem
To list files in another directory
Get-ChildItem path-of-another-directory
3. Changing the current directory 1:36
Set-Location path
4. Creating a new item 1:53
To create directory
New-Item –ItemType Directory –Path path -Name name-of-the-directory
To create file
New-Item –ItemType File –Path path –Name filename –Value “value in your file”
To edit content later
Set-Content –Path path-of-file –Value “your new value”
5. Viewing file information or printing it 3:10
To view file information
Get-Item file-name
To view the content of the file
Get-Content file-name
To view it in an external window
Get-Content file-name | Out-GridView
To print it
Get-Content file-name | Out-Printer
6. Renaming a file or folder 4:03
Rename-Item –Path path –NewName new-name
7. Copying or moving an item 4:34
To copy
Copy-Item path-with-file-name –Destination destination-path
To move
Move-Item –Path path-with-file-name –Destination destination-path
To move and rename
Move-Item –Path path-with-file-name –Destination destination-path-with-new-name
8. Removing a file or directory 5:44
Remove-Item file-or-directory-name
9. Getting all the commands 6:00
Get-Command
To get command of specific type
Get-Command –CommandType function, alias, or cmdlet
To search for a command
Get-Command *search-value
10. Getting help for a command 6:32
Get-Help command-name
To get examples
Get-Help command-name -Example
11. Getting the list of processes and services 7:04
For processes
Get-Process
For services
Get-Service
12. To stop a process 7:20
Stop-Process –Name name-of-process
To stop a particular instance of the process and confirm
Stop-Process –Id id-of-process –Confirm -PassThru
13. Get the list of Windows drivers 8:01
Get-WindowsDriver –Online –All
14. Taking backup of drivers 8:15
Export-WindowsDriver -Online -Destination path-for-backup
15. Scan for malware 8:42
Start-MpScan –ScanType QuickScan/FullScan –ScanPath directory-path-to-be-scanned
We will be uploading a video on advanced PowerShell commands so subscribe to the channel and press the bell button to get the notification.
Ещё видео!