0

我正在为 SCOM 2012 SP1 定制一个管理包,里面有一个监视器。该监视器基于 Microsoft.Windows.PowerShellTriggerOnlyProbe 模块和 WMI 对远程非域服务器的 powershell 脚本查询。此脚本应检查远程服务器上的特定进程。

Сorresponding 部分脚本:

$user = "username"
$password = ConvertTo-SecureString "password" -AsPlainText -Force
$cred =  New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $user,$password

try {
Get-WmiObject win32_Process -Impersonation Impersonate -Authentication Packet -credential $cred -ComputerName "$serverIP" | Select Name | Where-Object {$_.Name -eq "$Process"}
    }
Catch {
    $ErrorMSG = $_.Exception.Message.ToString()
}

当我从 SCOM 的操作帐户下的 powershell 控制台运行脚本时,脚本运行良好,但是当我将其导入 ManagementPack 时,我收到此错误:"Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"在 $ErrorMSG 中。

在远程服务器上使用本地管理员凭据。

远程服务器上没有 powershell,所以我不能使用 powershell 远程处理,唯一的方法是使用 WMI。请帮忙!

4

1 回答 1

0

您需要尝试将脚本作为系统运行。如果代理使用默认本地系统帐户运行,则这是唯一需要的测试。

于 2017-07-12T19:22:44.257 回答