PowerShell 101

 Here are a few basic PowerShell cmdlets with examples:

  1. Get-Command: This cmdlet is used to retrieve a list of all available commands in the current session.
    Example: Get-Command

  2. Get-Help: This cmdlet is used to retrieve help information for a specific cmdlet or for PowerShell in general.
    Example: Get-Help Get-Command

  3. Get-ChildItem: This cmdlet is used to retrieve a list of items in a specified directory. It is similar to the "ls" command in Linux.
    Example: Get-ChildItem C:\

  4. Get-Process: This cmdlet is used to retrieve a list of running processes on the computer.
    Example: Get-Process

  5. New-Item: This cmdlet is used to create a new item such as a file, directory, or symbolic link.
    Example: New-Item -ItemType Directory -Path C:\TestDirectory

  6. Remove-Item: This cmdlet is used to delete an item such as a file, directory, or symbolic link.
    Example: Remove-Item C:\TestDirectory

  7. Start-Process: This cmdlet is used to start a new process.
    Example: Start-Process Notepad

  8. Stop-Process: This cmdlet is used to stop a running process.
    Example: Stop-Process -Name Notepad

  9. Get-Service: This cmdlet is used to retrieve a list of services on the computer.
    Example: Get-Service

  10. Set-Service: This cmdlet is used to start, stop, or modify a service.
    Example: Set-Service -Name W32Time -StartupType Manual

No comments:

Post a Comment