wcf - Pass Windows credential as PSCredential in Powershell script using C# -


i have wcf service executes remote powershell scripts , returns results client. when wcf hosted on iis following error @ invoke line.

using (var powershell = powershell.create())             {                 var command = new pscommand();                 command.addcommand("new-pssession");                 command.addparameter("configurationname", "microsoft.exchange");                 command.addparameter("connectionuri", connectto);                 command.addparameter("authentication", "kerberos");                  powershell.commands = command;                 powershell.runspace = runspace;                  var result = powershell.invoke();//error                 pssessionconnection = result[0];             } 

processing data remote server #exchangeservername# failed following error message: [authzrequestid=ac0dedbe-a345-4eac-bb8d-cd5b8eab327c][failurecategory=authz-cmdletaccessdeniedexception] user #machinename# isn't assigned management roles.

how can make line

command.addparameter("authentication", "kerberos");

pass user credentials?


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo