header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
Works in VB.NET 2008 but not in IIS6 or IIS 7
Last Post 02 Jun 2010 11:02 AM by RenHoek. 0 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
RenHoekUser is Offline
New Member
New Member
Posts:1
Avatar

--
02 Jun 2010 11:02 AM

    The code below runs greate in VB.Net 2008 (.Net 2.0) but when I execute it in IIS6 or IIS7 it doesn't return any data. For some reason it doesn't enter the 'next' loop. The interesting thing is that if I substitute "get-mailboxstatistics" with "get-mailbox" that works in both the compiler and in IIS7&6.

    any ideas?

    -------------

    Sub GetMailboxData()

    Dim exReturn As String = Nothing

    Dim rsConfig As RunspaceConfiguration = RunspaceConfiguration.Create()

    Dim snapInException As PSSnapInException = Nothing

    Dim info As PSSnapInInfo = rsConfig.AddPSSnapIn("Microsoft.Exchange.Management.PowerShell.Admin", snapInException)

    Dim myRunSpace As Runspace = RunspaceFactory.CreateRunspace(rsConfig)

    myRunSpace.Open()

    Dim ri As New RunspaceInvoke(myRunSpace)

    Dim errors As IList

    Dim commandResults As ICollection(Of PSObject)

    commandResults = ri.Invoke("get-mailboxstatistics -server exch01", Nothing, errors)

    Dim ResultString As New StringBuilder

    For Each cmdlet As PSObject In commandResults

    exReturn = cmdlet.Properties("DisplayName").Value

    exReturn = exReturn & " " & cmdlet.Properties("ServerName").Value

    ResultString.Append(exReturn & vbNewLine)

    Next

    TextBox1.Text = (ResultString.ToString)

    End Sub

    --------------

    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer