| 
									
										
										
										
											2023-12-12 16:39:28 +03:00
										 |  |  | function Get-MemorySize { | 
					
						
							|  |  |  |     $Memory           = Get-CimInstance Win32_OperatingSystem | 
					
						
							|  |  |  |     $MemUse           = $Memory.TotalVisibleMemorySize - $Memory.FreePhysicalMemory | 
					
						
							| 
									
										
										
										
											2023-12-19 00:06:14 +03:00
										 |  |  |     $MemUserProc      = ($MemUse / $Memory.TotalVisibleMemorySize) * 100 | 
					
						
							| 
									
										
										
										
											2023-12-12 16:39:28 +03:00
										 |  |  |     $GetProcess       = Get-Process | 
					
						
							|  |  |  |     $ws               = ((($GetProcess).WorkingSet | Measure-Object -Sum).Sum/1gb).ToString("0.00 GB") | 
					
						
							|  |  |  |     $pm               = ((($GetProcess).PM | Measure-Object -Sum).Sum/1gb).ToString("0.00 GB") | 
					
						
							|  |  |  |     $CollectionMemory = New-Object System.Collections.Generic.List[System.Object] | 
					
						
							|  |  |  |     $CollectionMemory.Add([PSCustomObject]@{ | 
					
						
							| 
									
										
										
										
											2023-12-19 00:06:14 +03:00
										 |  |  |         MemoryAll     = ($memory.TotalVisibleMemorySize/1mb).ToString("0.00 GB") | 
					
						
							|  |  |  |         MemoryUse     = ($MemUse/1mb).ToString("0.00 GB") | 
					
						
							|  |  |  |         MemoryUseProc = [string]([int]$MemUserProc)+" %" | 
					
						
							|  |  |  |         WorkingSet    = $ws | 
					
						
							|  |  |  |         PageMemory    = $pm | 
					
						
							| 
									
										
										
										
											2023-12-12 16:39:28 +03:00
										 |  |  |     }) | 
					
						
							|  |  |  |     $CollectionMemory | 
					
						
							|  |  |  | } |