@@ -28,8 +28,6 @@ Only web credentials can be displayed in cleartext.
2828 [CmdletBinding ()] Param ()
2929
3030 $OSVersion = [Environment ]::OSVersion.Version
31- $OSMajor = $OSVersion.Major
32- $OSMinor = $OSVersion.Minor
3331
3432 # region P/Invoke declarations for vaultcli.dll
3533 $DynAssembly = New-Object System.Reflection.AssemblyName(' VaultUtil' )
@@ -79,7 +77,7 @@ Only web credentials can be displayed in cleartext.
7977 $null = $TypeBuilder.DefineField (' pResourceElement' , [IntPtr ], ' Public' )
8078 $null = $TypeBuilder.DefineField (' pIdentityElement' , [IntPtr ], ' Public' )
8179 $null = $TypeBuilder.DefineField (' pAuthenticatorElement' , [IntPtr ], ' Public' )
82- if ($OSMajor -ge 6 -and $OSMinor -ge 2 )
80+ if ($OSVersion -ge ' 6.2 ' )
8381 {
8482 $null = $TypeBuilder.DefineField (' pPackageSid' , [IntPtr ], ' Public' )
8583 }
@@ -149,7 +147,7 @@ Only web credentials can be displayed in cleartext.
149147 [Runtime.InteropServices.CallingConvention ]::Winapi,
150148 [Runtime.InteropServices.CharSet ]::Auto)
151149
152- if ($OSMajor -ge 6 -and $OSMinor -ge 2 )
150+ if ($OSVersion -ge ' 6.2 ' )
153151 {
154152 $PInvokeMethod = $TypeBuilder.DefinePInvokeMethod (' VaultGetItem' ,
155153 ' vaultcli.dll' ,
@@ -317,7 +315,7 @@ Only web credentials can be displayed in cleartext.
317315
318316 $PasswordVaultItem = [IntPtr ]::Zero
319317
320- if ($OSMajor -ge 6 -and $OSMinor -ge 2 )
318+ if ($OSVersion -ge ' 6.2 ' )
321319 {
322320 $Result = $Vaultcli ::VaultGetItem($VaultHandle ,
323321 [Ref ] $CurrentItem.SchemaId ,
0 commit comments