четверг, 21 декабря 2017 г.

powershell. Get host uptime remote:

$OS = Get-WmiObject win32_operatingsystem -ComputerName COMPNAME
$BootTime = $OS.ConvertToDateTime($OS.LastBootUpTime)
$Uptime = $OS.ConvertToDateTime($OS.LocalDateTime) - $boottime

by https://gallery.technet.microsoft.com/scriptcenter/Get-Uptime-PowerShell-eb98896f

$wmi = Get-WmiObject -Class Win32_OperatingSystem -ComputerName COMPNAME
$wmi.ConvertToDateTime($wmi.LocalDateTime) – $wmi.ConvertToDateTime($wmi.LastBootUpTime)

среда, 13 декабря 2017 г.

Показать все сервисы, запущенные не от локальных системных учёток.

Get-WmiObject win32_service | ?{-not (($_.StartName -match "LocalService") -or ($_.StartName            -match "LocalSystem") -or ($_.StartName -match "NetworkService"))} | select name,Startname