调用命令InDisconnectedSession SessionOption和IdleTimeout一类

时间:2019-09-13 21:55:44

标签: powershell

我正在尝试执行以下简单的一项工作:

consumer.handler(record -> {
  System.out.println("Processing key=" + record.key() + ",value=" + record.value() +
    ",partition=" + record.partition() + ",offset=" + record.offset());
});

// subscribe to a single topic
consumer.subscribe("a-single-topic");

但是出现以下错误:

Invoke-Command : The specified IdleTimeout session option 0 (seconds) is not
a valid period.  Specify an IdleTimeout value that is greater than or equal to
the minimum allowed 60 (seconds).
At line:1 char:1
+ Invoke-Command -ComputerName localhost -Credential Administrator { ip ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Invoke-Command], PSArgumentException
    + FullyQualifiedErrorId : Argument,Microsoft.PowerShell.Commands.InvokeCommandCommand

documentation中的示例16看起来非常相似,但是我无法使其正常工作。

1 个答案:

答案 0 :(得分:1)

有关:

Invoke-Command -ComputerName localhost -Credential Administrator -ScriptBlock { ipconfig } -InDisconnectedSession -SessionOption (New-PSSessionOption -IdleTimeout 180000)

希望有帮助。