#RequireAdmin #include #include Msgbox(0,"",_Enable_Disable_RTP_Windows_Defender(True)) ;************************************************************************************************************************* Func _Enable_Disable_RTP_Windows_Defender($Activate_Func = True) ;************************************************************************************************************************* if $Activate_Func=True Then Return _Exec_PowerShell_Command("Set-MpPreference -DisableRealtimeMonitoring 0") Else Return _Exec_PowerShell_Command("Set-MpPreference -DisableRealtimeMonitoring 1") EndIf EndFunc ;********************************************************************************************************************************************************************************************************************************************************************* Func _Exec_PowerShell_Command($PS_Command_Func) ;********************************************************************************************************************************************************************************************************************************************************************* $Path_File_Script_Powershell = _Write_Powershell_File($PS_Command_Func) if $Path_File_Script_Powershell <> "" Then $retval = RunWait('powershell.exe -executionpolicy remotesigned -File ' & '"' & $Path_File_Script_Powershell & '"',"",@SW_HIDE) FileDelete($Path_File_Script_Powershell) Return $retval Else Return -1 EndIf EndFunc ;*********************************************************************************************************************************** Func _Write_Powershell_File($PS_Command_Func) ;*********************************************************************************************************************************** $Path_File_Script_Powershell_Func = _TempFile(@TempDir,"tmp",".ps1") Local $file = FileOpen($Path_File_Script_Powershell_Func, 1) FileWrite($file,$PS_Command_Func & @CRLF) FileClose($file) if FileExists($Path_File_Script_Powershell_Func) Then return $Path_File_Script_Powershell_Func Else return "" EndIf EndFunc