diff --git a/Powershell scripts/Machines Not Protected by Defender for SQL Extension/list-notProtectedMachinesDefenderforSQL.ps1 b/Powershell scripts/Machines Not Protected by Defender for SQL Extension/list-notProtectedMachinesDefenderforSQL.ps1 index 4463977dd..bd1ab30c9 100644 --- a/Powershell scripts/Machines Not Protected by Defender for SQL Extension/list-notProtectedMachinesDefenderforSQL.ps1 +++ b/Powershell scripts/Machines Not Protected by Defender for SQL Extension/list-notProtectedMachinesDefenderforSQL.ps1 @@ -1,4 +1,4 @@ -#Requires -Modules Az.Resources, Az.Accounts, Az.Compute, Az.ConnectedMachine, Az.SqlVirtualMachine +#Requires -Modules Az, Az.Resources, Az.Accounts, Az.Compute, Az.ConnectedMachine, Az.SqlVirtualMachine <# .SYNOPSIS @@ -55,7 +55,7 @@ foreach ($vm in $VMResources) { try { # Obtain the instance view of the SQL VM - $sqlVMInstanceView = Get-AzSqlVM -ResourceGroupName $vm.ResourceGroupName -Name $vm.Name -ErrorAction Stop + Get-AzSqlVM -ResourceGroupName $vm.ResourceGroupName -Name $vm.Name -ErrorAction Stop } catch { Write-Host "VM $($vm.Name) is missing SQL extension, skipping.." diff --git a/Powershell scripts/Machines Not Protected by Defender for SQL Extension/readme.md b/Powershell scripts/Machines Not Protected by Defender for SQL Extension/readme.md index 100000f40..c011b376a 100644 --- a/Powershell scripts/Machines Not Protected by Defender for SQL Extension/readme.md +++ b/Powershell scripts/Machines Not Protected by Defender for SQL Extension/readme.md @@ -10,8 +10,17 @@ Therefore, the script will exclude the following resources: - Linux machines - Deallocated or disconnected machines +## Prerequisites +* Install the following Powershell modules: + * Az + * Az.Resources + * Az.Accounts + * Az.Compute + * Az.ConnectedMachine + * Az.SqlVirtualMachine + ## Examples ```powershell -.\List-notProtectedMachinesDefenderforSQL.ps1 -SubscriptionId 'ada06e68-4678-4210-443a-c6cacebf41c5' +.\list-notProtectedMachinesDefenderforSQL.ps1 -SubscriptionId 'ada06e68-4678-4210-443a-c6cacebf41c5' ```