开发者

Powershell remoting ApplicationArguments not working

I'm trying to pass some arguments into a new Powershell remoting session using the PSSessionOption's ApplicationArguments property. Unfortunately, the arguments don't seem to show up.

Here's the code:

$client = "Bubba"
$options = New-PSSessionOption -ApplicationArguments @{ Client = $client }

Enter-PSSession -ComputerName "Server" -SessionOption $options

$clientName =开发者_JAVA百科 $PSSenderInfo.ApplicationArguments.Client
$dir = New-Item "c:\temp\$clientName" -type directory

Exit-PSSession

This results in an error: "NewNotImplementedException at offset 101 in file:line:column..."

Am I doing something wrong?


Apparently Enter-PSSession and Exit-PSSession don't work within a script! They're for interactive command-line use only. This explains the problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜