I have a Powershell script which I have invoked from a C# method. While doing it locally, I get a prompt where I have to select Yes or No and I select YES and things work as expected. But when pushed to server, it fails, I would like to know how can I select default as YES in my code so that the same goes in server and I don't have to worry about. here is my C# method and powershell script which is invoked after which i get a prompt.
public void CreateDatabaseFromPowerShell()
{
string path = Path.Combine( Root, @"TestData\CosmosScript.ps1" );
Runspace runspace = RunspaceFactory.CreateRunspace();
runspace.Open();
Pipeline pipeline = runspace.CreatePipeline();
pipeline.Commands.AddScript( path );
Collection<PSObject> results = pipeline.Invoke();
runspace.Close();
}
----Import-Module "$env:ProgramFiles\Azure Cosmos DB Emulator\PSModules\Microsoft.Azure.CosmosDB.Emulator"
----Start-CosmosDbEmulator