zoukankan      html  css  js  c++  java
  • 导入远程计算机上的AD模块、Exchange功能命令在本地计算机执行

    $RemoteServerDC = "dc01"
    $RemoteUserName = "xxssuser"
    $RemotePassword = 'password'
    $RemotePassword_sec = ConvertTo-SecureString $RemotePassword -AsPlainText –Force
    $cred = New-Object System.Management.Automation.PSCredential($RemoteUserName,$RemotePassword_sec)
    
    #导入AD模块
    $SessionDC = New-PSSession -Computername $RemoteServerDC -Credential $cred
    Import-PSSession $SessionDC -AllowClobber -Module activedirectory
    
    #导入Exchange模块
    $SessionMail = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://$RemoteServerMail/PowerShell/  -Credential $cred -AllowRedirection 
    Import-PSSession $SessionMail -AllowClobber

    #在本地计算机上可直接运行AD、Ex命令
    Get-Aduser zhangsan
    Get-User | Enable-Mailbox -database $db01
  • 相关阅读:
    16
    15
    14
    13
    12
    11
    10
    python包管理器修改镜像地址
    Linux环境下安装hadoop分布式集群+问题总结
    解剖css中的clear属性
  • 原文地址:https://www.cnblogs.com/dreamer-fish/p/14812103.html
Copyright © 2011-2022 走看看