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

C#

 
QuestionRe: please help me solve a nested dictionary structure problem!!! (here is a sample code where am i doing wrong) Pin
Richard MacCutchan9-Dec-14 22:15
mveRichard MacCutchan9-Dec-14 22:15 
AnswerSolved :please help me solve a nested dictionary structure problem!!! (here is a sample code where am i doing wrong) Pin
gaurigan10-Dec-14 13:56
gaurigan10-Dec-14 13:56 
Questionproblem finding control and getting its values for dynamically created textboxes Pin
Dhyanga9-Dec-14 5:34
Dhyanga9-Dec-14 5:34 
SuggestionRe: problem finding control and getting its values for dynamically created textboxes Pin
Richard Deeming9-Dec-14 6:34
mveRichard Deeming9-Dec-14 6:34 
Questiontrouble to allocate/read buffer modified by native function Pin
Member 111038219-Dec-14 0:20
Member 111038219-Dec-14 0:20 
AnswerRe: trouble to allocate/read buffer modified by native function Pin
Richard MacCutchan9-Dec-14 6:08
mveRichard MacCutchan9-Dec-14 6:08 
QuestionTime out Expires while generating report. Pin
Pushpak Shah8-Dec-14 20:44
professionalPushpak Shah8-Dec-14 20:44 
QuestionRemote powershell / WinRM to Server 2012 Pin
JD868-Dec-14 18:49
JD868-Dec-14 18:49 
I've hit a road block and can't figure out why I am getting this response back. It appears that it connects to the server but it returns:

"System.Management.Automation.Remoting.PSRemotingTransportException: Connecting to remote server server2.domain.local failed with the following error message: An invalid argument was supplied".

I enabled everything I thought on the remote computer:
winrm set winrm/config/service/auth @{Basic="true"}
winrm set winrm/config/service @{AllowUnencrypted="true"}
winrm set winrm/config/client @{TrustedHosts="*"}


I'm trying to remote powershell so I can run Citrix powershell commands from another computer and here is what I have:

C#
try
            {
                XenDesktop7 xd = new XenDesktop7("http://server2.domain.local:5985/wsman", @"DOMAIN\Administrator", "#######");
                string[] blah = xd.GetCatalogs();

                foreach (var b in blah)
                {
                    Console.WriteLine(b);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }


C#
public CitrixPowershell(string uri, string username, string password)
        {
            this._connection = GetConnection(uri, username, password);
            PSSnapInException snapinException;
            _runspace = RunspaceFactory.CreateRunspace(_connection);
            _runspace.Open();

            _runspace.RunspaceConfiguration.AddPSSnapIn("Citrix.*.Admin.V*", out snapinException);

            _powershell = PowerShell.Create();
            _powershell.Runspace = _runspace;
            
        }

        private WSManConnectionInfo GetConnection(string uri, string username, string password)
        {
            SecureString pwd = new SecureString();
            foreach (char x in password)
                pwd.AppendChar(x);

            PSCredential ps = new PSCredential(username, pwd);

            WSManConnectionInfo wsinfo = new WSManConnectionInfo(false, "server2.domain.local", 5985, "/wsman", "http://schemas.microsoft.com/powershell/Microsoft.PowerShell", ps);
            wsinfo.AuthenticationMechanism = AuthenticationMechanism.Basic;
            wsinfo.ProxyAuthentication = AuthenticationMechanism.Negotiate;
            return wsinfo;
        }

SuggestionRe: Remote powershell / WinRM to Server 2012 Pin
Richard MacCutchan8-Dec-14 22:07
mveRichard MacCutchan8-Dec-14 22:07 
GeneralRe: Remote powershell / WinRM to Server 2012 Pin
JD869-Dec-14 3:19
JD869-Dec-14 3:19 
GeneralRe: Remote powershell / WinRM to Server 2012 Pin
Richard MacCutchan9-Dec-14 5:49
mveRichard MacCutchan9-Dec-14 5:49 
GeneralRe: Remote powershell / WinRM to Server 2012 Pin
JD8610-Dec-14 5:09
JD8610-Dec-14 5:09 
QuestionCreate a nested TreeView for Windows 8.1 app Pin
Bhola S. Parit8-Dec-14 18:20
Bhola S. Parit8-Dec-14 18:20 
AnswerRe: Create a nested TreeView for Windows 8.1 app Pin
BillWoodruff8-Dec-14 21:26
professionalBillWoodruff8-Dec-14 21:26 
Questionrtl gridview Pin
alireza.zahani8-Dec-14 3:36
alireza.zahani8-Dec-14 3:36 
AnswerRe: rtl gridview Pin
alireza.zahani8-Dec-14 3:46
alireza.zahani8-Dec-14 3:46 
GeneralRe: rtl gridview Pin
Blue_Boy8-Dec-14 5:26
Blue_Boy8-Dec-14 5:26 
AnswerRe: rtl gridview Pin
Eddy Vluggen8-Dec-14 8:05
professionalEddy Vluggen8-Dec-14 8:05 
Questionconvert NTP to UTC datetime Pin
Jassim Rahma8-Dec-14 1:31
Jassim Rahma8-Dec-14 1:31 
AnswerRe: convert NTP to UTC datetime Pin
Richard MacCutchan8-Dec-14 1:33
mveRichard MacCutchan8-Dec-14 1:33 
AnswerRe: convert NTP to UTC datetime Pin
BillWoodruff8-Dec-14 1:55
professionalBillWoodruff8-Dec-14 1:55 
QuestionDatagridview with tabcontrol in windows application Pin
Rahulmishra0117-Dec-14 19:07
Rahulmishra0117-Dec-14 19:07 
AnswerRe: Datagridview with tabcontrol in windows application Pin
syed shanu7-Dec-14 21:07
professionalsyed shanu7-Dec-14 21:07 
Questionnavigation page control, library extention for c# winforms Pin
KasGuest7-Dec-14 18:00
KasGuest7-Dec-14 18:00 
QuestionRe: navigation page control, library extention for c# winforms Pin
Richard MacCutchan7-Dec-14 22:56
mveRichard MacCutchan7-Dec-14 22:56 

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.