2 opções, a primeira é mais fácil, mas não é exportada para CSV.
Opção 1
No menu Iniciar, clique em Executar, digite cmd e pressione Enter no teclado.
Na janela do prompt de comando, digite
systeminfo | find "Up Time"
Por favor, note que o código acima é sensível a maiúsculas e minúsculas.
Opção 2
Além disso, o seguinte script powershell faz isso.
<#
.SYNOPSIS
Collects uptime information and exports to csv-file.
.DESCRIPTION
Collects information about uptime and last reboot date from one or more computers and exports result to a csv-file located in logged on users "Documents" special folder. If this file already exists (the command has been run earlier the same day) it will append the new information to the same file.
.PARAMETER ComputerName
Gets information from specified computers. Type the name of one or more computers in a comma-separated list. Default is localhost.
.PARAMETER Credential
Specifies credentials that has permission to perform WMI-queries on remote machines. Use the object returned by the Get-Credential cmdlet as argument. For local access impersonation level 3 is always used (see Get-WMIObject). Default is current user.
.LINK
2012 Scripting Games:
https://2012sg.poshcode.org
.NOTES
Author : Jesper Strandberg
Date : 2012-04-15
#>
function Export-Uptime {
[CmdletBinding()]
param (
[parameter(ValueFromPipeline = $true)]
[string[]]$ComputerName = $Env:COMPUTERNAME,
[Management.Automation.PSCredential]
$Credential
)
begin {
$LocalMachineAliases = $Env:COMPUTERNAME,'localhost','127.0.0.1','::1','.'
$Result = @()
}
process {
foreach ($Computer in $ComputerName) {
Write-Verbose "Building parameters for $Computer"
$WmiParam = @{ Class = "Win32_OperatingSystem";
Property = "LastBootUpTime";
ComputerName = $Computer }
if (-not ($LocalMachineAliases -contains $Computer) -and $Credential) {
Write-Verbose "Adding credentials for $Computer"
$WmiParam.Add("Credential", $Credential)
}
Write-Verbose "Accessing $Computer"
try { $OS = Get-WmiObject @WmiParam -ErrorAction Stop }
catch { Write-Warning $_; continue }
Write-Verbose "Calculating uptime"
$BootUpTime = $OS.ConvertToDateTime($OS.LastBootUpTime)
$Uptime = New-TimeSpan -Start $BootUpTime -End "8 am"
if ($Uptime -lt 0) { $Uptime = New-TimeSpan }
Write-Verbose "Building custom object"
$Properties = @{ ComputerName = $Computer;
Days = $Uptime.Days;
Hours = $Uptime.Hours;
Minutes = $Uptime.Minutes;
Seconds = $Uptime.Seconds;
Date = (Get-Date -Format d -Date $BootUpTime) }
$Result += New-Object PSCustomObject -Property $Properties
} # foreach
} # process
end {
Write-Verbose "Exporting results to CSV"
$CSV = $Result | Select-Object -Property ComputerName,Days,Hours,Minutes,Seconds,Date |
ConvertTo-Csv -NoTypeInformation -Delimiter ';'
$OutFile = "$([System.Environment]::GetFolderPath('Personal'))\$(Get-Date -UFormat %Y%m%d)_Uptime.csv"
try {
if (-not (Test-Path $OutFile)) {
Write-Verbose "Creating $OutFile"
$CSV | Out-File $OutFile -Encoding ASCII -ErrorAction Stop
} else {
Write-Verbose "Appending to $OutFile"
$CSV | Select-Object -Skip 1 | Out-File $OutFile -Encoding ASCII -Append -ErrorAction Stop
}
} # try
catch { Write-Warning $_ }
} # end
} # function
EDITAR
Agora, depois de reler sua pergunta, acho que a resposta é usar o evento Log XP , já que muitas pessoas dizem que é personalizável (mas eu não o usei antes).
Sobre o software: O Event Log Explorer ajuda você a navegar rapidamente, localizar e relatar problemas, avisos de segurança e todos os outros eventos gerados no Windows. Graças ao Event Log Explorer, o monitoramento e a análise de eventos registrados em Segurança, Sistema, Aplicativo, Serviço de Diretório, DNS e outros logs dos sistemas operacionais Microsoft Windows ficam muito mais rápidos e eficazes.