I'm trying to execute this command inside a C# application (Lists Firefox extensions).
Get-ChildItem -Path $env:USERPROFILE"\AppData\Roaming\Mozilla\Firefox\Profiles\*\extensions.json" | Get-Content
From MSDN documentation I figured out the code should looks like something like
PowerShell ps = PowerShell.Create();
ps.AddCommand("Get-ChildItem");
ps.AddParameter("Path", "\"$env:USERPROFILE\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\*\\extensions.json\"");
ps.AddCommand("Get-Content");
Collection<PSObject> results = ps.Invoke();
however, the "results" is null (when the PS line is not). I have found some similar questions on SO, but nothing I could really use to answer this. Anybody knows how can I fix my code?