Closing Notepad Application in Multiple Servers


Hi All,

Often some users opens notepad applications in servers and they don’t save it and they do it for temporary data usage. We can close them with one PowerShell script in multiple servers.

Below is the PowerShell script for that.

For local :

Get-Process notepad | ? { $_.CloseMainWindow() | Out-Null }

For remote server:

invoke-command -ComputerName Server1,server2 -ScriptBlock{

Get-Process notepad | ? { $_.CloseMainWindow() | Out-Null }

}

Caution : it would close all the unsaved notepads. Please make sure before proceeding further.

Regards,

Chaitanya

Leave a Reply

Create your own website, free on WordPress.com.Create your own website.
Start free