开发者

Powershell remoting ApplicationArguments not working

开发者 https://www.devze.com 2023-01-17 14:50 出处:网络
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.

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

精彩评论

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