|
|
windows10 の各種設定値を取得してみよう |
H.Kamifuji . |
PowerShell では、windows の各種設定値の取得が簡単に実行できます。 下図のような [ コントロールパネル(P) ]-[ システム ] の表示内容を取得できます。 ![]() これらの情報の取得方法について説明します。 PowerShell 7.15 インストールに共ない見直します。 PowerShell 7.4.6 インストールに共ない見直します。 |
コンピュータのプロパティを取得します。# コンピュータのプロパティを取得する。 # Clear-Host Get-WmiObject Win32_ComputerSystem # Get-WmiObject CIM_ComputerSystem # Get-WmiObject CIM_System <# # 下記でも同様な結果が得られる。( 64 bit 用なのかな?) Get-WmiObject CIM_ComputerSystem # 下記のコマンドでは、Domain 情報が付加される。 Get-WmiObject CIM_System #>上記を実行すると Domain : WORKGROUP Manufacturer : System manufacturer Model : P5K-E Name : xxxxxxxxxxxxxxxx PrimaryOwnerName : nnnnnnnn TotalPhysicalMemory : 3488731136上記を実行すると PowerShell 7.15 では、エラーです。何故か Object が無い??
Get-WmiObject: The term 'Get-WmiObject' is not recognized as a name
of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify
that the path is correct and try again.
PowerShell 7.4.6 でも、同様です。上記の情報を取得できます。 下記を実行すると # コンピュータのプロパティを取得する。 # Clear-Host # Get-WmiObject Win32_ComputerSystem # Get-WmiObject CIM_ComputerSystem Get-WmiObject CIM_System <# # 下記でも同様な結果が得られる。( 64 bit 用なのかな?) Get-WmiObject CIM_ComputerSystem # 下記のコマンドでは、Domain 情報が付加される。 Get-WmiObject CIM_System #>下記のように DomainControll 情報も取得できます。 Domain : WORKGROUP Manufacturer : System manufacturer Model : P5K-E Name : xxxxxxxxxxxxx PrimaryOwnerName : nnnnnnnn TotalPhysicalMemory : 3488731136 ClientSiteName : DcSiteName : Description : xxxxxxxxxxxxxx DnsForestName : DomainControllerAddress : DomainControllerName : DomainName : Roles : Status : Unknown上記を実行すると PowerShell 7.15 では、エラーです。何故か Object が無い??
Get-WmiObject: The term 'Get-WmiObject' is not recognized as a name
of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify
that the path is correct and try again.
PowerShell 7.4.6 でも、同様です。 |
windows OS version を取得するには、下記のコマンドを実行します。# ----< Windows OS version を取得する。 >---- Get-WmiObject -class Win32_OperatingSystem上記を実行すると、下記の情報が出力されます。 SystemDirectory : C:\WINDOWS\system32 Organization : BuildNumber : 10586 RegisteredUser : nnnnnnnn SerialNumber : xxxxx-x0000-00000-xxxxx Version : 10.0.10586SerialNumber として、プロダクトIDを取得することができます。 |
windows10 のプロダクトキー を取得するには、下記のコマンドを実行します。# ----< Windows のプロダクトキー を取得する。 >---- (Get-WmiObject -query 'select * from SoftwareLicensingService').OA3xOriginalProductKey上記を実行すると、下記の情報が出力されます。 xxxxx-yyyyy-zzzzz-aaaaa-bbbbbSerialNumber として、プロダクトIDを取得することができます。 |
設定されているプリンターの情報を取得します。# ----< プリンターの情報を取得する >---- Get-WmiObject -class Win32_Printer上記を実行すると、下記の情報が出力されます。 Location : Name : RICOH imagio MP C7500 PS PrinterState : 0 PrinterStatus : 3 ShareName : SystemName : xxxxxxxxxxxx Location : Name : OneNote 2010 に送る PrinterState : 0 PrinterStatus : 3 ShareName : SystemName : xxxxxxxxxxxx #### 省略 #### Location : Name : EPSON2119B0 (EP-807A Series) PrinterState : 0 PrinterStatus : 3 ShareName : SystemName : xxxxxxxxxxxx上記を実行すると PowerShell 7.15 では、エラーです。何故か Object が無い??
Get-WmiObject: The term 'Get-WmiObject' is not recognized as a name
of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify
that the path is correct and try again.
PowerShell 7.4.6 でも、同様です。 |
物理的パッケージの情報を取得します。# ----< 物理的パッケージの情報を取得する >---- Get-WMIObject -Class CIM_PhysicalPackage | Format-Table上記を実行すると、下記の情報が出力されます。 Manufacturer Model Name SerialNumber SKU Product ------------ ----- ---- ------------ --- ------- ASUSTeK Computer INC. ベースボード MS1C83BZE802539 P5K-E 物理メモリの配列 Chassis Manufacture システム格納装置 Chassis Serial Number上記を実行すると PowerShell 7.15 では、エラーです。何故か Object が無い??
Get-WmiObject: The term 'Get-WmiObject' is not recognized as a name
of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify
that the path is correct and try again.
PowerShell 7.4.6 でも、同様です。 |
マザーボード内の装置の情報を取得します。# ----< On Board Device の情報を取得する >---- Get-WMIObject -Class Win32_OnBoardDevice上記を実行すると、下記の情報が出力されます。 DeviceType SerialNumber Enabled Description ---------- ------------ ------- ----------- 5 True Onboard Ethernet上記を実行すると PowerShell 7.15 では、エラーです。何故か Object が無い??
Get-WmiObject: The term 'Get-WmiObject' is not recognized as a name
of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify
that the path is correct and try again.
PowerShell 7.4.6 でも、同様です。 |
物理メモリの格納情報を取得します。# ----< 物理メモリの格納情報を取得する >---- Get-WMIObject -Class Win32_PhysicalMemory | Format-Table上記を実行すると、下記の情報が出力されます。 __GENUS __CLASS __SUPERCLASS __DYNASTY __RELPATH ## 省略 ## ------- ------- ------------ --------- --------- 2 Win32_PhysicalMemory CIM_PhysicalMemory CIM_ManagedSystemElement Win32_PhysicalMemory.Tag="Physical Memory 0" 2 Win32_PhysicalMemory CIM_PhysicalMemory CIM_ManagedSystemElement Win32_PhysicalMemory.Tag="Physical Memory 2"4個あるメモリスロット中、0番と2番に 2 GB メモリが実装されている情報が取得できました。 上記を実行すると PowerShell 7.15 では、エラーです。何故か Object が無い??
Get-WmiObject: The term 'Get-WmiObject' is not recognized as a name
of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify
that the path is correct and try again.
PowerShell 7.4.6 でも、同様です。 |
BIOS の情報を取得します。# ----< BIOS の情報を取得する >---- Get-WmiObject -Class Win32_Bios上記を実行すると、下記の情報が出力されます。 SMBIOSBIOSVersion : 0906 Manufacturer : American Megatrends Inc. Name : BIOS Date: 12/10/07 17:27:58 Ver: 08.00.12 SerialNumber : System Serial Number Version : A_M_I_ - 12000710上記を実行すると PowerShell 7.15 では、エラーです。何故か Object が無い??
Get-WmiObject: The term 'Get-WmiObject' is not recognized as a name
of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify
that the path is correct and try again.
PowerShell 7.4.6 でも、同様です。 |
ログイン時のスタートアップコマンドの情報を取得します。# ----< Startup Command の情報を取得する >---- Get-WmiObject -class Win32_StartupCommand | Format-Table Command上記を実行すると、下記の情報が出力されます。 Command ------- C:\Windows\System32\OneDriveSetup.exe /thfirstsetup C:\Windows\System32\OneDriveSetup.exe /thfirstsetup "C:\Users\kamifuji\AppData\Local\Microsoft\OneDrive\OneDrive.exe" /background C:\Users\kamifuji\AppData\Local\Microsoft\BingSvc\BingSvc.exe C:\WINDOWS\system32\spool\DRIVERS\W32X86\3\E_FATINJJ.EXE /EPT "EPLTarget\P0000000000000000" /M "EP-807A Series" C:\Windows\System32\OneDriveSetup.exe /thfirstsetup "C:\Program Files\Common Files\Apple\Apple Application Support\APSDaemon.exe" "C:\Program Files\QuickTime\QTTask.exe" -atboottime "C:\Program Files\Epson Software\Event Manager\EEventManager.exe" "C:\Program Files\Common Files\Java\Java Update\jusched.exe" "C:\Program Files\iTunes\iTunesHelper.exe"上記を実行すると PowerShell 7.15 では、エラーです。何故か Object が無い??
Get-WmiObject: The term 'Get-WmiObject' is not recognized as a name
of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify
that the path is correct and try again.
PowerShell 7.4.6 でも、同様です。 |
windows update の QuickFix 情報を取得します。# ----< windows update のi QuickFix 情報を取得する >---- Get-WMIObject Win32_QuickFixEngineering上記を実行すると、下記の情報が出力されます。 Source Description HotFixID InstalledBy InstalledOn ------ ----------- -------- ----------- ----------- xxxxxxxx-P... Security Update KB3116900 NT AUTHORITY\SYSTEM 2015/12/17 0:00:00 xxxxxxxx-P... Update KB3124200 NT AUTHORITY\SYSTEM 2015/12/18 0:00:00 xxxxxxxx-P... Update KB3124262 NT AUTHORITY\SYSTEM 2016/02/05 0:00:00 xxxxxxxx-P... Security Update KB3124263 NT AUTHORITY\SYSTEM 2016/01/14 0:00:00 xxxxxxxx-P... Security Update KB3135173 NT AUTHORITY\SYSTEM 2016/02/13 0:00:00 xxxxxxxx-P... Update KB3139907 NT AUTHORITY\SYSTEM 2016/03/02 0:00:00 xxxxxxxx-P... Update KB3140741 NT AUTHORITY\SYSTEM 2016/03/23 0:00:00 xxxxxxxx-P... Update KB3140743 NT AUTHORITY\SYSTEM 2016/03/02 0:00:00 xxxxxxxx-P... Security Update KB3140768 NT AUTHORITY\SYSTEM 2016/03/10 0:00:00 xxxxxxxx-P... Update KB3149135 NT AUTHORITY\SYSTEM 2016/06/15 0:00:00 xxxxxxxx-P... Security Update KB3167685 NT AUTHORITY\SYSTEM 2016/06/17 0:00:00 xxxxxxxx-P... Security Update KB3163018 NT AUTHORITY\SYSTEM 2016/06/15 0:00:00上記を実行すると PowerShell 7.15 では、エラーです。何故か Object が無い??
Get-WmiObject: The term 'Get-WmiObject' is not recognized as a name
of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify
that the path is correct and try again.
PowerShell 7.4.6 でも、同様です。 |
Microsoft update の更新情報を取得します。# ----< Microsoft update の更新情報を取得する >---- $Session = New-Object -ComObject Microsoft.Update.Session $Searcher = $Session.CreateUpdateSearcher() $HistoryCount = $Searcher.GetTotalHistoryCount() $Searcher.QueryHistory(1,$HistoryCount) | Format-Table date, title $Session上記を実行すると、下記の情報が出力されます。 2016/06/21 8:21:14 Windows Defender の定義の更新 ? KB2267602 (定義 1.223.2255.0) 2016/06/21 0:40:45 Windows Defender の定義の更新 ? KB2267602 (定義 1.223.2235.0) 2016/06/20 5:38:39 Windows Defender の定義の更新 ? KB2267602 (定義 1.223.2155.0) 2016/06/20 2:25:11 Windows Defender の定義の更新 ? KB2267602 (定義 1.223.2135.0) 2016/06/19 4:08:58 Windows Defender の定義の更新 ? KB2267602 (定義 1.223.2035.0) 2016/06/18 3:13:56 Windows Defender の定義の更新 ? KB2267602 (定義 1.223.1880.0) 2016/06/17 3:19:04 Windows Defender の定義の更新 ? KB2267602 (定義 1.223.1766.0) 2016/06/16 23:48:09 Windows 10 Version 1511 用 Adobe Flash Player のセキュリティ更新プログラム (KB3167685) 2016/06/16 21:47:43 Windows Defender の定義の更新 ? KB2267602 (定義 1.223.1752.0) 2016/06/15 21:38:03 Windows Defender の定義の更新 ? KB2267602 (定義 1.223.1671.0) 2016/06/15 6:09:54 Microsoft Excel 2010 (KB3115130) 32 ビット版 のセキュリティ更新プログラム 2016/06/15 6:09:36 Microsoft Office 2010 (KB3115247) 32 ビット版 の定義の更新 2016/06/15 6:09:02 Microsoft Office 2010 (KB2881030) 32 ビット版 の更新プログラム 2016/06/15 6:08:43 Windows 10 Version 1511 用更新プログラム (KB3149135) 2016/06/15 6:08:35 Windows 8 8.1 と 10 用の、Windows 悪意のあるソフトウェアの削除ツール - 2016 年 6 月 (... 2016/06/15 6:02:47 Microsoft Word 2010 (KB3115243) 32 ビット版 のセキュリティ更新プログラム 2016/06/15 6:02:04 Windows 10 Version 1511 用の累積的な更新プログラム (KB3163018) 2016/06/15 6:00:49 Microsoft Visio 2010 (KB3114872) 32 ビット版 のセキュリティ更新プログラム #### 省略 #### ClientApplicationID ReadOnly WebProxy UserLocale ------------------- -------- -------- ---------- False System.__ComObject 1041上記を実行すると PowerShell 7.15 でも、正常(同様)に、実行されます。 PowerShell 7.4.6 でも、同様です。 |