Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
启用RemoteMailbox-从CSV或TXT(PowerShell)为一批用户设置o365 Exchange Online Hybrid_Powershell - Fatal编程技术网

启用RemoteMailbox-从CSV或TXT(PowerShell)为一批用户设置o365 Exchange Online Hybrid

启用RemoteMailbox-从CSV或TXT(PowerShell)为一批用户设置o365 Exchange Online Hybrid,powershell,Powershell,目前,我正在使用以下语法迁移用户并在组织中创建O365邮箱: $username = Read-Host -Prompt "`n Please provide AD-USERNAME to Migrate"; Enable-RemoteMailbox -Identity $username -RemoteRoutingAddress($username+'@zim365.mail.onmicrosoft.com') sleep 30 Get-RemoteMailbox

目前,我正在使用以下语法迁移用户并在组织中创建O365邮箱:

$username = Read-Host -Prompt "`n Please provide AD-USERNAME to Migrate";

Enable-RemoteMailbox -Identity $username -RemoteRoutingAddress($username+'@zim365.mail.onmicrosoft.com')

sleep 30

Get-RemoteMailbox $username|Set-RemoteMailbox -EmailAddressPolicyEnabled:$true
一切进展顺利

但这仅适用于单个用户。 我想将此操作提交给csv或txt中的用户列表 请帮助学习语法

非常感谢你的帮助


谢谢大家!

从txt文件中这样尝试:

(Get-Content "FILEPATH.txt") | Foreach {
  Enable-RemoteMailbox -Identity $_ -RemoteRoutingAddress($_+'@zim365.mail.onmicrosoft.com')
  sleep 30
  Get-RemoteMailbox $_ | Set-RemoteMailbox -EmailAddressPolicyEnabled:$true
}
对于这样的csv文件:

Username,
user1,
user2,...
做:


从txt文件中尝试以下操作:

(Get-Content "FILEPATH.txt") | Foreach {
  Enable-RemoteMailbox -Identity $_ -RemoteRoutingAddress($_+'@zim365.mail.onmicrosoft.com')
  sleep 30
  Get-RemoteMailbox $_ | Set-RemoteMailbox -EmailAddressPolicyEnabled:$true
}
对于这样的csv文件:

Username,
user1,
user2,...
做:


完美的非常感谢你!完美的非常感谢你!