none
c# remote powershell without explicitelly applying user & password (rather connection with current credentials) RRS feed

  • Question

  • Dear all,

    I would like to know, how I can open a runspace to an Exchange Server 2013 WITHOUT explicitelly applying username and password (well - this works using basic authentication).

    Following scenario :

    - A (well patched) Win 7 Enterprise Client with Exchange 2013 Client Tools installed
    - Logged in as (the) domain admin
    - Using Exchange Management Shell I can administer Exchange WITHOUT entering username/password
    - Using C# I cannot :(

    Nothing helped (DefaultCredentials [even with Releasebuild], PSCredentials.Empty or null, tried All members of AuthenticationMechanism).

    I wonder how Powershell itself does the thing....
    There must be a way to connect with the current user credentials...

    I you know, how this can be done, then provide a short snippet - please.
    Please no links or something like "...try to use blablabla" - thanks :)

    The thing that I would like to do is :
    - configure a runspace for the exchange server (WITHOUT user/password)
    - create that runspace
    - create a pipeline with that
    - add a command/parameters
    - invoke
    - examine the results
    - clean up

    As I mentioned above - all things work well - except the thing with the "trusted connection".
    It works only, if I provide a username and a password in the PSCredential parameter....
    ...but it should work without it...

    Please provide a tested and running example :)

    Best regards
    dp.

    Monday, October 13, 2014 3:25 PM