diff --git a/contrib/win32/openssh/OpenSSHUtils.psm1 b/contrib/win32/openssh/OpenSSHUtils.psm1 index c7cbdf8e8..e70afd0d7 100644 --- a/contrib/win32/openssh/OpenSSHUtils.psm1 +++ b/contrib/win32/openssh/OpenSSHUtils.psm1 @@ -95,7 +95,15 @@ public class AdjPriv } '@ -$type = Add-Type $definition -PassThru -ErrorAction SilentlyContinue +try +{ + $type = Add-Type $definition -PassThru -ErrorAction SilentlyContinue +} +catch +{ + # Powershell 7 does not add a type if it already exists + $type = [AdjPriv] +} <# .Synopsis