I am writing the following code to close all explorer windows with PowerShell:
(New-Object -comObject Shell.Application).Windows() | ? { $_.FullName -ne $nu
Stop-Process -Name explorer
Kill all related processes