핸들러 일반 활동 작업 VM
3528 단어 serverpowershelldevopsscripts
powershell을 사용하여 서비스, 프로세스, 일정 작업 등을 처리하는 작업
$computers = @(
'COMPUTER_NAME_1',
'COMPUTER_NAME_2'
)
foreach ($computer in $computers) {
Write-Host "ComputerName: $env:COMPUTERNAME ($(Get-Date -Format “MM/dd/yyyy”)) " -foregroundcolor "green"
#STOP PROCESS PID
# Invoke-Command -Computername $computer -scriptblock {stop-precess -id 123 } #number PID
#STOP SERVICE
# Invoke-Command -Computername $computer -scriptblock {stop-service SERVICE-NAME -force}
#Validate Service
# Invoke-Command -Computername $computer -scriptblock {get-service SERVICE-NAME}
#Start Service
# Invoke-Command -Computername $computer -scriptblock {start-service SERVICE-NAME }
#Disble TASK
# Invoke-Command -Computername $computer -scriptblock {Disable-ScheduledTask -TaskName TASKNAME}
#Enable TASK
# Invoke-Command -Computername $computer -scriptblock {Enable-ScheduledTask -TaskName TASKNAME}
#Start TASK
# Invoke-Command -Computername $computer -scriptblock {Start-ScheduledTask -TaskName TASKNAME}
#VALIDATE TASK WatchdogACA
Invoke-Command -Computername $computer -scriptblock {Get-ScheduledTask -TaskName "TASKNAME"}
#Get TASK by status Values: Running / Ready / Disabled / Queued / Unknown
#Invoke-Command -Computername $computer -scriptblock {Get-ScheduledTask | where{$_.State -eq "Ready"}}
}
Reference
이 문제에 관하여(핸들러 일반 활동 작업 VM), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/redhcp/handler-common-activities-tasks-vms-5fni텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)