PowerShell Question


Doug4901

Member
Local time
10:32 AM
Posts
3
OS
Windows 11 Pro
Hi, I need to change the time that virus notifications are retained. For a number of reasons I want the virus notifications to be saved (temporarily) for at most 1 day.

With PowerShell (as admin) I thought that this command would do it.

>Set-MpPreference -QuarantinePurgeItemsAfterDelay 1

but no, I get this error:

Set-MpPreference : Operation failed with the following error: 0x%1!x!
At line:1 char:2
+ Set-MpPreference -QuarantinePurgeItemsAfterDelay 1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (MSFT_MpPreference:root\Microsoft\...FT_MpPreference) [Set-MpPreference],
CimException
+ FullyQualifiedErrorId : HRESULT 0xc0000142,Set-MpPreference

Can anyone help me with this change?

Version 23H2 (OS Build 22631.2792)
 

My Computer

System One

  • OS
    Windows 11 Pro
    Computer type
    PC/Desktop
    Manufacturer/Model
    Self assembled
    CPU
    i7-12700
    Memory
    16GB
    Graphics Card(s)
    nVidia 3060Ti
    Monitor(s) Displays
    2 X 34in
    Screen Resolution
    4K
    Hard Drives
    SSD plus HDD
    PSU
    850W
Hi, I need to change the time that virus notifications are retained. For a number of reasons I want the virus notifications to be saved (temporarily) for at most 1 day.

With PowerShell (as admin) I thought that this command would do it.

>Set-MpPreference -QuarantinePurgeItemsAfterDelay 1

but no, I get this error:

Set-MpPreference : Operation failed with the following error: 0x%1!x!
At line:1 char:2
+ Set-MpPreference -QuarantinePurgeItemsAfterDelay 1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (MSFT_MpPreference:root\Microsoft\...FT_MpPreference) [Set-MpPreference],
CimException
+ FullyQualifiedErrorId : HRESULT 0xc0000142,Set-MpPreference

Can anyone help me with this change?

Version 23H2 (OS Build 22631.2792)
The syntax is correct. The command works for me using PowerShell 7.4.
Are you sure Defender isn't running? That is the only thing I can think of.
 

My Computers

System One System Two

  • OS
    Win11 All /Debian/Arch
    Computer type
    Laptop
    Manufacturer/Model
    ASUSTeK COMPUTER INC. TUF Gaming FX705GM
    CPU
    2.20 gigahertz Intel i7-8750H Hyper-threaded 12 cores
    Motherboard
    ASUSTeK COMPUTER INC. FX705GM 1.0
    Memory
    24428 Megabytes
    Graphics Card(s)
    Intel(R) UHD Graphics 630 / NVIDIA GeForce GTX 1060
    Sound Card
    Intel(R) Display Audio / Realtek(R) Audio
    Monitor(s) Displays
    Integrated Monitor (17.3"vis)
    Screen Resolution
    FHD 1920X1080 16:9
    Hard Drives
    2 SSD SATA/NVM Express 1.3
    WDS500G2B0A-00SM50 500.1 GB
    WDCSDAPNUW-1002 256 GB
    PSU
    19V DC 6.32 A 120 W
    Cooling
    Dual Fans
    Mouse
    MS Bluetooth
    Internet Speed
    Fiber 1GB Cox -us & ADSL Bouygues -fr
    Browser
    Edge Canary- Firefox Nightly
    Antivirus
    Windows Defender
    Other Info
    VMs of Windows 11 stable/Beta/Dev/Canary
    VM of XeroLinux- Arch based & Debian 12
  • Operating System
    Windows 11 Insider Canary
    Computer type
    Laptop
    Manufacturer/Model
    ASUS X751BP
    CPU
    AMD Dual Core A6-9220
    Motherboard
    ASUS
    Memory
    8 GB
    Graphics card(s)
    AMD Radeon R5 M420
    Sound Card
    Realtek
    Monitor(s) Displays
    17.3
    Screen Resolution
    1600X900 16:9
    Hard Drives
    1TB 5400RPM
The syntax is correct. The command works for me using PowerShell 7.4.
Are you sure Defender isn't running? That is the only thing I can think of.
Hi OAT, I am a beginner with Powershell. Regarding the last part of your reply, all I have tried with Defender is to disable real time detection. Is this what you meant?
 

My Computer

System One

  • OS
    Windows 11 Pro
    Computer type
    PC/Desktop
    Manufacturer/Model
    Self assembled
    CPU
    i7-12700
    Memory
    16GB
    Graphics Card(s)
    nVidia 3060Ti
    Monitor(s) Displays
    2 X 34in
    Screen Resolution
    4K
    Hard Drives
    SSD plus HDD
    PSU
    850W

My Computer

System One

  • OS
    Windows 11 Pro
    Computer type
    PC/Desktop
    Manufacturer/Model
    Self assembled
    CPU
    i7-12700
    Memory
    16GB
    Graphics Card(s)
    nVidia 3060Ti
    Monitor(s) Displays
    2 X 34in
    Screen Resolution
    4K
    Hard Drives
    SSD plus HDD
    PSU
    850W
The syntax is correct. The command works for me using PowerShell 7.4.
Are you sure Defender isn't running? That is the only thing I can think of.
If you're not elevated, that's the exact error that's returned by PS.
 

My Computer

System One

  • OS
    Windows 7

Latest Support Threads

Back
Top Bottom