PS版本:2.0
大家好,
我正在尝试使用 psexec 从 powershell 脚本运行批处理文件。
该脚本在手动触发或使用 Windows 任务调度程序时运行良好;但是,powershell 会从 Control-m 触发,但不会完成使用 psexec 的部分。powershell 脚本的其余部分运行良好。
下面是不起作用的函数,除了它没有给出任何错误之外,它只是冻结了脚本:
function Archive_Logs($Server_Name,$Tool_Path,$Name)
{
foreach($TPath in $Tool_Path){
C:\Windows\System32\PsExec.exe \\$Server_Name "$TPath\ziplogs.bat"
if($LastExitCode -eq 0)
{
"$Name Server logs archive Started successfully at $(Get-Date)" | Out-File $LOGFILE -Append
}
}
}
Control-M 使用的帐户是服务器上的本地管理员。