123456789101112131415161718192021222324252627282930 |
- # Get the Computer Name
- $computerName = (Get-WmiObject -Class Win32_ComputerSystem).Name
-
- # Get the CPU Model
- $cpuModel = (Get-WmiObject -Class Win32_Processor).Name
-
- # Get the Total RAM
- $totalRAM = (Get-WmiObject -Class Win32_ComputerSystem).TotalPhysicalMemory
-
- # Get the Hard Disk Information
- $hardDisks = Get-WmiObject -Class Win32_LogicalDisk | Where-Object {$_.DriveType -eq 3} | Select-Object DeviceID, Size, FreeSpace
-
- # Get the Installed Programs
- $installedPrograms = (Get-WmiObject -Class Win32_Product | Select-Object Name).Name
-
- # Create the output file
- $outputFile = "$env:USERPROFILE\Desktop\ComputerInfo.txt"
-
- # Write the information to the file
- "Computer Name: $computerName" | Out-File $outputFile -Append
- "CPU Model: $cpuModel" | Out-File $outputFile -Append
- "Total RAM: $totalRAM" | Out-File $outputFile -Append
- "Hard Disks: " | Out-File $outputFile -Append
- foreach ($disk in $hardDisks) {
- "$($disk.DeviceID) - Size: $($disk.Size) - Free Space: $($disk.FreeSpace)" | Out-File $outputFile -Append
- }
- "Installed Programs: " | Out-File $outputFile -Append
- foreach ($program in $installedPrograms) {
- $program | Out-File $outputFile -Append
- }
|