This document contains 25 practice questions for PowerShell. Each question provides a PowerShell command or series of commands to perform tasks like listing processes, changing directories, managing files and folders, exploring help content, and working with services. The submitted answers explain how to complete each task using the appropriate PowerShell cmdlets, parameters, and syntax.
This document contains 25 practice questions for PowerShell. Each question provides a PowerShell command or series of commands to perform tasks like listing processes, changing directories, managing files and folders, exploring help content, and working with services. The submitted answers explain how to complete each task using the appropriate PowerShell cmdlets, parameters, and syntax.
This document contains 25 practice questions for PowerShell. Each question provides a PowerShell command or series of commands to perform tasks like listing processes, changing directories, managing files and folders, exploring help content, and working with services. The submitted answers explain how to complete each task using the appropriate PowerShell cmdlets, parameters, and syntax.
Ans: To list all running processes on your computer
using get-process:
2. Narrow down the results of get-process to show
only processes with the name "explorer." Ans: To narrow down the results of Get-Process to show only processes with the name "explorer," you can use the -Name parameter. Here's the PowerShell command: 3. Change the current location to the root of the C drive using set-location. Confirm the change. Ans: To change the current location the command is:
To confirm the location we can use get-location
4. Use get-childitem to list the contents of the
current directory. Ans: To list the contents of the current directory using Get- ChildItem:
5. Create a new directory named
"PowerShellPractice" using a single command. Ans: To create a new directory named “PowerShellPractice” using a single command through:
6. Copy the contents of one directory to another using copy-item. Ans: To copy the contents of one directory to another using copy-item we can use the following command:
7. Display the contents of a text file using get-
content. Ans: To display the contents of a text file using get-content the command is: get-content -path “your path”
8. Clear the console screen using clear-host.
Ans: It clear the all console.
9. Remove a file using remove-item and confirm its deletion. Ans: To remove a file using remove-item command
We can see it successful removed.
10. Execute a ping to the loopback address
(127.0.0.1). Ans: To ping to the loopback address(127.0.0.1) the command will be: Test-Connection -ComputerName 127.0.0.1
11. Retrieve network configuration information
using ipconfig-all. Ans: To retrieve network configuration information using ipconfig-all: 12. Explain the purpose of get-alias and demonstrate its use. Ans: The Get-Alias commad in PowerShell is used to retrieve information about aliases. An alias is an alternate name or nickname for a cmdlet, function, script, or executable file. Aliases provide a way to create shorter, more convenient names for commands. 13. List all services on your computer using get- service. Ans: Here are my computer all services: 14. Filter services starting with the letters "a," "b," and "c" using get-service. Ans: To filter service starting with the letters “a,” “b,” “c” using command get-service:
15. Display detailed information about the
"wuauserv" service using get-help and get- service. Ans: To display information about the "wuauserv" service using get-help and get-service. 16. Access the detailed help for the get-service command. Ans: To access the detailed help for the get-service command is: get-help get-service -detailed 17. List all available verbs in PowerShell using get-verb. Ans: Here is the list of all available verbs in poershell using get-verb 18. Explore examples for the get-service command using get-help get-service -example. Ans: 19. Forcefully update the help content using update-help -force. Ans: Here is the result
20. Explore the full help content for get-service
using get-help get-service -full. Ans: Here is the results: 21. View the help content for a specific command online using get-help -online. Ans: Here is the result 22. Display all aliases using get-alias. Pick one alias and explain its purpose. Ans: Here is the results: The purpose of get-childitem: This means that using the "ls" alias is equivalent to using the Get- ChildItem cmdlet, which is commonly used to list the items in a directory. 23. Filter aliases to show only those related to services using get-alias *sv*. Ans: Here is the results:
24. Use get-service -name a*,b*,c* to list services
with names starting with "a," "b," or "c." Ans: Here is the results: 25. Display services with display names starting with "application" using get-service -displayname application*. Ans: To display services with display names starting with "application" using get-service -displayname application*: