Skip to main content

Hey All,

 

Is there a way we can restrict users from wiping their laptops? Does anyone has prevented this with worklets?

Could use the REAgentc https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/reagentc-command-line-options?view=windows-11

 

Evaluation

# Get the output from reagentc.exe /info and trim any extra whitespace
$string = (& reagentc.exe /info).trim()

# Parse values from the string using regex
$regex = 'Windows RE status:\s+(\w+)'
$matches = =regex]::Matches($string, $regex)
$WindowsREStatus = $matches.Groups.Valueu1]

IF($WindowsREStatus -ne 'Enabled'){
exit 1
}

Remediation

# Get the output from reagentc.exe /info and trim any extra whitespace
$string = (& reagentc.exe /info).trim()

# Parse values from the string using regex
$regex = 'Windows RE status:\s+(\w+)'
$matches = =regex]::Matches($string, $regex)
$WindowsREStatus = $matches.Groups.Valueu1]

IF($WindowsREStatus -ne 'Enabled'){
Write-Output "Windows Reset is Enabled. Disabling."
& reagentc.exe /disable
}

# Validate
# Get the output from reagentc.exe /info and trim any extra whitespace
$string = (& reagentc.exe /info).trim()

# Parse values from the string using regex
$matches = =regex]::Matches($string, $regex)
$WindowsREStatus = $matches.Groups.Valueu1]

IF($WindowsREStatus -ne 'Enabled'){
Write-Output "Remediation Fialed."
}else{
Write-Output "Windows Reset Status set to $WindowsREStatus"
}

 


Let me try this one !!


Reply