export and delete a registry KEY using sccm configuration items and baselines

PerserPolis-1732 1,971 Reputation points
2022-06-02T06:03:08.047+00:00

Hi,

I know how I can add a registry key using SCCM Configuration Items and Configuration Baselines. But how can I export registry key and than delete it with Configuration Items and Configuration Baselines?

Any Idea?

Regards

Microsoft Security Intune Configuration Manager Application
0 comments No comments
{count} votes

Accepted answer
  1. AllenLiu-MSFT 49,311 Reputation points Microsoft External Staff
    2022-06-06T07:25:03.437+00:00

    Hi, @PerserPolis-1732

    Here is an example to deleyte the regkey, I have tested in my lab and it works well.

    The discovery script:

    $RegKey = Test-Path 'HKLM:\SOFTWARE\Microsoft\Internet Explorer\aaa'    
    if ($RegKey –eq "true")  
    {Write-Host 'Compliant'}  
    else  
    {Write-Host 'Non-Compliant'}  
    

    The remediation script:

    Remove-Item -Path 'HKLM:\SOFTWARE\Microsoft\Internet Explorer\aaa'  
    

    Remember to set the rule as below:
    208490-1.png

    And also check the "remediation" during configuration baseline deployment:
    208600-2.png


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


7 additional answers

Sort by: Most helpful
  1. Jason Sandys 31,406 Reputation points Microsoft Employee Moderator
    2022-06-02T15:29:50.193+00:00

    Export it where? And why?

    Using a PowerShell-based CI, you can do pretty much anything.

    0 comments No comments

  2. PerserPolis-1732 1,971 Reputation points
    2022-06-03T05:18:20.1+00:00

    because of zero day issue of Microsoft I have to export it and delete it.

    PowerShell how? with CI?

    0 comments No comments

  3. AllenLiu-MSFT 49,311 Reputation points Microsoft External Staff
    2022-06-03T07:07:30.977+00:00

    Hi, @PerserPolis-1732

    Thank you for posting in Microsoft Q&A forum.

    Here is an example how to use powershell script to discovery and remediation, you may need to customize the script according your own requirements:
    https://timmyit.com/2016/09/05/guide-configuration-item-with-powershell-discovery-and-remediation-string-compliance/
    (Please Note: Since the website is not hosted by Microsoft, just for your reference.)


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  4. PerserPolis-1732 1,971 Reputation points
    2022-06-03T07:09:44.597+00:00

    any powershell script for export and delete Registry key

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.