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