Set-AzureVMMicrosoftAntimalwareExtension
設定虛擬機器的 Microsoft Antimalware 擴充功能。
注意
本檔中參考的 Cmdlet 用於管理使用服務管理 API 的舊版 Azure 資源。 如需管理 Azure Resource Manager 資源的 Cmdlet,請參閱 Az PowerShell 模組 。
Syntax
Set-AzureVMMicrosoftAntimalwareExtension
[-AntimalwareConfigFile] <String>
[[-Version] <String>]
[[-Monitoring] <String>]
[[-StorageContext] <AzureStorageContext>]
-VM <IPersistentVM>
[-Profile <AzureSMProfile>]
[-InformationAction <ActionPreference>]
[-InformationVariable <String>]
[<CommonParameters>]
Set-AzureVMMicrosoftAntimalwareExtension
[-AntimalwareConfiguration] <String>
[[-Version] <String>]
[[-Monitoring] <String>]
[[-StorageContext] <AzureStorageContext>]
-VM <IPersistentVM>
[-Profile <AzureSMProfile>]
[-InformationAction <ActionPreference>]
[-InformationVariable <String>]
[<CommonParameters>]
Set-AzureVMMicrosoftAntimalwareExtension
[[-Version] <String>]
[-Disable]
-VM <IPersistentVM>
[-Profile <AzureSMProfile>]
[-InformationAction <ActionPreference>]
[-InformationVariable <String>]
[<CommonParameters>]
Set-AzureVMMicrosoftAntimalwareExtension
[-Uninstall]
-VM <IPersistentVM>
[-Profile <AzureSMProfile>]
[-InformationAction <ActionPreference>]
[-InformationVariable <String>]
[<CommonParameters>]
Set-AzureVMMicrosoftAntimalwareExtension
[-Monitoring] <String>
[[-StorageContext] <AzureStorageContext>]
[-NoConfig]
-VM <IPersistentVM>
[-Profile <AzureSMProfile>]
[-InformationAction <ActionPreference>]
[-InformationVariable <String>]
[<CommonParameters>]
Description
Set-AzureVMMicrosoftAntimalwareExtension Cmdlet 會設定虛擬機器的 Microsoft Antimalware 擴充功能。 您可以啟用、停用或卸載擴充功能。
範例
範例 1:使用組態檔啟用擴充功能
PS C:\> Get-AzureVM -ServiceName "ContosoService03" -Name "ContosoVM22" | Set-AzureVMMicrosoftAntimalwareExtension -AntimalwareConfigFile 'C:\configuration\contosoVM.json' | Update-AzureVM
此命令會使用組態檔來啟用 Microsoft Antimalware 擴充功能。 此命令會使用 Get-AzureVM Cmdlet 來取得指定的虛擬機器物件,然後使用管線運算子將物件傳遞至目前的 Cmdlet。
範例 2:啟用擴充功能並啟用監視
PS C:\> $StorageContext = New-AzureStorageContext -StorageAccountName "contosostoragemain" -StorageAccountKey (Get-AzureStorageKey -StorageAccountName "Contosostoragemain").PrimaryP
S C:\> Get-AzureVM -ServiceName "ContosoService03" -Name"ContosoVM22" | Set-AzureVMMicrosoftAntimalwareExtension -AntimalwareConfigFile 'C:\configuration\contosoVM.json" -Monitoring ON -StorageContext $StorageContext | Update-AzureVM
第一個命令會使用 New-AzureStorageCoNtext Cmdlet 建立 AzureStorageCoNtext 物件,然後將它儲存在 $StorageCoNtext 變數中。
範例 3:藉由指定組態物件來啟用擴充功能
PS C:\> $Config_String = [IO.File]::ReadAllText('C:\configuration\contosoVM.json')
PS C:\> Get-AzureVM -ServiceName "ContosoService03" -Name "ContosoVM22" | Set-AzureVMMicrosoftAntimalwareExtension -AntimalwareConfiguration $Config_String | Update-AzureVM
第一個命令會讀取 Microsoft Antimalware 擴充功能的 JSON 組態,然後將它儲存在 $config_string 變數中,以建立字串物件。
範例 4:停用擴充功能
PS C:\> Get-AzureVM -ServiceName "ContosoService03" -Name "ContosoVM22" | Set-AzureVMMicrosoftAntimalwareExtension -Disable | Update-AzureVM
此命令會停用延伸模組,而不移除它。 命令會使用 Get-AzureVM 來取得指定的虛擬機器物件,然後將物件傳遞至目前的 Cmdlet。
範例 5:移除延伸模組
PS C:\> Get-AzureVM -ServiceName "ContosoService03" -Name"ContosoVM22" | Set-AzureVMMicrosoftAntimalwareExtension -Uninstall | Update-AzureVM
此命令會從虛擬機器中移除 Microsoft Antimalware 擴充功能。 命令會使用 Get-AzureVM 來取得指定的虛擬機器物件,然後將物件傳遞至目前的 Cmdlet。
參數
-AntimalwareConfigFile
指定 Microsoft Antimalware 組態檔的絕對路徑。 如果您指定 AntimalwareConfiguration 參數,請勿指定此參數。 組態檔至少必須包含下列內容,才能啟用 Microsoft Antimalware 擴充功能:
{ "AntimalwareEnabled": true }
Type: | String |
Position: | 1 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-AntimalwareConfiguration
指定包含 Microsoft Antimalware 組態的字串物件。 這個物件不得$Null或空白。 如果您指定 AntimalwareConfigFile 參數,請勿指定此參數。 組態物件至少必須包含下列內容,才能啟用 Microsoft Antimalware 擴充功能:****{ 「AntimalwareEnabled」: true }
Microsoft Antimalware JSON 設定範例:
{ 「AntimalwareEnabled」: true, 「RealtimeProtectionEnabled」: true, 「ScheduledScanSettings」: { 「isEnabled」: true, 「day」: 1, 「time」: 120, 「scanType」: 「Full」 },
「Exclusions」: { 「Extensions」: 「.ext1;.ext2「, 」Paths「: 」c:\excluded-path-1;c:\excluded-path-2「, 」Processes「: 」excludedproc1.exe;excludedproc2.exe「 }
}
注意:AntimalwareEnabled 是必要參數。 值:true= 啟用。 false= 錯誤為 false 不是支援的值
RealtimeProtectionEnabled:true/false。 true = 啟用。 false = 停用。 預設值為 true
ScheduledScanSettings:
isEnabled=true/false day=0-8 (每日,1-星期日,2-Monday,....,7-Saturday,8-Disabled) time=0-1440 (以午夜後的分鐘為單位 - 60-1AM > , 120 - > 2AM, ... ) scanType=「Quick」 或 「Full」 (預設值為 Quick) 注意:如果 isEnabled=true 是唯一提供的設定,則會設定下列預設值:day=7 (星期六),time=120 (上午 2 AM),scanType=「Quick」 排除專案: 使用分號分隔符號來指定相同清單中的多個排除專案。
如果未指定排除專案,則系統上的現有排除專案會以空白覆寫。
Type: | String |
Position: | 1 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Disable
指出 Cmdlet 會停用 Microsoft Antimalware 擴充功能。 若要在相同的虛擬機器上重新啟用擴充功能,請執行 Set-AzureVMMicrosoftAntimalwareExtension 而不使用 Disable 參數。
Type: | SwitchParameter |
Position: | 2 |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-InformationAction
指定此 Cmdlet 如何回應資訊事件。
此參數可接受的值為:
- 繼續
- 忽略
- 詢問
- SilentlyContinue
- 停止
- 暫止
Type: | ActionPreference |
Aliases: | infa |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-InformationVariable
指定資訊變數。
Type: | String |
Aliases: | iv |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Monitoring
指定是否要收集 Microsoft Antimalware 事件。
此參數可接受的值為:
- 開啟。 收集 Microsoft Antimalware 事件至儲存體內容。
- 關閉。 請勿收集 Microsoft Antimalware 事件。
Type: | String |
Position: | 3 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-NoConfig
指出此 Cmdlet 指定 NoConfig 選項。
Type: | SwitchParameter |
Position: | 3 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Profile
指定此 Cmdlet 從中讀取的 Azure 設定檔。 如果您未指定設定檔,此 Cmdlet 會從本機預設設定檔讀取。
Type: | AzureSMProfile |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-StorageContext
指定 Microsoft Antimalware 監視的 Azure 儲存體內容。
Type: | AzureStorageContext |
Position: | 4 |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Uninstall
指出此 Cmdlet 會從虛擬機器卸載 Microsoft Antimalware 擴充功能。 如果已開啟監視,Cmdlet 也會移除 Microsoft Antimalware 事件的集合。
Type: | SwitchParameter |
Position: | 1 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Version
將擴充功能版本指定為字串。 注意:支援的版本是 1.5。 Microsoft 不支援舊版。
Type: | String |
Position: | 2 |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-VM
將虛擬機器指定為 IPersistentVM 物件。
Type: | IPersistentVM |
Aliases: | InputObject |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |