OK, only have access to two windows platforms, Windows 10 on her ladyship's pc and an arcane Vista on a discarded laptop of mine. Honestly, I believe anyone using Vista has more problems than getting buggy software from me.
I have done something like this -
{$ifdef WINDOWS}
function TForm1.WeHavePowershell(const Version : char) : boolean;
var
Registry : TRegistry;
begin
Registry := TRegistry.Create;
try
Registry.RootKey := HKEY_LOCAL_MACHINE;
if Registry.OpenKeyReadOnly('\Software\Microsoft\PowerShell\' + Version ) then
exit(Registry.ReadInteger('Install') = 1)
else
exit(false);
finally
Registry.Free;
end;
end;
{$endif}
Windows 10 says it has both Powershell 1 and Powershell 3. I expect later versions of Windows will also claim to have 3. I have found that even Vista has Powershell but its version 1. I have not been able to obtain a list of functionality but it does seem that syntax has changed. My powershell download code fails but I don't think Vista is worth the effort really of working out why. So, in my case I will say -
if WeHavePowershell('3') then
DoSomething();
else TellUserBadLuck();
I guess if the later Powershell (ie Power Core ??) becomes widespread, I may need to set an option to it to emulate version 3, thats easy.
Thanks for your help folks.
(I'll change the title of this thread to reflect what it became and what I should have entitled it at the start.)
Davo