はじめに なんでActive Directoryじゃないの、というつっこみはなしでお願いします(;>ω<) WMIからユーザ名を取得して、ner user で地道に情報を取得しています。 出力形式 "ユーザ名","アカウント有効","最終パスワード変更日時","パスワード有効期間","最終ログオン日時","所属グループ" "Administrator","Yes","2015/09/01","2015/10/13","2015/09/17","*Administrators " #出力パス作成 $d = Get-Date -Format "yyyyMMdd" $mypath = Split-Path $myInvocation.MyCommand.Path -Parent $path = $mypath + $d + "_" + $env:computerName + ".csv" #WM
![PowerShellでWMIからユーザ情報取得する(csv)](https://cdn-ak-scissors.b.st-hatena.com/image/square/46ecc7f3a67a7c43afe93f608aaeb4a9f4a7fd9b/height=288;version=1;width=512/https%3A%2F%2Fqiita-user-contents.imgix.net%2Fhttps%253A%252F%252Fcdn.qiita.com%252Fassets%252Fpublic%252Farticle-ogp-background-412672c5f0600ab9a64263b751f1bc81.png%3Fixlib%3Drb-4.0.0%26w%3D1200%26mark64%3DaHR0cHM6Ly9xaWl0YS11c2VyLWNvbnRlbnRzLmltZ2l4Lm5ldC9-dGV4dD9peGxpYj1yYi00LjAuMCZ3PTk3MiZoPTM3OCZ0eHQ9UG93ZXJTaGVsbCVFMyU4MSVBN1dNSSVFMyU4MSU4QiVFMyU4MiU4OSVFMyU4MyVBNiVFMyU4MyVCQyVFMyU4MiVCNiVFNiU4MyU4NSVFNSVBMCVCMSVFNSU4RiU5NiVFNSVCRSU5NyVFMyU4MSU5OSVFMyU4MiU4QiUyOGNzdiUyOSZ0eHQtYWxpZ249bGVmdCUyQ3RvcCZ0eHQtY29sb3I9JTIzMjEyMTIxJnR4dC1mb250PUhpcmFnaW5vJTIwU2FucyUyMFc2JnR4dC1zaXplPTU2JnM9NjQ1NjFlZGRkYmY2Njg4OWMxMzc5ZmFmNDE0NDE0ZmE%26mark-x%3D142%26mark-y%3D57%26blend64%3DaHR0cHM6Ly9xaWl0YS11c2VyLWNvbnRlbnRzLmltZ2l4Lm5ldC9-dGV4dD9peGxpYj1yYi00LjAuMCZoPTc2Jnc9NzcwJnR4dD0lNDB0b21va281MjMmdHh0LWNvbG9yPSUyMzIxMjEyMSZ0eHQtZm9udD1IaXJhZ2lubyUyMFNhbnMlMjBXNiZ0eHQtc2l6ZT0zNiZ0eHQtYWxpZ249bGVmdCUyQ3RvcCZzPTY5YjA0OTFjY2NjMDM2NmJlMDk0ZjcxNjg0MzE5YTNi%26blend-x%3D142%26blend-y%3D486%26blend-mode%3Dnormal%26s%3Dda5b29bb59f8dea03a1316e60a38cc37)