序列化对象如何在Powershell中工作

时间:2019-02-09 13:15:32

标签: powershell serialization

业余爱好者有关序列化的问题。

Get-Mailbox | Where-Object {$_.userprincipalname -like "*@network.local"}  |   Set-Mailbox -UserPrincipalName $_.name+'@newco.com'

powershell为什么抱怨:

  

无法将参数'UserPrincipalName'绑定到目标。异常设置“ UserPrincipalName”:“属性不能为空。”   在C:\ Users \ adminmt \ AppData \ Local \ Temp \ tmp_11wcqppu.sax \ tmp_11wcqppu.sax.psm1:51581 char:9   + $ steppablePipeline.End()   + ~~~~~~~~~~~~~~~~~~~~~~~~       + CategoryInfo:WriteError:(:) [Set-Mailbox],ParameterBindingException       + FullyQualifiedErrorId:ParameterBindingFailed,Microsoft.Exchange.Management.RecipientTasks.SetMailbox

看到 类型名称:Deserialized.Microsoft.Exchange.Data.Directory.Management.Mailbox

我对序列化对象不了解的地方是什么:)

谢谢。

当然会有其他选择来完成此操作,但是目的是要了解其机制。

使用name属性修改UPN

0 个答案:

没有答案