I write program on c#. I need set trigger, that check: if installed Azure PowerShell or not. So how it write? If exist unique path for Azure PowerShell? Or better see on register?
Asked
Active
Viewed 444 times
1
-
are you looking this? http://stackoverflow.com/questions/1825585/how-to-determine-what-version-of-powershell-is-installed – StackTrace Jan 21 '14 at 09:31
2 Answers
0
One way to check the installation status/version of Azure Powershell is to type this cmdlet in your PowerShell session.
Get-module azure
If you mean to check it programmatically from code, I believe registry is the right way.

Chungang
- 1
0
Hello. You can try to do like this, maybe it help you:
try
{
var pipe = PowerShell.Create().AddScript("Get-Module -ListAvailable" +
" | Where-Object{ $_.Name -like 'Azure*' }" +
"|Select Version, Name, Author, PowerShellVersion").AddCommand("out-string");
Collection<PSObject> results = pipe.Invoke();
foreach (var result in results)
{
Console.WriteLine(result);
Console.ReadKey();
}
}
catch (Exception Ex)
{
Console.WriteLine(Ex.ToString());
Console.ReadKey();
}

Vitaly
- 75
- 4