Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $LogPath = "C:\test\xxx"
- if(-not (Test-path -Path $LogPath)){
- New-Item -ItemType Directory -Force -Path $LogPath
- }
- $FullFilePath = Join-Path $LogPath -ChildPath "MemoryUsage.txt"
- $ComputerMemory = Get-WmiObject -Class WIN32_OperatingSystem -ComputerName localhost
- $Memory = [math]::Round(((($ComputerMemory.TotalVisibleMemorySize - $ComputerMemory.FreePhysicalMemory)*100)/ $ComputerMemory.TotalVisibleMemorySize))
- $DateStr = (Get-Date).ToString("dd.MM.yyyy HH:mm K")
- Add-Content -Path $FullFilePath -value "$DateStr $memory %"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement