如何:使用Exchange命令行管理程序获取邮件用户列表 [英] How to: Get a list of mail users by using the Exchange Management Shell

查看:225
本文介绍了如何:使用Exchange命令行管理程序获取邮件用户列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,快速提问:当我在VB下面运行以下代码时,我怎样才能看到该程序的结果?无论如何我可以将结果显示在消息框中吗?


功能 GetUsersUsingBasicAuth(_

    ByVal LiveIDConnectionUri
As
String ByVal ScehmaUri
作为 字符串,_

    ByVal 凭据
As
PSCredential, ByVal
计数
As 整数
作为集合(Of PSObject)



    Dim ConnectionInfo
As
WSManConnectionInfo = _

         WSManConnectionInfo( New Uri(LiveIDConnectionUri),ScehmaUri,Credentials)

  ;   ConnectionInfo.AuthenticationMechanism = AuthenticationMechanism.Basic



    Dim RemoteRunspace
As
Runspace

    RemoteRunspace = RunspaceFactory.CreateRunspace(ConnectionInfo)



    返回 GetUserInformation( Count ,RemoteRunspace)



  结束 功能


功能 GetUserInformation( ByVal
计数 As
整数
ByVal RemoteRunspace
As
Runspace) As 集合(Of PSObject)



    Dim RemotePowerShell
As
PowerShell = PowerShell.Create

     RemotePowerShell.AddCommand(" Get-Users"

    RemotePowerShell.AddParameter(" ResultSize"
计数



    '打开服务器上的远程运行空间。

    RemoteRunspace.Open()



    '将运行空间与Exchange命令行管理程序关联。

    RemotePowerShell.Runspace = RemoteRunspace



    '调用Exchange命令行管理程序以运行命令。

    返回 RemotePowerShell.Invoke



结束 < span style ="color:blue">功能


解决方案

建议您在Exchange开发论坛中发布此内容以获得程序员更快的回复......


http://social.technet.microsoft.com/Forums/exchange/en-美/家?论坛= exchangesvrdevelopment


Hello every one, quick question: When I run this code below for VB, how will I see the results of the program? Is there anyway I can make the results appear in a message box?

Function GetUsersUsingBasicAuth( _
    ByVal LiveIDConnectionUri As String, ByVal ScehmaUri As String, _
    ByVal Credentials As PSCredential, ByVal Count As Integer) As Collection(Of PSObject)

    Dim ConnectionInfo As WSManConnectionInfo = _
        New WSManConnectionInfo(New Uri(LiveIDConnectionUri), ScehmaUri, Credentials)
    ConnectionInfo.AuthenticationMechanism = AuthenticationMechanism.Basic

    Dim RemoteRunspace As Runspace
    RemoteRunspace = RunspaceFactory.CreateRunspace(ConnectionInfo)

    Return GetUserInformation(Count, RemoteRunspace)

  End Function

Function GetUserInformation(ByVal Count As Integer, ByVal RemoteRunspace As Runspace) As Collection(Of PSObject)

    Dim RemotePowerShell As PowerShell = PowerShell.Create
    RemotePowerShell.AddCommand("Get-Users")
    RemotePowerShell.AddParameter("ResultSize", Count)

    ' Open the remote runspace on the server.
    RemoteRunspace.Open()

    ' Associate the runspace with the Exchange Management Shell.
    RemotePowerShell.Runspace = RemoteRunspace

    ' Invoke the Exchange Management Shell to run the command.
    Return RemotePowerShell.Invoke

End Function

解决方案

Suggest you to post this in Exchange Development forum to get faster responses from programmers...

http://social.technet.microsoft.com/Forums/exchange/en-US/home?forum=exchangesvrdevelopment


这篇关于如何:使用Exchange命令行管理程序获取邮件用户列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆