Gwith

Lab 4.6 (Book's Answer)

Apr 30th, 2014
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. Function Get-ServiceStartMode {
  2.  
  3. Param(
  4. [string]$Computername='localhost',
  5. [string]$StartMode='Auto',
  6. [string]$State='Running'
  7. )
  8.  
  9. $filter="Startmode='$Startmode' AND state='$State'"
  10.  
  11. Get-CimInstance -ClassName Win32_Service -ComputerName $Computername -Filter $filter
  12.  
  13. }
  14.  
  15. #testing
  16. Get-ServiceStartMode
  17. Get-ServiceStartMode -Start 'Auto' -State 'Stopped'
  18. Get-ServiceStartMode -StartMode 'Disabled' -Computername 'localhost'
Advertisement
Add Comment
Please, Sign In to add comment