| 
									
										
										
										
											2023-12-12 16:39:28 +03:00
										 |  |  | function Find-Process { | 
					
						
							|  |  |  |     param ( | 
					
						
							|  |  |  |         $ProcessName | 
					
						
							|  |  |  |     ) | 
					
						
							| 
									
										
										
										
											2024-01-29 23:41:19 +03:00
										 |  |  |     $PathSearchArray = @( | 
					
						
							|  |  |  |         "$env:SystemDrive\Program Files", | 
					
						
							|  |  |  |         "$env:SystemDrive\Program Files (x86)", | 
					
						
							|  |  |  |         "$env:HOMEPATH\AppData\Roaming", | 
					
						
							|  |  |  |         "$env:HOMEPATH\Documents" | 
					
						
							|  |  |  |     ) | 
					
						
							|  |  |  |     foreach ($PathSearch in $PathSearchArray) { | 
					
						
							|  |  |  |         $ProcessPath = (Get-ChildItem $PathSearch | Where-Object Name -match $ProcessName).FullName | 
					
						
							|  |  |  |         if ($null -ne $ProcessPath) { | 
					
						
							|  |  |  |             break | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2023-12-12 16:39:28 +03:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2024-01-29 23:41:19 +03:00
										 |  |  |     $ProcessNameExec = "$($ProcessName).exe" | 
					
						
							| 
									
										
										
										
											2023-12-12 16:39:28 +03:00
										 |  |  |     (Get-ChildItem $ProcessPath -Recurse | Where-Object Name -eq $ProcessNameExec).FullName | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-29 23:41:19 +03:00
										 |  |  | # Find-Process OpenHardwareMonitor # C:\Users\lifailon\Documents\OpenHardwareMonitor-0.9.6\OpenHardwareMonitor-0.9.6\OpenHardwareMonitor.exe | 
					
						
							| 
									
										
										
										
											2023-12-12 16:39:28 +03:00
										 |  |  | # Find-Process qbittorrent # C:\Program Files\qBittorrent\qbittorrent.exe | 
					
						
							|  |  |  | # Find-Process nmap # C:\Program Files (x86)\Nmap\nmap.exe | 
					
						
							|  |  |  | # Find-Process telegram # C:\Users\lifailon\AppData\Roaming\Telegram Desktop\Telegram.exe |