Skip to content

Commit cb8d955

Browse files
committed
Add AzMaintenance and Defender scripts for VM maintenance and security configuration
1 parent 5c815e2 commit cb8d955

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

AzMaintenance.ps1

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Get-AzMaintenanceUpdate -ResourceGroupName '<>-rg' -ProviderName Microsoft.Compute -ResourceType virtualMachines -ResourceName azcrtdccra01
2+
<#
3+
MaintenanceScope : OSImage
4+
ImpactType : Restart
5+
Status : Pending
6+
ImpactDurationInSec : 3600
7+
ResourceId : /subscriptions/<>/resourcegroups/<>-rg/providers/Microsoft.Compute/virtualMachines/azcrtdccra01
8+
9+
10+
MaintenanceScope : Extension
11+
ImpactType : Restart
12+
Status : Pending
13+
ImpactDurationInSec : 3600
14+
ResourceId : /subscriptions/<>/resourcegroups/<>-rg/providers/Microsoft.Compute/virtualMachines/azcrtdccra01
15+
#>

Windows/Defender.ps1

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Set-MpPreference -DisableBehaviorMonitoring $false
2+
Set-MpPreference -ScanScheduleDay 1
3+
4+
Set-MpPreference -ScanScheduleTime 22:00:00
5+
6+
7+
#Gets Vm's in a resource group, enables real time protection and configures AV scanning for 5:00 AM on Sundays
8+
(Get-AzureRmVM -ResourceGroupName NLGSUSUTMRASRG2).Name|
9+
ForEach-Object {Invoke-Command -ComputerName $PSItem -ScriptBlock {Set-MpPreference -DisableBehaviorMonitoring $false -Verbose;Set-MpPreference -ScanScheduleDay 1 -Verbose;Set-MpPreference -ScanScheduleTime 05:00:00 -Verbose}
10+
}
11+
12+
13+
Invoke-Command -ComputerName NLGDVJAMVM1 -ScriptBlock {Get-MpPreference}
14+
15+
Get-WmiObject -Namespace "root\Microsoft\SecurityClient" AntimalwareHealthStatus
16+
17+
18+
mpcmdrun -getfiles #Gets all the defender related logs

0 commit comments

Comments
 (0)