Advertisement
Guest User

Untitled

a guest
Nov 19th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.72 KB | None | 0 0
  1. W2d.powershell cmdlet.research
  2. Exercise:
  3. The best way to learn PowerShell is by trying commands and see what the results are. Please research the use and function of the following commands. Please use these commands in context to learn PowerShell, and provide an example.
  4. Group 1
  5. Command
  6. Function
  7. Get-Help
  8. This shows the help menu. You can use the help function to find out similar commands.
  9. Get-Help command
  10. Get-Command
  11. Shows a list of all the command you can do.
  12. Get-Command (any command)
  13. Get-ChildItem
  14. Show the child directory
  15.  
  16. Shows all the items/folders and stuff into the directory
  17.  
  18.  
  19. Set-Location
  20. Is just like CD
  21. NAME
  22. Set-Location
  23.  
  24. SYNTAX
  25. Set-Location [[-Path] <string>] [-PassThru] [-UseTransaction] [<CommonParameters>]
  26. Clear-Host
  27. This clears the screen
  28.  
  29. Clear-Host
  30.  
  31.  
  32. Show-Command
  33. Gives a pop up of all the command and have a search bar
  34.  
  35. Show-command
  36.  
  37.  
  38. Get-EventLog
  39. Allows you to look for a nd open an event log
  40.  
  41. Get-EventLog logname
  42.  
  43.  
  44. Get-Service
  45. Shows a list of all running and stopped services on the system
  46.  
  47. Get-Service
  48.  
  49.  
  50. Get-VM
  51. This allows you to open a VM
  52.  
  53. Get-Vm Windows 10
  54.  
  55. New-VM
  56. Allows you to create a new VM
  57.  
  58.  
  59. New-VM Windows 10
  60.  
  61. New-Item
  62. Allows you to create any file type in the directory
  63. New-Item [-Path] <string[]> [-ItemType <string>] [-Value <Object>] [-Force] [-Credential <pscredential>] [-WhatIf]
  64. [-Confirm] [-UseTransaction] [<CommonParameters>]
  65.  
  66. Remove-Item
  67. Deletes the selected item
  68.  
  69. Remove-Item awindowsfile
  70.  
  71.  
  72. Move-Item
  73. Moves the item to somewhere else
  74.  
  75. Move-Item awindowsfile Desktop
  76.  
  77.  
  78. Copy-Item
  79. Copy and paste the item to somewhere else
  80.  
  81. Copy-Item awindowsfile Desktop
  82.  
  83.  
  84. Invoke-Item
  85. Basically a double click on a file
  86.  
  87. C:\> Invoke-Item "C:\folder\awindowsfile.doc"
  88.  
  89.  
  90. Rename-Item
  91. Renames a file
  92.  
  93. Rename-Item awindowsfile testfile
  94.  
  95.  
  96. Get-Content
  97. This reads the contents of a file a display it.
  98. C:\> Get-Content -Path "C:\Chapters\Chapter1.txt"
  99.  
  100.  
  101.  
  102. Set-Content
  103. This writes or replaces the content in the file
  104.  
  105.  
  106. C:\> Set-Content -Path "C:\Test1\test*.txt" -Value "Hello, World"
  107.  
  108. Clear-Content
  109. Deletes the contents of an item, but does not delete the item.
  110. Clear-Content
  111.  
  112.  
  113.  
  114. Add-Content
  115. Add contents to a file
  116. Add-Content c:\scripts\test.txt "The End"
  117.  
  118.  
  119.  
  120. Get-Service
  121. This gets a list of all running and stopped services on the system
  122.  
  123. Get-Service
  124.  
  125.  
  126. Start-service
  127. This starts up a services and runs its program
  128.  
  129. Start-Service wallpaper engine
  130.  
  131.  
  132. Stop-Service
  133. This stops a running service
  134.  
  135. Stop-Service wallpaper engine
  136.  
  137.  
  138. Suspend-Service
  139. This pause a service but doesn't shut it up. Can be easily resumed
  140. Suspend-Service wallpaper engine
  141.  
  142.  
  143.  
  144. Resume-Service
  145. This resumes a stopped service
  146.  
  147. Resume-Service ose64
  148.  
  149.  
  150. Restart-Service
  151. This restarts a service
  152.  
  153. Restart-Service Hyper-v
  154.  
  155.  
  156. New-Service
  157. Creates a new entry for a Windows service in the registry and in the service database.
  158. New-Service
  159. [-Name] <String>
  160. [-BinaryPathName] <String>
  161. [-DisplayName <String>]
  162. [-Description <String>]
  163. [-StartupType <ServiceStartMode>]
  164. [-Credential <PSCredential>]
  165. [-DependsOn <String[]>]
  166. [-WhatIf]
  167. [-Confirm]
  168. [<CommonParameters>]
  169.  
  170. Get-Process
  171. This gets a list of all active processes running
  172.  
  173.  
  174. Gett-Process
  175.  
  176. Start-Process
  177. Starts a process
  178. Start-Process -processname notepad
  179.  
  180.  
  181.  
  182. Stop-Process
  183. Ends a process
  184. Stop-Process -processname notepad
  185.  
  186.  
  187.  
  188. Wait-Process
  189. Waits for one or more running processes to be stopped before accepting input.
  190. Wait-Process
  191. [-Name] <String[]>
  192. [[-Timeout] <Int32>]
  193. [<CommonParameters>]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement