参加ドメイン
> (Get-WMIObject -class Win32_ComputerSystem).Domain
> (Get-WmiObject -class Win32_NetworkAdapterConfiguration | Where-Object {$_.IPEnabled -eq "TRUE"}).IPAddress
> (Get-WmiObject -class Win32_NetworkAdapterConfiguration | Where-Object {$_.IPEnabled -eq "TRUE"}).DHCPEnabled
> (Get-WmiObject -class Win32_NetworkAdapterConfiguration | Where-Object {$_.IPEnabled -eq "TRUE"}).DNSServerSearchOrder
> (Get-WmiObject -class Win32_NetworkAdapterConfiguration | Where-Object {$_.IPEnabled -eq "TRUE"}).DNSDomainSuffixSearchOrder
> tzutil /g
Windows Firewallの有効/無効
> (netsh advfirewall show publicprofile | findstr State ).Split(" ")[-1] > (netsh advfirewall show domainprofile | findstr State ).Split(" ")[-1] > (netsh advfirewall show privateprofile | findstr State ).Split(" ")[-1]
Admin権限所持アカウント
> $hostname = hostname > Get-WmiObject -q "SELECT * From Win32_GroupUser" | ?{$_.Path -like '*Administrators*' -and $_.Path -like "*${hostname}*"} | %{$_.PartComponent}
サービス有無
> (Get-Service | Where-Object {$_.name -eq "サービス名"}).Status
$OSVer = (Get-WmiObject -class Win32_OperatingSystem).Version $OSBuild = (Get-WmiObject -class Win32_OperatingSystem).BuildNumber [int] $OSVer = $OSVer.Replace( ".${OSBuild}", "" ) if ($OSVer -lt 10){ $WinUp_Critical = (Get-ItemProperty -Path "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" -Name "AUOptions" -ErrorAction SilentlyContinue).AUOptions $WinUp_Recommend = (Get-ItemProperty -Path "HKLM:\\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" -Name "IncludeRecommendedUpdates" -ErrorAction SilentlyContinue).IncludeRecommendedUpdates } else { $winup_status = (Get-Service | Where-Object {$_.name -eq "wuauserv"}).Status }
AUOptionsの値は、重要なWindowsUpdateを「4:自動インストール、3:ダウンロードのみ、2:ダウンロードから選択、1:しない」となります。IncludeRecommendedUpdatesの値は、推奨のWindowsUpdateを「1:有効、0:無効」となります。
Windows10および2016では設定方法が変わってしまったため、"Windows Update"サービスの起動有無を確認しています。
PowerShell 2.0 or later