Hey everyone! I'm looking for some help with writing a PowerShell script for Intune that can quietly uninstall both the x64 and x86 versions of the Windows Desktop Runtime 6.0.36 from users' machines. I'm not very experienced with PowerShell, and the script I generated using AI isn't working properly. I can't post the script here because of formatting issues, but any advice or guidance would be really appreciated! Thanks!
3 Answers
Here's a remediation script that you can use to uninstall the runtimes:
```powershell
$apps = Get-WmiObject -Class Win32_Product | Where-Object {
$_.Name -eq "Microsoft Windows Desktop Runtime - 6.0.36 (x64)" -or
$_.Name -eq "Microsoft Windows Desktop Runtime - 6.0.36 (x86)"
}
foreach ($app in $apps) {
try {
$app.Uninstall() | Out-Null
Write-Host "Uninstalled $($app.Name)"
} catch {
Write-Host "Failed to uninstall $($app.Name): $_"
}
}
```
Let me know if you have any questions about this!
First off, you need to post your script as a text block in the comments. It’s hard to help without seeing what you’ve written. If you're having issues with formatting, I'd recommend checking out the Reddit formatting guide.
Have you run into any specific errors? Knowing where you're stuck would help a lot in figuring out what the problem is. Also, here’s a basic detection script:
```powershell
$runtime64 = Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -eq "Microsoft Windows Desktop Runtime - 6.0.36 (x64)" }
$runtime86 = Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -eq "Microsoft Windows Desktop Runtime - 6.0.36 (x86)" }
if ($runtime64 -or $runtime86) {
Write-Host "Detected"
exit 1
} else {
Write-Host "Not Detected"
exit 0
}
```
Try running something like this to check if the runtime is installed, and let us know how it goes!
Also, be careful with `Get-WmiObject` as it can be slow. There are better alternatives like using `Get-CimInstance`.