Click here to Skip to main content
15,892,809 members
Home / Discussions / C#
   

C#

 
GeneralRe: Is it possible to impelement Voice Recognition in C# Web Applicaion? Pin
Marco Bertschi6-Feb-14 23:08
protectorMarco Bertschi6-Feb-14 23:08 
GeneralRe: Is it possible to impelement Voice Recognition in C# Web Applicaion? Pin
Snehasish_Nandy6-Feb-14 23:10
professionalSnehasish_Nandy6-Feb-14 23:10 
GeneralRe: Is it possible to impelement Voice Recognition in C# Web Applicaion? Pin
Marco Bertschi6-Feb-14 23:11
protectorMarco Bertschi6-Feb-14 23:11 
AnswerRe: Is it possible to impelement Voice Recognition in C# Web Applicaion? Pin
Keith Barrow6-Feb-14 23:11
professionalKeith Barrow6-Feb-14 23:11 
GeneralRe: Is it possible to impelement Voice Recognition in C# Web Applicaion? Pin
Pete O'Hanlon6-Feb-14 23:37
mvePete O'Hanlon6-Feb-14 23:37 
GeneralRe: Is it possible to impelement Voice Recognition in C# Web Applicaion? Pin
Keith Barrow7-Feb-14 0:03
professionalKeith Barrow7-Feb-14 0:03 
Questionusb dongle software for c# Pin
Member 99539286-Feb-14 22:19
Member 99539286-Feb-14 22:19 
AnswerRe: usb dongle software for c# Pin
Marco Bertschi6-Feb-14 22:58
protectorMarco Bertschi6-Feb-14 22:58 
QuestionViewing the data enterd in the SQL Server Database for a specifed Time frame. Pin
Mohan Subramani6-Feb-14 22:15
Mohan Subramani6-Feb-14 22:15 
AnswerRe: Viewing the data enterd in the SQL Server Database for a specifed Time frame. Pin
OriginalGriff6-Feb-14 22:19
mveOriginalGriff6-Feb-14 22:19 
GeneralRe: Viewing the data enterd in the SQL Server Database for a specifed Time frame. Pin
Shameel6-Feb-14 23:43
professionalShameel6-Feb-14 23:43 
GeneralRe: Viewing the data enterd in the SQL Server Database for a specifed Time frame. Pin
OriginalGriff6-Feb-14 23:55
mveOriginalGriff6-Feb-14 23:55 
GeneralRe: Viewing the data enterd in the SQL Server Database for a specifed Time frame. Pin
Shameel7-Feb-14 0:07
professionalShameel7-Feb-14 0:07 
GeneralRe: Viewing the data enterd in the SQL Server Database for a specifed Time frame. Pin
Mohan Subramani7-Feb-14 2:32
Mohan Subramani7-Feb-14 2:32 
GeneralRe: Viewing the data enterd in the SQL Server Database for a specifed Time frame. Pin
OriginalGriff7-Feb-14 2:42
mveOriginalGriff7-Feb-14 2:42 
GeneralRe: Viewing the data enterd in the SQL Server Database for a specifed Time frame. Pin
Mohan Subramani7-Feb-14 2:58
Mohan Subramani7-Feb-14 2:58 
GeneralRe: Viewing the data enterd in the SQL Server Database for a specifed Time frame. Pin
OriginalGriff7-Feb-14 3:23
mveOriginalGriff7-Feb-14 3:23 
AnswerRe: Viewing the data enterd in the SQL Server Database for a specifed Time frame. Pin
KeyStrokes7-Feb-14 2:21
KeyStrokes7-Feb-14 2:21 
QuestionHow to run Import-PSSessions (powershell command) from .C# program Pin
Eviatar Gerzi6-Feb-14 7:51
Eviatar Gerzi6-Feb-14 7:51 
I am trying to write code in C# that get mailbox details from user via Power Shell command.

The power shell command script is:
C#
Import-PSSession -session (New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://myServer.myDomain.com/Powershell)
Get-Mailbox -Identity helpdesk


The script runs OK from PowerShell.

Now my goal is to run it using C#.

This is my function:
C#
private void button1_Click(object sender, EventArgs e)  
{
    m_RunSpace = RunspaceFactory.CreateRunspace();

    m_RunSpace.Open();

    Pipeline pipeLine = m_RunSpace.CreatePipeline();

    Command newSession = new Command("New-PSSession");
    newSession.Parameters.Add("-ConfigurationName", "Microsoft.Exchange");
    newSession.Parameters.Add("-ConnectionUri", "http://myServer.myDomain.com/Powershell");

    Command createSessionForExch = new Command("Import-PSSession");
    createSessionForExch.Parameters.Add("-Session", newSession);

    Command getMailbox = new Command("Get-Mailbox");
    getMailbox.Parameters.Add("-Identity", "helpdesk");

    pipeLine.Commands.Add(createSessionForExch);
    pipeLine.Commands.Add(getMailbox);

    Collection<PSObject> commandResults = pipeLine.Invoke();

    foreach (PSObject cmdlet in commandResults)
    {


    }
}



But I receive an error that the "Get-Mailbox" command is not recognize:
http://imageshack.com/a/img593/664/x52q.png

Probably because the Import-PSSessions wasn't invok correctly.

I need help how to run the command Import-PSSession correctly from C#
AnswerRe: How to run Import-PSSessions (powershell command) from .C# program Pin
Eviatar Gerzi11-Feb-14 8:44
Eviatar Gerzi11-Feb-14 8:44 
QuestionRegEx problem #2 [solved] Pin
Marco Bertschi6-Feb-14 2:32
protectorMarco Bertschi6-Feb-14 2:32 
AnswerRe: RegEx problem #2 Pin
OriginalGriff6-Feb-14 2:54
mveOriginalGriff6-Feb-14 2:54 
GeneralRe: RegEx problem #2 Pin
Marco Bertschi6-Feb-14 3:00
protectorMarco Bertschi6-Feb-14 3:00 
GeneralRe: RegEx problem #2 Pin
OriginalGriff6-Feb-14 3:11
mveOriginalGriff6-Feb-14 3:11 
GeneralRe: RegEx problem #2 Pin
Marco Bertschi6-Feb-14 3:13
protectorMarco Bertschi6-Feb-14 3:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.