- 1 year ago
fsmgmt.msc | stop process are running from specific directory | Remote server with invoke
To stop processes that are running from a specific directory on a remote server using the fsmgmt.msc
(Shared Folders) console and the invoke-command
cmdlet in PowerShell, follow these steps:
Open PowerShell with administrative privileges.
Use the
invoke-command
cmdlet to run thefsmgmt.msc
command remotely on the target server. Replace<RemoteServerName>
with the name or IP address of the remote server:
powershellInvoke-Command -ComputerName <RemoteServerName> -ScriptBlock { fsmgmt.msc }
This command will open the Shared Folders console on the remote server.
In the Shared Folders console, navigate to the "Sessions" or "Open Files" section (depending on the Windows version) to view the active sessions or open files on the remote server.
Identify the processes running from the specific directory you want to stop.
Once you have identified the processes, you can terminate them using the
invoke-command
cmdlet again within the same PowerShell session. Replace<RemoteServerName>
with the name or IP address of the remote server, and<ProcessName>
with the name of the process you want to terminate:
powershellInvoke-Command -ComputerName <RemoteServerName> -ScriptBlock { Stop-Process -Name <ProcessName> -Force }
This command will terminate the specified process on the remote server.
Make sure you have appropriate permissions and administrative access to the remote server in order to execute these commands successfully. Additionally, exercise caution when terminating processes remotely, as it may affect system stability and user sessions.
Please note that the availability of the fsmgmt.msc
console and the ability to terminate processes remotely depend on the Windows version and configuration of the remote server.