千家信息网

利用Powershell 脚本和定时任务自动批量开邮箱

发表于:2025-02-05 作者:千家信息网编辑
千家信息网最后更新 2025年02月05日,首先确保powershell 执行策略PS C:\Users\administrator.51TALK> Set-ExecutionPolicy -ExecutionPolicy RemoteSign
千家信息网最后更新 2025年02月05日利用Powershell 脚本和定时任务自动批量开邮箱
  1. 首先确保powershell 执行策略
PS C:\Users\administrator.51TALK> Set-ExecutionPolicy -ExecutionPolicy RemoteSignedPS C:\Users\administrator.51TALK> Get-ExecutionPolicyRemoteSigned
  1. 写PS脚本
    Add-PSSnapin microsoft.exchange*Import-Module activedirectory  $dbs= @("bjstaff01","bjoffice","bjstaff02","bjstaff03")$users= Get-User -OrganizationalUnit "北京"  -RecipientTypeDetails user  foreach($i in $users){$db= get-random -InputObject $dbsEnable-Mailbox -Identity $i -Database $db}
3. 创建任务计划![](https://cache.yisu.com/upload/information/20200311/29/175091.jpg?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
0