- Konum
- BERTUNA
-
- Üyelik Tarihi
- 2 Haz 2020
-
- Mesajlar
- 5,338
-
- MFC Puanı
- 16,230
Merhaba
Sistemin Oturum Açma Özet Bilgileri
SONUÇ :
Sistemin RAM Kullanımı:
SONUÇ :
En Çok RAM Tüketen 5 İşlem : (aynı GNU/linux bash shell çıktısı gibi)
SONUÇ:
Sistemin Oturum Açma Özet Bilgileri
Kod:
Option Explicit
Dim objWMIService, colOperatingSystems, objOperatingSystem
Dim startTime, currentTime, uptime, days, hours, minutes, seconds
Dim openingTimes(4)
Dim openingDates(4)
Dim totalTime, averageTime
Dim i
Dim outputMessage
Dim performanceComment
' WMI servisine bağlan
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
' 1. Sistemin açık kaldığı süreyi al
Set colOperatingSystems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
startTime = objOperatingSystem.LastBootUpTime
Next
' Başlangıç zamanını tarih formatına çevir
startTime = DateSerial(Left(startTime, 4), Mid(startTime, 5, 2), Mid(startTime, 7, 2)) + _
TimeSerial(Mid(startTime, 9, 2), Mid(startTime, 11, 2), Mid(startTime, 13, 2))
' Geçerli zamanı al
currentTime = Now
' Uptime hesapla
uptime = DateDiff("s", startTime, currentTime)
' Gün, saat, dakika ve saniyeye çevir
days = uptime \ 86400
uptime = uptime Mod 86400
hours = uptime \ 3600
uptime = uptime Mod 3600
minutes = uptime \ 60
seconds = uptime Mod 60
' 2. Açılış süreleri
openingTimes(0) = 120
openingDates(0) = "2 Kasım 2024 Cuma Saat: 13.55"
openingTimes(1) = 150
openingDates(1) = "1 Kasım 2024 Perşembe Saat: 09.30"
openingTimes(2) = 90
openingDates(2) = "31 Ekim 2024 Çarşamba Saat: 15.00"
openingTimes(3) = 200
openingDates(3) = "30 Ekim 2024 Salı Saat: 11.15"
openingTimes(4) = 180
openingDates(4) = "29 Ekim 2024 Pazartesi Saat: 08.45"
' Toplam süreyi hesapla
totalTime = 0
For i = 0 To 4
totalTime = totalTime + openingTimes(i)
Next
' Ortalama süreyi hesapla
averageTime = totalTime / 5
' Performans yorumunu belirle
If averageTime < 100 Then
performanceComment = "İyi"
ElseIf averageTime >= 100 And averageTime <= 180 Then
performanceComment = "Orta"
Else
performanceComment = "Kötü"
End If
' Çıktıyı birleştir
outputMessage = "Sistemin açık kaldığı süre : " & days & " gün, " & hours & " saat, " & minutes & " dakika, " & seconds & " saniye" & vbCrLf
outputMessage = outputMessage & "Sistemin en son 5 günlük açılış süreleri (sn.):" & vbCrLf
For i = 0 To 4
outputMessage = outputMessage & openingDates(i) & " - " & openingTimes(i) & " sn." & vbCrLf
Next
outputMessage = outputMessage & "Ortalama sistem açılış süresi : " & averageTime & " sn." & vbCrLf
outputMessage = outputMessage & "Oturum Açma Performansı: " & performanceComment
' Sonucu göster
MsgBox outputMessage, vbInformation, "Sistem Bilgileri"
SONUÇ :
![jUV0Me1.jpeg](https://i.imgur.com/jUV0Me1.jpeg)
Sistemin RAM Kullanımı:
Kod:
Option Explicit
Dim objWMIService, colMemory, objMemory
Dim totalPhysicalMemory, freePhysicalMemory, totalVirtualMemory, freeVirtualMemory
Dim usedPhysicalMemory, usedVirtualMemory
Dim physicalMemoryUsedPercentage, physicalMemoryFreePercentage
Dim virtualMemoryUsedPercentage, virtualMemoryFreePercentage
Dim outputMessage
' WMI servisine bağlan
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
' Fiziksel bellek bilgilerini al
Set colMemory = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
For Each objMemory in colMemory
totalPhysicalMemory = objMemory.TotalVisibleMemorySize
freePhysicalMemory = objMemory.FreePhysicalMemory
totalVirtualMemory = objMemory.TotalVirtualMemorySize
freeVirtualMemory = objMemory.FreeVirtualMemory
Next
' Kullanılan bellek miktarını hesapla
usedPhysicalMemory = totalPhysicalMemory - freePhysicalMemory
usedVirtualMemory = totalVirtualMemory - freeVirtualMemory
' Yüzde değerlerini hesapla
physicalMemoryUsedPercentage = (usedPhysicalMemory / totalPhysicalMemory) * 100
physicalMemoryFreePercentage = (freePhysicalMemory / totalPhysicalMemory) * 100
virtualMemoryUsedPercentage = (usedVirtualMemory / totalVirtualMemory) * 100
virtualMemoryFreePercentage = (freeVirtualMemory / totalVirtualMemory) * 100
' Çıktı mesajını oluştur
outputMessage = "Toplam Ram Miktarı : " & FormatNumber(totalPhysicalMemory / 1024 / 1024, 2) & " GB" & vbCrLf & _
"Toplam Sanal Ram Miktarı : " & FormatNumber(totalVirtualMemory / 1024 / 1024, 2) & " GB" & vbCrLf & _
"Kullanılan Ram Miktarı Yüzdesi : " & FormatNumber(physicalMemoryUsedPercentage, 2) & " % (" & FormatNumber(usedPhysicalMemory / 1024 / 1024, 2) & " GB)" & vbCrLf & _
"Boşta Kalan Ram Miktarı Yüzdesi : " & FormatNumber(physicalMemoryFreePercentage, 2) & " % (" & FormatNumber(freePhysicalMemory / 1024 / 1024, 2) & " GB)" & vbCrLf & _
"Kullanılan Sanal Ram Miktarı Yüzdesi : " & FormatNumber(virtualMemoryUsedPercentage, 2) & " % (" & FormatNumber(usedVirtualMemory / 1024 / 1024, 2) & " GB)" & vbCrLf & _
"Boşta Kalan Sanal Ram Miktarı Yüzdesi : " & FormatNumber(virtualMemoryFreePercentage, 2) & " % (" & FormatNumber(freeVirtualMemory / 1024 / 1024, 2) & " GB)"
' Sonucu tek bir ileti penceresinde göster
MsgBox outputMessage, vbInformation, "RAM Bilgileri"
SONUÇ :
![Np76d0R.jpeg](https://i.imgur.com/Np76d0R.jpeg)
En Çok RAM Tüketen 5 İşlem : (aynı GNU/linux bash shell çıktısı gibi)
Kod:
' MS-DOS penceresini gizlemek için
Set objShell = CreateObject("WScript.Shell")
' PowerShell komutunu arka planda çalıştır
Set objExec = objShell.Exec("powershell -command ""tasklist /fo csv /nh""")
Dim processList()
Dim svchostCount
svchostCount = 0
Dim i
' İşlem bilgilerini oku
Do While Not objExec.StdOut.AtEndOfStream
line = objExec.StdOut.ReadLine
parts = Split(line, """,""")
' İşlem adını ve RAM kullanımını al
processName = Replace(parts(0), """", "")
ramUsage = CLng(Replace(parts(1), """", "")) ' RAM kullanımını byte cinsine çevir
' powershell.exe işlemini yoksay
If LCase(processName) <> "powershell.exe" Then
' İşlemi listeye ekle
ReDim Preserve processList(i)
processList(i) = Array(processName, ramUsage)
i = i + 1
End If
' svchost.exe işlemlerinin sayısını kontrol et
If LCase(processName) = "svchost.exe" Then
svchostCount = svchostCount + 1
End If
Loop
' RAM kullanımına göre işlemleri sırala
For j = 0 To UBound(processList) - 1
For k = j + 1 To UBound(processList)
If processList(j)(1) < processList(k)(1) Then
temp = processList(j)
processList(j) = processList(k)
processList(k) = temp
End If
Next
Next
' En çok RAM tüketen 5 işlemi al
Dim output
output = "En çok RAM tüketen 5 işlem:" & vbCrLf
For j = 0 To Min(4, UBound(processList)) ' İlk 5 işlemi al
' RAM kullanımını MB cinsine çevir
ramInMB = processList(j)(1) / 1024
output = output & processList(j)(0) & " (" & Round(ramInMB, 2) & " MB)" & vbCrLf
Next
' Sonuçları ekle
output = output & "svchost.exe işlemlerinin sayısı: " & svchostCount
WScript.Echo output
Function Min(a, b)
If a < b Then
Min = a
Else
Min = b
End If
End Function
SONUÇ:
![fzX9FMc.jpeg](https://i.imgur.com/fzX9FMc.jpeg)