Powershell:Start-Process:由于错误,无法运行此命令:传递给系统调用的数据区域太小

时间:2016-02-23 17:25:40

标签: powershell-v3.0

这是我的代码。密码部分很好。但是,我收到了错误

Start-Process : This command cannot be run due to the error: The data area passed to a system call is too small.

运行时。它引用了" Start-Process"线。我错过了什么?这是一个使用我提供的凭据停止远程服务器上的服务的脚本。它运行的代码也显示如下

    $ServiceAccountAdmin= "Domain\ServiceAccount"
    $Password = Get-Content "C:\PSScripts\Passwords\ServiceAccount.txt" | ConvertTo-SecureString -AsPlainText -Force
    $Credential = New-object System.Management.Automation.PSCredential "$ServiceAccountAdmin",$Password

    Start-Process $PSHOME\Powershell.exe -Credential $Credential  "C:\PSScripts\Services\StopSMSAGent.ps1"

StopSMSAgent代码:

    $SMSAgentHost = Get-WmiObject win32_service | Where-Object {$_.name -eq "CcmExec"}
    $SMSAgentHost.stopservice() 

0 个答案:

没有答案