detect add-type edge case with powershell 7 (#554)
This commit is contained in:
parent
af7130c91b
commit
1fa768f365
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue