Exercise 3

  1. Show a table that includes only the names of the processes, their IDs, and whether they are responding to Windows (the Responding property shows that). Make the table take up a minimum of horizontal space, but don't allow the information to be truncated.

    Click me for proposed solution
    ps | ft -Property name, id, responding -Wrap
    

  2. Display a table that includes the names of the processes and their IDs. Also include columns for physical and virtual memory usage; Express those values ​​in megabytes (MB).

    Click me for proposed solution
    ps | ft -Property name, id, @{n='vm [MB]';e={$_.vm/1MB -as [INT]}}, @{n='pm [MB]';e={$_.pm/1MB -as [INT]}}
    

  3. Use the cmdlet Get-EventLog to display a list of available event logs (check the help to find the parameter that will allow you to get that information). Format the output as a table that includes the log display name and the retention period. Column headers must be LogName and Per-Retention.

    Click me for proposed solution
    get-eventlog -list  | ft -property @{n='NombreLog';e={$_.log}}, @{n='Per-Retencion';e={$_.MinimumRetentionDays}}
    

  4. Display a list of services, so that the services that are started and those that are stopped are grouped together. Those who are initiated must appear first.

    Click me for proposed solution
    gsv | sort -property status -descending | ft -groupby status
    

  5. Display a four-column list of all directories that are at the root of drive C:

    Click me for proposed solution
    ls 'C:/' | format-wide name -col 4
    

  6. Create a formatted list of all .exe files in the C:\Windows directory. The name, version information, and size of the file should be displayed. The size property is called length in Powershell, but for clarity, the column should be called Size in your listing.

    Click me for proposed solution
    ls 'C:\Windows/*.exe' | ft name, @{n='Size';e={$_.Length}}, versionInfo -Wrap
    

  7. Import the NetAdapter module (using the Import-Module NetAdapter command). Using the Get-NetAdapter cmdlet, display a list of non-virtual adapters (adapters whose Virtual property is false. The boolean false is represented by Powershell as $False).

    Click me for proposed solution
    Get-NetAdapter | ? {$_.Virtual -eq $False} | fl
    

  8. Import the DnsClient module. Using the Get-DnsClientCache cmdlet, list the A and AAAA records that are in the cache. Tip: If the cache is empty, visit some websites to populate it.

    Click me for proposed solution
    Get-DnsClientCache -type 'A', 'AAAA' | fl
    

  9. Display a list of all .exe files in the C:\Windows\System32 directory that are larger than 5 MB.

    Click me for proposed solution
    ls 'C:\Windows\System32/*.exe' | ? {$_.length -gt 5MB} | fl
    

  10. Display a list of patches that are security updates.

    Click me for proposed solution
    Get-HotFix | ? {$_.description -eq "Security Update"} | fl
    

  11. Display a list of patches that have been installed by the Administrator user, which are updates. If you don't have any, look for user-installed patches System.

    Click me for proposed solution
    Get-HotFix | ? {$_.Description -like "*Update*" -and $_.InstalledBy -like "*System*"} | fl
    

  12. Generate a list of all running processes with the name Conhost or Svchost.

    Click me for proposed solution
    ps | ? {$_.Name -eq 'conhost' -or $_.Name -eq 'svchost'} | fl