mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Fix support for nanoserver due to lack of AMSI (#18882)
This commit is contained in:
committed by
Dongbo Wang
parent
f9dd349d72
commit
93fa32222e
@@ -1340,7 +1340,17 @@ namespace System.Management.Automation
|
||||
static AmsiUtils()
|
||||
{
|
||||
#if !UNIX
|
||||
s_amsiInitFailed = !CheckAmsiInit();
|
||||
try
|
||||
{
|
||||
s_amsiInitFailed = !CheckAmsiInit();
|
||||
}
|
||||
catch (DllNotFoundException)
|
||||
{
|
||||
PSEtwLog.LogAmsiUtilStateEvent("DllNotFoundException", $"{s_amsiContext}-{s_amsiSession}");
|
||||
s_amsiInitFailed = true;
|
||||
return;
|
||||
}
|
||||
|
||||
PSEtwLog.LogAmsiUtilStateEvent($"init-{s_amsiInitFailed}", $"{s_amsiContext}-{s_amsiSession}");
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user