【发布时间】:2020-03-04 23:14:49
【问题描述】:
为什么我不能在 PowerShell 中使用变量作为参数?
Set-MsolUser -UserPrincipalName john.doe@contoso.com -$parameter Stockholm
$parameter 在这种情况下等于 City
Set-MsolUser : A positional parameter cannot be found that accepts argument '-City'.
At line:1 char:1
+ Set-MsolUser -UserPrincipalName john.doe@contoso.com
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Set-MsolUser], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.Online.Administration.Automation.SetUser
【问题讨论】:
标签: powershell powershell-4.0 azure-powershell