2010-09-24 69 views
0

我想通过使用PSSessionOption的ApplicationArguments属性将一些参数传递到新的Powershell远程会话。不幸的是,这些论据似乎并没有出现。Powershell远程ApplicationArguments不工作

下面的代码:

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

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

$clientName = $PSSenderInfo.ApplicationArguments.Client 
$dir = New-Item "c:\temp\$clientName" -type directory 

Exit-PSSession 

这将导致一个错误: “NewNotImplementedException在文件偏移量101:行:列...”

难道我做错了什么?

回答

0

显然Enter-PSSession和Exit-PSSession在脚本中不起作用!它们仅用于交互式命令行使用。这解释了这个问题。

+0

我在哪里可以阅读更多关于这方面的信息? – 2011-11-09 12:32:10