PowerShellでuptimeファンクションを作ってみる †LinuxなどUNIXコマンドのuptimeコマンドをPowerShellでuptimeファンクションを作ってみました。 関連記事 †uptimeファンクション †サンプルスクリプト †uptimeのサンプルスクリプトになります。 Function uptime() { [DateTime]::Now - [Management.ManagementDateTimeConverter]::ToDateTime((Get-WmiObject Win32_OperatingSystem).LastBootUpTime) | Select-Object Days, Hours, Seconds, Milliseconds| Format-Table -AutoSize } 実行結果 †PowerShell上で起動したときのスクリーンショットです。 以上、PowerShellでuptimeファンクションを作ってみたでした。 |