Get ConnectionString of the Project Server by PowerShell RRS feed

  • Question

  • Hi everybody I have a question, it is possible to get the connection string of the project server database, by using C# class that is execute by using a Timer Job?

    Want I mean is, I have a Timer Job that executes a C# class; this class is using the connection string of the project server database that gets some information. i have something that in Project Server 2010 works great, but when I trying to use the same thing in PS 2013 don't works, so I want to use another way to get the connection string.

    I hope that somebody helps me.

    .Net Developer and SharePoint programmer

    Tuesday, October 29, 2013 11:33 PM

All replies

  • What do you have in 2010? You could execute the following PowerShell command from C# Get-SPProjectWebInstance, that will give you the database name / database server.


    Paul Mather | Twitter | | CPS

    Wednesday, October 30, 2013 9:17 AM
  • Hi Paul, thanks for your answer, but it shows me the next error;

    "You need to have Machine administrator priviliges to run this cmdlet."

    private string RunScript(string scriptText)
                string addWss = "Add-PSSnapin microsoft.sharepoint.powershell";
                StringBuilder stringBuilder = new StringBuilder();
                IEnumerable<PSObject> results;
                using (var runspace = RunspaceFactory.CreateRunspace())
                    runspace.SessionStateProxy.SetVariable("prog", this);
                    using (var pipeline = runspace.CreatePipeline())
                        var outDefault = new Command("out-default");
                        outDefault.MergeMyResults(PipelineResultTypes.Error, PipelineResultTypes.Output);
                        results = pipeline.Invoke();
                foreach (PSObject obj in results)
                return stringBuilder.ToString();

    I attach the code that I'm using.


    .Net Developer and SharePoint programmer

    Wednesday, October 30, 2013 9:10 PM