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.
精彩评论