« Previous Next »

Not Answered Thread: Remote Powershell Connection to Outlook Live from IIS7 Application Pool

Last post 10-26-2009 10:16 AM by Flaxxed1. 2 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (3 items)

Sort Posts:

  • 10-23-2009, 5:25 PM

    • Flaxxed1
    • Not Ranked
    • Joined on 10-23-2009, 9:17 PM
    • Posts 2

    Remote Powershell Connection to Outlook Live from IIS7 Application Pool

    I'm not quite sure if this is the right place for this question, but here goes.  I have an interesting situation, let me explain:

    I have some WCF services that I need to host in IIS7.  This .NET code is to help do administration of our email for students and employees at our university.  Students are on Outlook Live, employees are on Exchange 2007.  The code needs to establish a remote powershell session with Outlook Live to run some cmdlets as well as do powershell for Exchange 2007.  Due to what the code is doing, it needs to run with elevated privileges using a service account.  I have setup a new application pool and have it running under this service account.  I then have my WCF services running in this application pool.

    What I am finding is that when I call a service method that needs to remote powershell to Outlook Live, I am unable to establish a connection and the error that powershell gives me is "An internal error occurred."  The interesting this is that if I change the WCF services to run under the DefaultAppPool (Network Service user) it can open a remote powershell session with Outlook Live just fine.  I can also log into the server as the service account and use the integrated powershell environment to establish a remote powershell session with Outlook Live and run cmdlets just fine.  It appears that it does not like running remote powershell from an Application Pool that is not running as "Network Service"  (DefaultAppPool).

    I have all of the versions of powershell, winRM, Exchange Management Tools, etc. installed.  I am not sure why running my services under "Network Service (DefaultAppPool)" allows the remote powershell and running under my service account does not. I really appreciate any help and thoughts.

  • 10-24-2009, 10:49 PM In reply to

    Re: Remote Powershell Connection to Outlook Live from IIS7 Application Pool

    I'm not quite following the entire architecture, but a couple thoughts.

    1) have you tried adding the service account to the local administrators group for troubleshooting.  What you are describing is permissions in the local security policy.

    What version of powershell are you using?  Is the powershell running locally on the web server where the WCF services are hosted.  Or is it using winRM to connect remotely?

    Steve Schofield
    Windows Server MVP - IIS
    http://weblogs.asp.net/steveschofield


    http://www.IISLogs.com
    Log archival solution
    Install, Configure, Forget
  • 10-26-2009, 10:16 AM In reply to

    • Flaxxed1
    • Not Ranked
    • Joined on 10-23-2009, 9:17 PM
    • Posts 2

    Re: Remote Powershell Connection to Outlook Live from IIS7 Application Pool

     Thanks for your reply Steve, I really appreciate it.  Yes, I have tried adding the service account to the local administrators; I get the same error, it doesn't do anything. 

    I am running powershell 2.0 (required by the exchange 2007 management tools).  I also have WinRM 2.0 CTP3 installed to facilitate doing remote powershell on Outlook Live's servers.  This is the powershell code I am running to actually connect to Outlook Live.

    $Livecred = New-Object System.Management.Automation.PSCredential $Username, $Password
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
    Import-PSSession $Session

    Thanks for your help.

Page 1 of 1 (3 items)
Microsoft Communities