OS Install Date Output to Text File RRS feed

  • Question

  • Hi Everyone, I'm fairly inexperienced with batch scripting, so I need some help with a task. I need to issue this command:

    systeminfo | find /i "install date" 

    I need to collect the OS install date for machines, wanted to run this as a batch file with "pause" at the end, but it won't run and stay open to display the information. I assumed I could output the info the a text file, but because it won't run correctly via a batch script, i can't get it to output either.

    Any ideas on how I can do this? I need a rapid way of finding the OS install dates that can be generically copied from multiple PCs. 


    Friday, March 20, 2015 2:59 PM


  • Then the machines you put in the $pcs array aren't online.

    EDIT: This version will show you what is happening:

    $pcs = 'PC1','PC2','PC3'
    $pcs | ForEach {
        Write-Host "Testing $_"
        If (Test-Connection -ComputerName $_ -Count 1 -Quiet) {
            Write-Host "$_ is alive" -ForegroundColor Green
            Get-WmiObject Win32_OperatingSystem -ComputerName $_ |
                Select CSName,@{N='InstallDate';E={[System.Management.ManagementDateTimeConverter]::ToDateTime($_.InstallDate)}}
        } Else {
            Write-Host "$_ cannot be reached" -ForegroundColor Red
    } | Export-Csv .\OSInstallDates.csv -NoTypeInformation

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

    Friday, March 20, 2015 4:45 PM

All replies