I have a question. How would I build a method (dataCapture()) to collect the data I output from a PowerShell command within my application, and then parse the data and decipher the comma delimitation so it can input the data using the Oledb into Excel under the correct row and columns? Below I have attached my method for my PowerShell application. Any help or ideas here will be greatly appreciated! I have already built the Excel OleDB, I need no help there.
public void runPS()
{
//Run query
PowerShell.Create().AddScript(diskInfo()).AddCommand("Out-String").Invoke<string>();
foreach (string str in PowerShell.Create().AddScript(diskInfo()).AddCommand("Out-String").Invoke<string>())
{
dataCapture(str);
}
}
public void dataCapture(string input)
{
//Do some code using the input
excelWrite(id, volId, idSpc, idTy)
}
private void excelWrite(string id, string volId, int idSpc, int idTy)
{
//Does the OleDb for excel
}
This is what I was looking for: http://msdn.microsoft.com/en-us/library/ms228388(v=vs.80).aspx