locked
Script with system info RRS feed

  • Question

  • Hello,

    I need a simple script (powershell or anther) that write system info to a txt file with this example format:

    OS = Microsoft Windows 7

    CPU = Intel 434

    RAM = 4

    Only this 3 valors, I now the comman to obtain this info ((Get-WmiObject Win32_OperatingSystem).Name) to obtain the first valor, for example, but I don't know how to get this output format: OS = OS.

    Can anyone helpme?

    Thanks in advance!


    jspt

    Wednesday, October 8, 2014 3:55 PM

Answers

  • Hi,

    Try this:

    $os = Get-WmiObject Win32_OperatingSystem
    $cs = Get-WmiObject Win32_ComputerSystem
    $cpu = Get-WmiObject Win32_Processor
    
    "OS = {0}" -f $os.Caption | Out-File "$env:COMPUTERNAME-Info.txt"
    "CPU = {0}" -f $cpu.Caption | Out-File "$env:COMPUTERNAME-Info.txt" -Append
    "RAM = {0}" -f $cs.TotalPhysicalMemory | Out-File "$env:COMPUTERNAME-Info.txt" -Append


    Don't retire TechNet! - (Don't give up yet - 13,085+ strong and growing)

    • Marked as answer by JS Perez Wednesday, October 8, 2014 4:11 PM
    Wednesday, October 8, 2014 4:06 PM

All replies