top of page

PowerShell | Services Delayed Start

<#
Summary:  

          Get list of computers from file
          Loop and test connection
          Set services to delayed start    
                            
Author:   Scott Head
Date:     02/09/2022
Version:  1.0 
#>
#Get input from file

$Computers = Get-Content C:\temp\Comp-Input.txt
$ArrayPing=@()

#Loop through computer and test connection
Foreach($Computer in $Computers){
    $Checker=Test-Connection $Computer.Trim() -Count 1 -Quiet    
    If($Checker){$ArrayPing+=$Computer}
    Write-Host $Computer    
}

#Use SC.exe Tool to change services startup
ForEach ($Comp In $ArrayPing){
   Write-Host "`n $Comp"
    SC.EXE \\$Comp Config GGSMGR Start= Delayed-Auto
     SC.EXE \\$Comp Config d7a_sshd Start= Delayed-Auto
      SC.EXE \\$Comp Config MySQL Start= Delayed-Auto     
}

bottom of page