Advertisement
Guest User

Set-VDIServices

a guest
Jun 20th, 2016
428
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $serviceCSV = @"
  2. Name,VDIStartup,DefaultStartup,DisplayName
  3. ALG,Disabled,Manual,Application Layer Gateway Service
  4. BITS,Disabled,Auto,Background Intelligent Transfer Service
  5. BDESVC,Disabled,Manual,BitLocker Drive Encryption Service
  6. wbengine,Disabled,Manual,Block Level Backup Engine Service
  7. bthserv,Disabled,Manual,Bluetooth Support Service
  8. PeerDistSvc,Disabled,Manual,BranchCache
  9. Browser,Disabled,Manual,Computer Browser
  10. DeviceAssociationService,Disabled,Manual,Device Association Service
  11. DsmSvc,Disabled,Manual,Device Setup Manager
  12. DPS,Disabled,Auto,Diagnostic Policy Service
  13. WdiServiceHost,Disabled,Manual,Diagnostic Service Host
  14. WdiSystemHost,Disabled,Manual,Diagnostic System Host
  15. TrkWks,Disabled,Auto,Distributed Link Tracking Client
  16. EFS,Disabled,Manual,Encrypting File System (EFS)
  17. Eaphost,Disabled,Manual,Extensible Authentication Protocol
  18. WPCSvc,Disabled,Manual,Family Safety
  19. Fax,Disabled,Manual,Fax
  20. fhsvc,Disabled,Manual,File History Service
  21. FDResPub,Disabled,Manual,Function Discovery Resource Publication
  22. HomeGroupListener,Disabled,Manual,HomeGroup Listener
  23. HomeGroupProvider,Disabled,Manual,HomeGroup Provider
  24. SharedAccess,Disabled,Disabled,Internet Connection Sharing (ICS)
  25. wlidsvc,Disabled,Manual,Microsoft Account Sign-in Assistant
  26. MSiSCSI,Disabled,Manual,Microsoft iSCSI Initiator Service
  27. swprv,Disabled,Manual,Microsoft Software Shadow Copy Provider
  28. netprofm,Automatic,Manual,Network List Service
  29. CscService,Disabled,Manual,Offline Files
  30. defragsvc,Disabled,Manual,Optimize drives
  31. SstpSvc,Disabled,Manual,Secure Socket Tunneling Protocol Service
  32. SensrSvc,Disabled,Manual,Sensor Monitoring Service
  33. ShellHWDetection,Disabled,Auto,Shell Hardware Detection
  34. SNMPTRAP,Disabled,Manual,SNMP Trap
  35. SSDPSRV,Disabled,Manual,SSDP Discovery
  36. TapiSrv,Disabled,Manual,Telephony
  37. Themes,Disabled,Auto,Themes
  38. upnphost,Disabled,Manual,UPnP Device Host
  39. VSS,Disabled,Manual,Volume Shadow Copy
  40. WcsPlugInService,Disabled,Manual,Windows Color System
  41. wcncsvc,Disabled,Manual,Windows Connect Now - Config Registrar
  42. WinDefend,Disabled,Auto,Windows Defender Service
  43. WerSvc,Disabled,Manual,Windows Error Reporting Service
  44. WMPNetworkSvc,Disabled,Manual,Windows Media Player Network Sharing Service
  45. WSearch,Disabled,Auto,Windows Search
  46. WlanSvc,Disabled,Manual,WLAN AutoConfig
  47. WwanSvc,Disabled,Manual,WWAN AutoConfig
  48. "@
  49.  
  50. function Set-VDIService {
  51.     Param (
  52.     [switch] $undo,
  53.     [switch] $y
  54.     )
  55.     $recomendedservices = $serviceCSV | ConvertFrom-Csv
  56.     if ($undo -and $y) {
  57.         foreach ($setting in $recomendedservices) {
  58.             Set-Service $setting.Name -StartupType $setting.DefaultStartup
  59.             "Completed setting " + $setting.DisplayName
  60.         }
  61.     }#if undo and y
  62.     elseif ($y) {
  63.         foreach ($setting in $recomendedservices) {
  64.             Set-Service $setting.Name -StartupType $setting.VDIStartup
  65.             "Completed setting " + $setting.DisplayName
  66.         }#foreach
  67.     }#elseif y
  68.     else {
  69.         Write-Error "To make changes to this system, please use the -y parameter"
  70.     }#else
  71. }#function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement