This document contains 25 practice questions about using PowerShell to retrieve and manage system services and processes. The questions cover tasks like exporting data to files in different formats, filtering and sorting lists, simulating commands, and changing service properties. Answers are not provided but would demonstrate how to accomplish each task using PowerShell commands and parameters.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
13 views18 pages
3
This document contains 25 practice questions about using PowerShell to retrieve and manage system services and processes. The questions cover tasks like exporting data to files in different formats, filtering and sorting lists, simulating commands, and changing service properties. Answers are not provided but would demonstrate how to accomplish each task using PowerShell commands and parameters.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18
PowerShell Practice Questions - 3
1. Save a list of all services to a text file named
"serviceout.txt" in the "C:\Users\User\test" directory. Ans:
2. Create a CSV file named "service.csv" containing
information about all services using Export-Csv. Ans:
3. Use Import-Csv to read the contents of "service.csv"
and display the imported data. Ans:
4. Save information about all processes to an XML file
named "process.xml" using Export-Clixml. Ans: 5. Generate an HTML file named "test.html" displaying the names and statuses of all services using ConvertTo-Html. Ans:
6. Simulate saving information about all services to the
root of the C drive without actually doing it. Use the - WhatIf parameter. Ans:
7. Save information about all services to a text file
named "testfile.txt" in the "C:\Users\User\test" directory. Add a confirmation prompt before overwriting an existing file. Ans:
8. Display the properties available for services using
Get-Service | Get-Member. Ans:
9. Sort processes by Working Set (WS) in descending
order and display only those with a WS greater than 2000. Ans:
10. Sort services by their names and select only the
"Name" and "Status" properties. Save the output to a file named "services_sorted.txt." Ans:
11. Display processes with an ID greater than 1000,
showing only the "Id" and "ProcessName" properties. Sort the output in descending order. Ans: 12. Retrieve the latest 10 entries from the System log, selecting and displaying the "TimeWritten," "EntryType," and "InstanceID" properties. Sort the output by "InstanceID" and convert it to an HTML file named "Path.html." Ans:
13. Export information about all processes to a CSV
file named "process_info.csv," including only the "Name" and "WorkingSet" properties. Ans:
14. Display processes with a working set greater
than 500 MB and a private memory size greater than 200 MB. Ans:
15. Sort services by display name in ascending order
and display only the "DisplayName" and "StartType" properties. Ans:
16. Change the start type of the "wuauserv" service
to "Manual." Ans:
17. Display a list of processes showing the "Name"
and a calculated property for the total CPU time in hours. Ans:
18. Show services that are currently running and set
to start automatically. Ans:
19. Retrieve events from the Security log that
occurred in the last 24 hours. Ans:
20. Display a list of services showing the
"DisplayName" property with a custom label "Service Name." Ans:
21. Save information about all processes to an XML
file named "process_data.xml" using Export-Clixml. Use a variable to store the data and then export it. Ans: 22. Display processes where the process name starts with the letter "s" and the CPU time is greater than 10 seconds. Ans: 23. Show a list of services with the "DisplayName" property and an additional calculated property that combines the service name and status. Ans: 24. Stop the "wuauserv" service, but add a confirmation prompt before taking any action.