diff --git a/ocaml/sdk-gen/powershell/autogen/src/Connect-XenServer.cs b/ocaml/sdk-gen/powershell/autogen/src/Connect-XenServer.cs
index c1155f7a2a3..f300801f5ef 100644
--- a/ocaml/sdk-gen/powershell/autogen/src/Connect-XenServer.cs
+++ b/ocaml/sdk-gen/powershell/autogen/src/Connect-XenServer.cs
@@ -207,7 +207,10 @@ protected override void ProcessRecord()
}
catch (WebException e)
{
- if (e.InnerException?.InnerException is CertificateValidationException ex)
+ var inner = e.InnerException?.InnerException ?? //.NET case
+ e.InnerException; //.NET Framework case
+
+ if (inner is CertificateValidationException ex)
{
if (ShouldContinue(ex.Message, ex.Caption))
{
diff --git a/ocaml/sdk-gen/powershell/autogen/src/Properties/launchSettings.json b/ocaml/sdk-gen/powershell/autogen/src/Properties/launchSettings.json
new file mode 100644
index 00000000000..0747377a722
--- /dev/null
+++ b/ocaml/sdk-gen/powershell/autogen/src/Properties/launchSettings.json
@@ -0,0 +1,16 @@
+{
+ "profiles": {
+ "PS-51": {
+ "commandName": "Executable",
+ "executablePath": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
+ "commandLineArgs": "-NoLogo -NoExit -Command \"Import-Module '.\\XenServerPowerShell.dll'\"",
+ "workingDirectory": "$(OutDir)"
+ },
+ "PS-7": {
+ "commandName": "Executable",
+ "executablePath": "C:\\Program Files\\PowerShell\\7\\pwsh.exe",
+ "commandLineArgs": "-NoLogo -NoExit -Command \"Import-Module '.\\XenServerPowerShell.dll'\"",
+ "workingDirectory": "$(OutDir)"
+ }
+ }
+}
\ No newline at end of file
diff --git a/ocaml/sdk-gen/powershell/autogen/src/XenServerPowerShell.csproj b/ocaml/sdk-gen/powershell/autogen/src/XenServerPowerShell.csproj
index 23fff01346e..1fb6483bd34 100644
--- a/ocaml/sdk-gen/powershell/autogen/src/XenServerPowerShell.csproj
+++ b/ocaml/sdk-gen/powershell/autogen/src/XenServerPowerShell.csproj
@@ -9,18 +9,6 @@
true
-
- True
- Program
- C:\Program Files\PowerShell\7\pwsh.exe
- -NoLogo -NoExit -Command "Import-Module '.\XenServerPowerShell.dll'"
-
-
- True
- Program
- C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
- -NoLogo -NoExit -Command "Import-Module '.\XenServerPowerShell.dll'"
-