Skip to content

Commit 7373522

Browse files
committed
Fixed DefenderDefaultAV wasn't defined
1 parent 0ae7e19 commit 7373522

File tree

7 files changed

+14
-0
lines changed

7 files changed

+14
-0
lines changed

src/Sophia_Script_for_Windows_10/Module/Sophia.psm1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
526526
# Check Windows default antivirus
527527
try
528528
{
529+
$Script:DefenderDefaultAV = $false
530+
529531
$productState = (Get-CimInstance -ClassName AntiVirusProduct -Namespace root/SecurityCenter2 | Where-Object -FilterScript {$_.instanceGuid -eq "{D68DDC3A-831F-4fae-9E44-DA132C1ACF46}"}).productState
530532
$DefenderState = ('0x{0:x}' -f $productState).Substring(3, 2)
531533
# Defender is a currently used AV. Continue...

src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
498498
# Check Windows default antivirus
499499
try
500500
{
501+
$Script:DefenderDefaultAV = $false
502+
501503
$productState = (Get-CimInstance -ClassName AntiVirusProduct -Namespace root/SecurityCenter2 | Where-Object -FilterScript {$_.instanceGuid -eq "{D68DDC3A-831F-4fae-9E44-DA132C1ACF46}"}).productState
502504
$DefenderState = ('0x{0:x}' -f $productState).Substring(3, 2)
503505
# Defender is a currently used AV. Continue...

src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
498498
# Check Windows default antivirus
499499
try
500500
{
501+
$Script:DefenderDefaultAV = $false
502+
501503
$productState = (Get-CimInstance -ClassName AntiVirusProduct -Namespace root/SecurityCenter2 | Where-Object -FilterScript {$_.instanceGuid -eq "{D68DDC3A-831F-4fae-9E44-DA132C1ACF46}"}).productState
502504
$DefenderState = ('0x{0:x}' -f $productState).Substring(3, 2)
503505
# Defender is a currently used AV. Continue...

src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
553553
# Check Windows default antivirus
554554
try
555555
{
556+
$Script:DefenderDefaultAV = $false
557+
556558
$productState = (Get-CimInstance -ClassName AntiVirusProduct -Namespace root/SecurityCenter2 | Where-Object -FilterScript {$_.instanceGuid -eq "{D68DDC3A-831F-4fae-9E44-DA132C1ACF46}"}).productState
557559
$DefenderState = ('0x{0:x}' -f $productState).Substring(3, 2)
558560
# Defender is a currently used AV. Continue...

src/Sophia_Script_for_Windows_11/Module/Sophia.psm1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
513513
# Check Windows default antivirus
514514
try
515515
{
516+
$Script:DefenderDefaultAV = $false
517+
516518
$productState = (Get-CimInstance -ClassName AntiVirusProduct -Namespace root/SecurityCenter2 | Where-Object -FilterScript {$_.instanceGuid -eq "{D68DDC3A-831F-4fae-9E44-DA132C1ACF46}"}).productState
517519
$DefenderState = ('0x{0:x}' -f $productState).Substring(3, 2)
518520
# Defender is a currently used AV. Continue...

src/Sophia_Script_for_Windows_11_LTSC_2024/Module/Sophia.psm1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
499499
# Check Windows default antivirus
500500
try
501501
{
502+
$Script:DefenderDefaultAV = $false
503+
502504
$productState = (Get-CimInstance -ClassName AntiVirusProduct -Namespace root/SecurityCenter2 | Where-Object -FilterScript {$_.instanceGuid -eq "{D68DDC3A-831F-4fae-9E44-DA132C1ACF46}"}).productState
503505
$DefenderState = ('0x{0:x}' -f $productState).Substring(3, 2)
504506
# Defender is a currently used AV. Continue...

src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
540540
# Check Windows default antivirus
541541
try
542542
{
543+
$Script:DefenderDefaultAV = $false
544+
543545
$productState = (Get-CimInstance -ClassName AntiVirusProduct -Namespace root/SecurityCenter2 | Where-Object -FilterScript {$_.instanceGuid -eq "{D68DDC3A-831F-4fae-9E44-DA132C1ACF46}"}).productState
544546
$DefenderState = ('0x{0:x}' -f $productState).Substring(3, 2)
545547
# Defender is a currently used AV. Continue...

0 commit comments

Comments
 (0)