WSH/Win32_OperatingSystemのサンプルスクリプト
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
開始行:
#navi(../)
* Win32_OperatingSystemのサンプルスクリプト [#fbff1f53]
WMIを使ったWin32_OperatingSystemでオペレーティングシステ...
#contents
#htmlinsertpcsp(win-top.html,win-sp.html)
* 関連記事 [#y04148d4]
-[[PowerShellでWMIを使用するサンプル>PowerShell/PowerShel...
-[[Win32_ComputerSystemのサンプルスクリプト>WSH/Win32_Com...
-[[Win32_ComputerSystemProductのサンプルスクリプト>WSH/Wi...
-[[Win32_OperatingSystemのサンプルスクリプト>WSH/Win32_Op...
-[[Win32_BIOSのサンプルスクリプト>WSH/Win32_BIOSのサンプ...
-[[Win32_LogicalDiskのサンプルスクリプト>WSH/Win32_Logica...
-[[Win32_Processorのサンプルスクリプト>WSH/Win32_Processo...
-[[Win32_NetworkAdapterConfigurationのサンプルスクリプト>...
-[[Win32_DiskDriveのサンプルスクリプト>WSH/Win32_DiskDriv...
* Win32_OperatingSystemを使ったサンプルスクリプト [#x030a...
以下にWin32_OperatingSystemを使用したサンプルスクリプトを...
本サンプルスクリプトでは、以下の値を表示しています。
-Windows名
-ビルド番号
-バージョン
-OSアーキテクチャ
-シリアル番号
-レジストユーザ
-Windowsディレクトリ
-システムディレクトリ
-トータルメモリサイズ
-フリーメモリ
-仮想メモリサイズ
-フリー仮想メモリ
** サンプルスクリプト [#c731e854]
#ref(opesys.vbs)
hostname="." ' dotは自機を示す
' uid = "username"
' pwd = "password"
Set oLocater = CreateObject("WbemScripting.SWbemLocator")
Set oService = oLocater.ConnectServer(hostname, "root/ci...
' Set oService = oLocater.ConnectServer(hostname, "root/...
oService.Security_.ImpersonationLevel = 3 ' デフォルト値...
Set items = oService.ExecQuery("Select * From Win32_Oper...
For Each item In items
WScript.Echo("Windows名: " & item.Caption)
WScript.Echo("ビルド番号: " & item.BuildNumber)
WScript.Echo("バージョン: " & item.Version)
WScript.Echo("OSアーキテクチャ: " & item.OSArchitecture)
WScript.Echo("シリアル番号: " & item.SerialNumber)
WScript.Echo("レジストユーザ: " & item.RegisteredUser)
WScript.Echo("Windowsディレクトリ: " & item.WindowsDir...
WScript.Echo("システムディレクトリ: " & item.SystemDir...
WScript.Echo("トータルメモリサイズ: " & item.TotalVisi...
WScript.Echo("フリーメモリ: " & item.FreePhysicalMemory)
WScript.Echo("仮想メモリサイズ: " & item.TotalVirtualM...
WScript.Echo("フリー仮想メモリ: " & item.FreeVirtualMe...
Next
Set item = Nothing
Set oService = Nothing
Set oLocater = Nothing
** 実行例 [#c056dc9f]
cscriptを使用して実行した時の出力です。
PS C:\Users\sakura\Desktop> cscript .\opesys.vbs
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.
Windows名: Microsoft Windows 8.1
ビルド番号: 9600
バージョン: 6.3.9600
OSアーキテクチャ: 64 ビット
シリアル番号: 11111-22222-33333-AAAAA
レジストユーザ: sakura@foobarhoge
Windowsディレクトリ: C:\WINDOWS
システムディレクトリ: C:\WINDOWS\system32
トータルメモリサイズ: 8230752
フリーメモリ: 5901876
仮想メモリサイズ: 9541472
フリー仮想メモリ: 6955676
以上、Win32_OperatingSystemを使ったサンプルスクリプトでし...
#htmlinsertpcsp(win-btm.html,win-sp.html)
終了行:
#navi(../)
* Win32_OperatingSystemのサンプルスクリプト [#fbff1f53]
WMIを使ったWin32_OperatingSystemでオペレーティングシステ...
#contents
#htmlinsertpcsp(win-top.html,win-sp.html)
* 関連記事 [#y04148d4]
-[[PowerShellでWMIを使用するサンプル>PowerShell/PowerShel...
-[[Win32_ComputerSystemのサンプルスクリプト>WSH/Win32_Com...
-[[Win32_ComputerSystemProductのサンプルスクリプト>WSH/Wi...
-[[Win32_OperatingSystemのサンプルスクリプト>WSH/Win32_Op...
-[[Win32_BIOSのサンプルスクリプト>WSH/Win32_BIOSのサンプ...
-[[Win32_LogicalDiskのサンプルスクリプト>WSH/Win32_Logica...
-[[Win32_Processorのサンプルスクリプト>WSH/Win32_Processo...
-[[Win32_NetworkAdapterConfigurationのサンプルスクリプト>...
-[[Win32_DiskDriveのサンプルスクリプト>WSH/Win32_DiskDriv...
* Win32_OperatingSystemを使ったサンプルスクリプト [#x030a...
以下にWin32_OperatingSystemを使用したサンプルスクリプトを...
本サンプルスクリプトでは、以下の値を表示しています。
-Windows名
-ビルド番号
-バージョン
-OSアーキテクチャ
-シリアル番号
-レジストユーザ
-Windowsディレクトリ
-システムディレクトリ
-トータルメモリサイズ
-フリーメモリ
-仮想メモリサイズ
-フリー仮想メモリ
** サンプルスクリプト [#c731e854]
#ref(opesys.vbs)
hostname="." ' dotは自機を示す
' uid = "username"
' pwd = "password"
Set oLocater = CreateObject("WbemScripting.SWbemLocator")
Set oService = oLocater.ConnectServer(hostname, "root/ci...
' Set oService = oLocater.ConnectServer(hostname, "root/...
oService.Security_.ImpersonationLevel = 3 ' デフォルト値...
Set items = oService.ExecQuery("Select * From Win32_Oper...
For Each item In items
WScript.Echo("Windows名: " & item.Caption)
WScript.Echo("ビルド番号: " & item.BuildNumber)
WScript.Echo("バージョン: " & item.Version)
WScript.Echo("OSアーキテクチャ: " & item.OSArchitecture)
WScript.Echo("シリアル番号: " & item.SerialNumber)
WScript.Echo("レジストユーザ: " & item.RegisteredUser)
WScript.Echo("Windowsディレクトリ: " & item.WindowsDir...
WScript.Echo("システムディレクトリ: " & item.SystemDir...
WScript.Echo("トータルメモリサイズ: " & item.TotalVisi...
WScript.Echo("フリーメモリ: " & item.FreePhysicalMemory)
WScript.Echo("仮想メモリサイズ: " & item.TotalVirtualM...
WScript.Echo("フリー仮想メモリ: " & item.FreeVirtualMe...
Next
Set item = Nothing
Set oService = Nothing
Set oLocater = Nothing
** 実行例 [#c056dc9f]
cscriptを使用して実行した時の出力です。
PS C:\Users\sakura\Desktop> cscript .\opesys.vbs
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.
Windows名: Microsoft Windows 8.1
ビルド番号: 9600
バージョン: 6.3.9600
OSアーキテクチャ: 64 ビット
シリアル番号: 11111-22222-33333-AAAAA
レジストユーザ: sakura@foobarhoge
Windowsディレクトリ: C:\WINDOWS
システムディレクトリ: C:\WINDOWS\system32
トータルメモリサイズ: 8230752
フリーメモリ: 5901876
仮想メモリサイズ: 9541472
フリー仮想メモリ: 6955676
以上、Win32_OperatingSystemを使ったサンプルスクリプトでし...
#htmlinsertpcsp(win-btm.html,win-sp.html)
ページ名: