
응용 프로그램 서버 클러스터의 두 노드 간에 예약된 작업을 비교하기 위해 작성한 PowerShell 스크립트가 있습니다. 이 코드를 사용하여 특정 서버에서 작업을 쿼리합니다.
function getTasks($server) {
return Get-ScheduledTask -CimSession $server |
Where-Object TaskPath -like '*OurFolder*' |
ForEach-Object {
[pscustomobject]@{
Server = $server
Path = $_.TaskPath
Name = $_.TaskName
Disabled = ($_.State -eq 'Disabled')
Command = $_.Actions.Execute
Arguments = $_.Actions.Arguments
Interval = $_.Triggers.RepetitionInterval
HashId = "$($_.Actions.Execute)|$($_.Actions.Arguments)"
HashFull = "$($_.TaskPath)|$($_.TaskName)|$($_.Actions.Execute)|$($_.Actions.Arguments)|$(($_.State -eq 'Disabled'))"
}
}
}
내 도메인 관리자 계정으로 실행하면 완벽하게 작동합니다.
그러나 서비스 계정에서 예약된 작업으로 실행하려고 하면 다른 노드에서 예약된 작업을 쿼리하려고 할 때 이 오류가 발생합니다.
Get-ScheduledTask : SERVER.domain.local: Cannot connect to CIM server. Access is denied.
At F:\Applications\TaskSchedulerNodeCompare\compare-nodes.ps1:9 char:12
+ return Get-ScheduledTask -CimSession $server |
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (MSFT_ScheduledTask:String) [Get-ScheduledTask], CimJobException
+ FullyQualifiedErrorId : CimJob_BrokenCimSession,Get-ScheduledTask
구글링해서 여기저기 찾아보니외모계정이 이 목록에 액세스하도록 허용하는 유일한 방법은 해당 계정을 해당 서버의 LocalAdmins에 추가하는 것입니다. 하지만 서비스 계정을 로컬 관리자로 만들어야 한다는 것은 정말 옳지 않다고 생각하며, 당연히 내 도메인 관리자 계정에서 작업을 실행하고 싶지도 않습니다.
난 노력 했어솔루션 번호 여기 3개, 어느소리그럴 것 같은...
1. As an Administrator of the server, go to Server Manager -> Tools -> Computer Management. On the left expand "Services and Applications" and right click "WMI Control". Go to "Properties".
2. In the newly open Window, click on Security tab.
3. Expand Root tree, and then click on the node CIMV2, and click the button security
4. In the newly open Window, click the button Advanced.
5. In the newly open Window, click the button Add under the permission tab.
6. In the newly open Window, click on “select a principal", then search for the user you that was having the problem.
7. In the applies to, choose “this namespace and subnamespace".
8. For the permission, check on “Execute Methods", “Enable Accounts" and “Remote Enable"
9. Click accept on all the open dialogue boxes
10. Restart WMI services. As an Admininstrator of the server, go to Server Manager -> Tools -> Computer Management. On the left expand "Services and Applications" and click on "Services". Go to "Windows Management Instrumentation" and right click it. Then choose "Restart".
11. Try the command again. The above directions were adapted from this StackOverflow posting.
하지만 모든 단계를 수행한 후에도 여전히 작동하지 않습니다.
보안을 최대한 고려하면서 서비스 계정이 서버에서 예약된 작업을 쿼리(읽기 전용)하도록 허용하려면 어떻게 해야 합니까?
답변1
내가 아는 바로는 예약된 작업은 작성자나 로컬 관리자 그룹의 구성원만 볼 수 있습니다. 또한 작업 솔루션이 로컬 개체 또는 이와 유사한 권한을 변경한 후 생성된 작업을 다룰 수 있을지 의심스럽습니다.
또한 매우 유사해 보이는 이 질문/답변을 참조하세요. 예약된 작업에 대한 권한 또는 ACL