Nav apraksta

ChatGPT-ComputerInfo.ps1 1.1KB

123456789101112131415161718192021222324252627282930
  1. # Get the Computer Name
  2. $computerName = (Get-WmiObject -Class Win32_ComputerSystem).Name
  3. # Get the CPU Model
  4. $cpuModel = (Get-WmiObject -Class Win32_Processor).Name
  5. # Get the Total RAM
  6. $totalRAM = (Get-WmiObject -Class Win32_ComputerSystem).TotalPhysicalMemory
  7. # Get the Hard Disk Information
  8. $hardDisks = Get-WmiObject -Class Win32_LogicalDisk | Where-Object {$_.DriveType -eq 3} | Select-Object DeviceID, Size, FreeSpace
  9. # Get the Installed Programs
  10. $installedPrograms = (Get-WmiObject -Class Win32_Product | Select-Object Name).Name
  11. # Create the output file
  12. $outputFile = "$env:USERPROFILE\Desktop\ComputerInfo.txt"
  13. # Write the information to the file
  14. "Computer Name: $computerName" | Out-File $outputFile -Append
  15. "CPU Model: $cpuModel" | Out-File $outputFile -Append
  16. "Total RAM: $totalRAM" | Out-File $outputFile -Append
  17. "Hard Disks: " | Out-File $outputFile -Append
  18. foreach ($disk in $hardDisks) {
  19. "$($disk.DeviceID) - Size: $($disk.Size) - Free Space: $($disk.FreeSpace)" | Out-File $outputFile -Append
  20. }
  21. "Installed Programs: " | Out-File $outputFile -Append
  22. foreach ($program in $installedPrograms) {
  23. $program | Out-File $outputFile -Append
  24. }

Powered by TurnKey Linux.