Advertisement
tuahwp

service-variable

Oct 5th, 2020
1,106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted
  2. $Title = "Amb Meow Meow - Ver 1"
  3. $host.UI.RawUI.WindowTitle = $Title
  4. Write-Host -ForegroundColor Green "
  5.             ===========================================
  6.                    Team KV Automate Script Ver 1   
  7.             ===========================================
  8.  
  9. "
  10.  
  11. Write-Host -Fore Yellow "     Features :  Semi-automated task. Some feature might not work properly for -wait argument"
  12. Write-Host -Fore Yellow "     [*]  Change computer name & join domain    "
  13. Write-Host -Fore Yellow "     [*]  Activate Windows Enterprise    "
  14. Write-Host -Fore Yellow "     [*]  Enable services APPM & BES Client    "
  15. Write-Host -Fore Yellow "     [*]  Uninstall java   "
  16. Write-Host -Fore Yellow "     [*]  Install SEP   "
  17. echo ""
  18.  
  19. Write-Host -Fore Cyan ">>>>> Press any key to begin...."
  20. [void][System.Console]::ReadKey($TRUE)
  21. ########################################################################
  22. $ServiceName = "Print Spooler", "XboxNetApiSvc"
  23. Write-Host "Updating APPM & BES Client Services. Please wait."
  24.  
  25. ForEach ( $service in $ServiceName ) {
  26.  
  27.     $serviceStatus = Get-Service $service
  28.  
  29.     if ($ServiceStatus.Status -ne "Running") {
  30.         Get-Service $service | Start-Service -PassThru | Set-Service -StartupType Automatic
  31.     }
  32.  
  33.     if ($ServiceStatus.status -eq "Running") {
  34.         Write-Host "$service is already running"
  35.     }
  36.  
  37. }
  38.  
  39. ####################################################################################
  40.  
  41. #reboot - macam biasa promt restart
  42. $reboot = Read-Host -Prompt "Reboot? y/n"
  43. if ($reboot -eq "y" -or $reboot -eq "Y")
  44. {
  45.     Restart-Computer
  46. }
  47.  
  48.  
  49. #sila tambah yang mana tak cukup. terima kasih
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement