wmi

package
v4.1.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Rendered for windows/amd64

Overview

Package wmi handles WMI queries

Package wmi handles WMI queries

Package wmi handles WMI queries

Package wmi handles WMI queries

Package wmi handles WMI queries

Package wmi handles WMI queries

Package wmi handles WMI queries

Package wmi handles WMI queries

Package wmi handles WMI queries

Package wmi handles WMI queries

Package wmi handles WMI queries

Package wmi handles WMI queries

Index

Constants

View Source
const (
	ISCSI_IP_ADDRESS_TEXT = iota
	ISCSI_IP_ADDRESS_IPV4
	ISCSI_IP_ADDRESS_IPV6
	ISCSI_IP_ADDRESS_EMPTY
)
View Source
const (
	S_OK                     = 0
	S_FALSE                  = 1
	WBEM_S_NO_ERROR          = 0
	WBEM_S_FALSE             = 1
	WBEM_E_CRITICAL_ERROR    = 0x8004100A
	WBEM_E_NOT_SUPPORTED     = 0x8004100C
	WBEM_E_INVALID_NAMESPACE = 0x8004100E
	WBEM_E_INVALID_CLASS     = 0x80041010
)

HRESULT values

View Source
const (
	RPC_C_AUTHN_LEVEL_DEFAULT       = 0
	RPC_C_AUTHN_LEVEL_NONE          = 1
	RPC_C_AUTHN_LEVEL_CONNECT       = 2
	RPC_C_AUTHN_LEVEL_CALL          = 3
	RPC_C_AUTHN_LEVEL_PKT           = 4
	RPC_C_AUTHN_LEVEL_PKT_INTEGRITY = 5
	RPC_C_AUTHN_LEVEL_PKT_PRIVACY   = 6
)

Authentication Level Constants

View Source
const (
	RPC_C_IMP_LEVEL_DEFAULT     = 0
	RPC_C_IMP_LEVEL_ANONYMOUS   = 1
	RPC_C_IMP_LEVEL_IDENTIFY    = 2
	RPC_C_IMP_LEVEL_IMPERSONATE = 3
	RPC_C_IMP_LEVEL_DELEGATE    = 4
)

Impersonation Level Constants

Variables

View Source
var (

	// WMI Class and Interface GUIDs
	CLSID_WbemLocator    = ole.NewGUID("4590f811-1d3a-11d0-891f-00aa004b2e24")
	IID_IWbemLocator     = ole.NewGUID("dc12a687-737f-11cf-884d-00aa004b2e24")
	IID_IWbemClassObject = ole.NewGUID("dc12a681-737f-11cf-884d-00aa004b2e24")
)

Package variables

Functions

func Cleanup

func Cleanup()

Cleanup is an optional routine that should only be called when the process using the WMI package is exiting.

func ExecQuery

func ExecQuery(wqlQuery string, namespace string, dst interface{}) (err error)

ExecQuery executes the given WMI query, in the given namespace, and returns JSON objects

func ExecWmiMethod

func ExecWmiMethod(className, methodName, namespace string, params ...interface{}) (result *ole.VARIANT, err error)

ExecWmiMethod is used to execute a WMI method. A VARIANT is returned from the WMI method as well as an error should the WMI method be executed.

func FAILED

func FAILED(hresult uintptr) bool

FAILED function returns true if HRESULT fails, else false

func RescanDisks

func RescanDisks() error

RescanDisks calls the UpdateHostStorageCache method of the MSFT_StorageSetting WMI class. It's equivalent to performing a rescan within diskpart.exe.

func SUCCEEDED

func SUCCEEDED(hresult uintptr) bool

SUCCEEDED function returns true if HRESULT succeeds, else false

Types

type CIMTYPE_ENUMERATION

type CIMTYPE_ENUMERATION uint32

The CIMTYPE_ENUMERATION enumeration defines values that specify different CIM data types

const (
	CIM_ILLEGAL    CIMTYPE_ENUMERATION = 0xFFF
	CIM_EMPTY      CIMTYPE_ENUMERATION = 0
	CIM_SINT8      CIMTYPE_ENUMERATION = 16
	CIM_UINT8      CIMTYPE_ENUMERATION = 17
	CIM_SINT16     CIMTYPE_ENUMERATION = 2
	CIM_UINT16     CIMTYPE_ENUMERATION = 18
	CIM_SINT32     CIMTYPE_ENUMERATION = 3
	CIM_UINT32     CIMTYPE_ENUMERATION = 19
	CIM_SINT64     CIMTYPE_ENUMERATION = 20
	CIM_UINT64     CIMTYPE_ENUMERATION = 21
	CIM_REAL32     CIMTYPE_ENUMERATION = 4
	CIM_REAL64     CIMTYPE_ENUMERATION = 5
	CIM_BOOLEAN    CIMTYPE_ENUMERATION = 11
	CIM_STRING     CIMTYPE_ENUMERATION = 8
	CIM_DATETIME   CIMTYPE_ENUMERATION = 101
	CIM_REFERENCE  CIMTYPE_ENUMERATION = 102
	CIM_CHAR16     CIMTYPE_ENUMERATION = 103
	CIM_OBJECT     CIMTYPE_ENUMERATION = 13
	CIM_FLAG_ARRAY CIMTYPE_ENUMERATION = 0x2000
)

type EOLE_AUTHENTICATION_CAPABILITIES

type EOLE_AUTHENTICATION_CAPABILITIES uint32

EOLE_AUTHENTICATION_CAPABILITIES specifies various capabilities in CoInitializeSecurity and IClientSecurity::SetBlanket (or its helper function CoSetProxyBlanket).

const (
	EOAC_NONE              EOLE_AUTHENTICATION_CAPABILITIES = 0
	EOAC_MUTUAL_AUTH       EOLE_AUTHENTICATION_CAPABILITIES = 0x1
	EOAC_STATIC_CLOAKING   EOLE_AUTHENTICATION_CAPABILITIES = 0x20
	EOAC_DYNAMIC_CLOAKING  EOLE_AUTHENTICATION_CAPABILITIES = 0x40
	EOAC_ANY_AUTHORITY     EOLE_AUTHENTICATION_CAPABILITIES = 0x80
	EOAC_MAKE_FULLSIC      EOLE_AUTHENTICATION_CAPABILITIES = 0x100
	EOAC_DEFAULT           EOLE_AUTHENTICATION_CAPABILITIES = 0x800
	EOAC_SECURE_REFS       EOLE_AUTHENTICATION_CAPABILITIES = 0x2
	EOAC_ACCESS_CONTROL    EOLE_AUTHENTICATION_CAPABILITIES = 0x4
	EOAC_APPID             EOLE_AUTHENTICATION_CAPABILITIES = 0x8
	EOAC_DYNAMIC           EOLE_AUTHENTICATION_CAPABILITIES = 0x10
	EOAC_REQUIRE_FULLSIC   EOLE_AUTHENTICATION_CAPABILITIES = 0x200
	EOAC_AUTO_IMPERSONATE  EOLE_AUTHENTICATION_CAPABILITIES = 0x400
	EOAC_DISABLE_AAA       EOLE_AUTHENTICATION_CAPABILITIES = 0x1000
	EOAC_NO_CUSTOM_MARSHAL EOLE_AUTHENTICATION_CAPABILITIES = 0x2000
	EOAC_RESERVED1         EOLE_AUTHENTICATION_CAPABILITIES = 0x4000
)

type IEnumWbemClassObjectVtbl

type IEnumWbemClassObjectVtbl struct {
	QueryInterface uintptr
	AddRef         uintptr
	Release        uintptr
	Reset          uintptr
	Next           uintptr
	NextAsync      uintptr
	Clone          uintptr
	Skip           uintptr
}

IEnumWbemClassObjectVtbl is the IEnumWbemClassObject COM virtual table

type ISCSI_IP_Address

type ISCSI_IP_Address struct {
	Type         uint32
	IpV4Address  uint32
	IpV6Address  [16]uint8
	IpV6FlowInfo uint32
	IpV6ScopeId  uint32
	TextAddress  string
}

type ISCSI_PortalInfo

type ISCSI_PortalInfo struct {
	Index      uint32
	PortalType uint8
	Protocol   uint8
	Reserved1  uint8
	Reserved2  uint8
	IPAddr     *ISCSI_IP_Address
	Port       uint32
	PortalTag  uint16
}

ISCSI_PortalInfo WMI class

type IWbemClassObjectVtbl

type IWbemClassObjectVtbl struct {
	QueryInterface          uintptr
	AddRef                  uintptr
	Release                 uintptr
	GetQualifierSet         uintptr
	Get                     uintptr
	Put                     uintptr
	Delete                  uintptr
	GetNames                uintptr
	BeginEnumeration        uintptr
	Next                    uintptr
	EndEnumeration          uintptr
	GetPropertyQualifierSet uintptr
	Clone                   uintptr
	GetObjectText           uintptr
	SpawnDerivedClass       uintptr
	SpawnInstance           uintptr
	CompareTo               uintptr
	GetPropertyOrigin       uintptr
	InheritsFrom            uintptr
	GetMethod               uintptr
	PutMethod               uintptr
	DeleteMethod            uintptr
	BeginMethodEnumeration  uintptr
	NextMethod              uintptr
	EndMethodEnumeration    uintptr
	GetMethodQualifierSet   uintptr
	GetMethodOrigin         uintptr
}

IWbemClassObjectVtbl is the IWbemClassObject COM virtual table

type IWbemLocatorVtbl

type IWbemLocatorVtbl struct {
	QueryInterface uintptr
	AddRef         uintptr
	Release        uintptr
	ConnectServer  uintptr
}

IWbemLocatorVtbl is the IWbemLocator COM virtual table

type IWbemServicesVtbl

type IWbemServicesVtbl struct {
	QueryInterface             uintptr
	AddRef                     uintptr
	Release                    uintptr
	OpenNamespace              uintptr
	CancelAsyncCall            uintptr
	QueryObjectSink            uintptr
	GetObject                  uintptr
	GetObjectAsync             uintptr
	PutClass                   uintptr
	PutClassAsync              uintptr
	DeleteClass                uintptr
	DeleteClassAsync           uintptr
	CreateClassEnum            uintptr
	CreateClassEnumAsync       uintptr
	PutInstance                uintptr
	PutInstanceAsync           uintptr
	DeleteInstance             uintptr
	DeleteInstanceAsync        uintptr
	CreateInstanceEnum         uintptr
	CreateInstanceEnumAsync    uintptr
	ExecQuery                  uintptr
	ExecQueryAsync             uintptr
	ExecNotificationQuery      uintptr
	ExecNotificationQueryAsync uintptr
	ExecMethod                 uintptr
	ExecMethodAsync            uintptr
}

IWbemServicesVtbl is the IWbemServices COM virtual table

type MSCluster_Property_Resource_IP_Address

type MSCluster_Property_Resource_IP_Address struct {
	Address               string
	DhcpAddress           string
	DhcpServer            string
	DhcpSubnetMask        string
	EnableDhcp            uint32
	EnableNetBIOS         uint32
	LeaseExpiresTime      string
	LeaseObtainedTime     string
	Network               string
	OverrideAddressMatch  uint32
	ProbeFailureThreshold uint32
	ProbePort             uint32
	SubnetMask            string
}

MSCluster_Property_Resource_IP_Address WMI class

type MSCluster_Resource_IP_Address

type MSCluster_Resource_IP_Address struct {
	Caption                   string
	InstallDate               string
	Status                    string
	Flags                     uint32
	Characteristics           uint32
	Name                      string
	Id                        string
	Description               string
	IsAlivePollInterval       uint32
	LooksAlivePollInterval    uint32
	PendingTimeout            uint32
	MonitorProcessId          uint32
	PersistentState           bool
	RestartAction             uint32
	RestartPeriod             uint32
	RestartThreshold          uint32
	EmbeddedFailureAction     uint32
	RetryPeriodOnFailure      uint32
	SeparateMonitor           bool
	Type                      string
	State                     uint32
	ResourceClass             uint32
	Subclass                  uint32
	PrivateProperties         *MSCluster_Property_Resource_IP_Address
	CryptoCheckpoints         []string
	RegistryCheckpoints       []string
	QuorumCapable             bool
	LocalQuorumCapable        bool
	DeleteRequiresAllNodes    bool
	CoreResource              bool
	DeadlockTimeout           uint32
	StatusInformation         uint64
	LastOperationStatusCode   uint64
	ResourceSpecificData1     uint64
	ResourceSpecificData2     uint64
	ResourceSpecificStatus    string
	RestartDelay              uint32
	IsClusterSharedVolume     bool
	RequiredDependencyTypes   []string
	RequiredDependencyClasses []uint32
	OwnerGroup                string
	OwnerNode                 string
}

MSCluster_Resource_IP_Address is a customer MSCluster_Resource WMI class where PrivateProperties is defined as MSCluster_Property_Resource_IP_Address.

func GetClusterIPs

func GetClusterIPs() (clusterIPs []*MSCluster_Resource_IP_Address, err error)

GetClusterIPs enumerates this host's cluster IPs

type MSFC_FibrePortHBAAttributes

type MSFC_FibrePortHBAAttributes struct {
	InstanceName string
	Active       bool
	UniquePortId uint64
	HBAStatus    uint32
	Attributes   *MSFC_HBAPortAttributesResults
}

MSFC_FibrePortHBAAttributes WMI class

func GetMSFC_FibrePortHBAAttributes

func GetMSFC_FibrePortHBAAttributes() (fcPorts []*MSFC_FibrePortHBAAttributes, err error)

GetMSFC_FibrePortHBAAttributes enumerates this host's MSFC_FibrePortHBAAttributes objects

type MSFC_HBAPortAttributesResults

type MSFC_HBAPortAttributesResults struct {
	NodeWWN                     [8]uint8
	PortWWN                     [8]uint8
	PortFcId                    uint32
	PortType                    uint32
	PortState                   uint32
	PortSupportedClassofService uint32
	PortSupportedFc4Types       [32]uint8
	PortActiveFc4Types          [32]uint8
	PortSupportedSpeed          uint32
	PortSpeed                   uint32
	PortMaxFrameSize            uint32
	FabricName                  [8]uint8
	NumberofDiscoveredPorts     uint32
}

MSFC_HBAPortAttributesResults WMI class

type MSFT_Disk

type MSFT_Disk struct {
	// MSFT_StorageObject base class (in the future we might moved supported contained objects)
	ObjectId             string
	PassThroughClass     string
	PassThroughIds       string
	PassThroughNamespace string
	PassThroughServer    string
	UniqueId             string

	// MSFT_Disk
	Path                string
	Location            string
	FriendlyName        string
	UniqueIdFormat      uint16 `wmi:",nil=0xFFFF"`     // If property not available, use 0xFFFF
	Number              uint32 `wmi:",nil=0xFFFFFFFF"` // If property not available, use 0xFFFFFFFF
	SerialNumber        string
	AdapterSerialNumber string
	FirmwareVersion     string
	Manufacturer        string
	Model               string
	Size                uint64
	AllocatedSize       uint64
	LogicalSectorSize   uint32
	PhysicalSectorSize  uint32
	LargestFreeExtent   uint64
	NumberOfPartitions  uint32
	ProvisioningType    uint16
	OperationalStatus   []uint16
	HealthStatus        uint16 `wmi:",nil=0xFFFF"` // If property not available, use 0xFFFF
	BusType             uint16 // See STORAGE_BUS_TYPE
	PartitionStyle      uint16
	Signature           uint32
	Guid                string
	IsOffline           bool
	OfflineReason       uint16
	IsReadOnly          bool
	IsSystem            bool
	IsClustered         bool
	IsBoot              bool
	BootFromDisk        bool
	IsHighlyAvailable   bool
	IsScaleOut          bool
}

MSFT_Disk WMI class

func GetMSFTDisk

func GetMSFTDisk(whereOperator string) (diskDevices []*MSFT_Disk, err error)

GetMSFTDisk enumerates this host's MSFT_Disk objects

func GetNimbleMSFTDisk

func GetNimbleMSFTDisk(serialNumber string) ([]*MSFT_Disk, error)

GetNimbleMSFTDisk enumerates only Nimble volumes

type MSFT_Partition

type MSFT_Partition struct {
	// MSFT_StorageObject base class (in the future we might moved supported contained objects)
	ObjectId             string
	PassThroughClass     string
	PassThroughIds       string
	PassThroughNamespace string
	PassThroughServer    string
	UniqueId             string

	// MSFT_Partition
	DiskId               string
	DiskNumber           uint32 `wmi:",nil=0xFFFFFFFF"` // If property not available, use 0xFFFFFFFF
	PartitionNumber      uint32 `wmi:",nil=0xFFFFFFFF"` // If property not available, use 0xFFFFFFFF
	DriveLetter          uint16
	AccessPaths          []string
	OperationalStatus    uint16
	TransitionState      uint16
	Offset               uint64
	Size                 uint64
	MbrType              uint16
	GptType              string
	Guid                 string
	IsReadOnly           bool
	IsOffline            bool
	IsSystem             bool
	IsBoot               bool
	IsActive             bool
	IsHidden             bool
	IsShadowCopy         bool
	IsDAX                bool
	NoDefaultDriveLetter bool
}

MSFT_Partition WMI class

func GetMSFTPartition

func GetMSFTPartition(whereOperator string) (diskPartitions []*MSFT_Partition, err error)

GetMSFTPartition enumerates this host's MSFTPartition objects

func GetMSFTPartitionForDiskNumber

func GetMSFTPartitionForDiskNumber(diskNumber uint32) (diskPartitions []*MSFT_Partition, err error)

GetMSFTPartitionForDiskNumber enumerates only the given disk's partitions

type MSFT_iSCSITargetPortal

type MSFT_iSCSITargetPortal struct {
	InitiatorInstanceName  string
	InitiatorPortalAddress string
	IsDataDigest           bool
	IsHeaderDigest         bool
	TargetPortalAddress    string
	TargetPortalPortNumber uint16
}

MSFT_iSCSITargetPortal WMI class

func GetMSFTiSCSITargetPortal

func GetMSFTiSCSITargetPortal(whereOperator string) (portals []*MSFT_iSCSITargetPortal, err error)

GetMSFTiSCSITargetPortal enumerates this host's MSFT_iSCSITargetPortal objects

type MSIscsiInitiator_LUNList

type MSIscsiInitiator_LUNList struct {
	OSLunNumber uint32
	TargetLun   uint64
}

MSIscsiInitiator_LUNList WMI class

type MSIscsiInitiator_Portal

type MSIscsiInitiator_Portal struct {
	Index        uint32
	SymbolicName string
	Address      string
	Port         uint16
}

MSIscsiInitiator_Portal WMI class

type MSIscsiInitiator_PortalGroup

type MSIscsiInitiator_PortalGroup struct {
	Index   uint32
	Portals []*MSIscsiInitiator_Portal
}

MSIscsiInitiator_PortalGroup WMI class

type MSIscsiInitiator_TargetLoginOptions

type MSIscsiInitiator_TargetLoginOptions struct {
	Version                  uint32
	InformationSpecified     uint32
	LoginFlags               uint32
	AuthType                 uint32
	HeaderDigest             uint32
	DataDigest               uint32
	MaximumConnectionsuint32 uint32
	DefaultTime2Waituint32   uint32
	DefaultTime2Retainuint32 uint32
	Username                 []uint8
	Password                 []uint8
}

MSIscsiInitiator_TargetLoginOptions WMI class

type MSIscsiInitiator_TargetMappings

type MSIscsiInitiator_TargetMappings struct {
	InitiatorName  string
	TargetName     string
	OSDeviceName   string
	OSBusNumber    uint32
	OSTargetNumber uint32
	LUNList        []*MSIscsiInitiator_LUNList
}

MSIscsiInitiator_TargetMappings WMI class

type MSiSCSIInitiator_TargetClass

type MSiSCSIInitiator_TargetClass struct {
	TargetName         string
	DiscoveryMechanism string
	InitiatorName      string
	ProtocolType       uint32
	TargetAlias        string
	PortalGroups       []*MSIscsiInitiator_PortalGroup
	Mappings           *MSIscsiInitiator_TargetMappings
	TargetFlags        uint32
	LoginOptions       *MSIscsiInitiator_TargetLoginOptions
}

MSiSCSIInitiator_TargetClass WMI class

func GetMSIscsiInitiatorTargetClass

func GetMSIscsiInitiatorTargetClass(whereOperator string) (targets []*MSiSCSIInitiator_TargetClass, err error)

GetMSIscsiInitiatorTargetClass enumerates this host's MSiSCSIInitiator_TargetClass objects

func GetMSIscsiInitiatorTargetClassForTarget

func GetMSIscsiInitiatorTargetClassForTarget(target string) ([]*MSiSCSIInitiator_TargetClass, error)

GetMSIscsiInitiatorTargetClassForTarget enumerates the specific target's MSiSCSIInitiator_TargetClass object.

type MSiSCSI_PortalInfoClass

type MSiSCSI_PortalInfoClass struct {
	InstanceName      string
	Active            bool
	PortalInfoCount   uint32
	PortalInformation []*ISCSI_PortalInfo
}

MSiSCSI_PortalInfoClass WMI class

func GetMSiSCSIPortalInfoClass

func GetMSiSCSIPortalInfoClass() (portals *MSiSCSI_PortalInfoClass, err error)

GetMSiSCSIPortalInfoClass enumerates this host's MSiSCSI_PortalInfoClass object

type STORAGE_BUS_TYPE

type STORAGE_BUS_TYPE uint16

STORAGE_BUS_TYPE defines the supported bus types https://docs.microsoft.com/en-us/previous-versions/windows/hardware/drivers/ff566356(v=vs.85)

const (
	BusTypeUnknown           STORAGE_BUS_TYPE = 0
	BusTypeScsi              STORAGE_BUS_TYPE = 1
	BusTypeAtapi             STORAGE_BUS_TYPE = 2
	BusTypeAta               STORAGE_BUS_TYPE = 3
	BusType1394              STORAGE_BUS_TYPE = 4
	BusTypeSsa               STORAGE_BUS_TYPE = 5
	BusTypeFibre             STORAGE_BUS_TYPE = 6
	BusTypeUsb               STORAGE_BUS_TYPE = 7
	BusTypeRAID              STORAGE_BUS_TYPE = 8
	BusTypeiScsi             STORAGE_BUS_TYPE = 9
	BusTypeSas               STORAGE_BUS_TYPE = 10
	BusTypeSata              STORAGE_BUS_TYPE = 11
	BusTypeSd                STORAGE_BUS_TYPE = 12
	BusTypeMmc               STORAGE_BUS_TYPE = 13
	BusTypeVirtual           STORAGE_BUS_TYPE = 14
	BusTypeFileBackedVirtual STORAGE_BUS_TYPE = 15
	BusTypeSpaces            STORAGE_BUS_TYPE = 16
	BusTypeNvme              STORAGE_BUS_TYPE = 17
	BusTypeSCM               STORAGE_BUS_TYPE = 18
	BusTypeUfs               STORAGE_BUS_TYPE = 19
	BusTypeMax               STORAGE_BUS_TYPE = 20
	BusTypeMaxReserved       STORAGE_BUS_TYPE = 0x7F
)

type WBEM_CONDITION_FLAG_TYPE

type WBEM_CONDITION_FLAG_TYPE uint32

WBEM_CONDITION_FLAG_TYPE contains flags used with the IWbemClassObject::GetNames method.

const (
	WBEM_FLAG_ALWAYS                    WBEM_CONDITION_FLAG_TYPE = 0
	WBEM_FLAG_ONLY_IF_TRUE              WBEM_CONDITION_FLAG_TYPE = 0x1
	WBEM_FLAG_ONLY_IF_FALSE             WBEM_CONDITION_FLAG_TYPE = 0x2
	WBEM_FLAG_ONLY_IF_IDENTICAL         WBEM_CONDITION_FLAG_TYPE = 0x3
	WBEM_MASK_PRIMARY_CONDITION         WBEM_CONDITION_FLAG_TYPE = 0x3
	WBEM_FLAG_KEYS_ONLY                 WBEM_CONDITION_FLAG_TYPE = 0x4
	WBEM_FLAG_REFS_ONLY                 WBEM_CONDITION_FLAG_TYPE = 0x8
	WBEM_FLAG_LOCAL_ONLY                WBEM_CONDITION_FLAG_TYPE = 0x10
	WBEM_FLAG_PROPAGATED_ONLY           WBEM_CONDITION_FLAG_TYPE = 0x20
	WBEM_FLAG_SYSTEM_ONLY               WBEM_CONDITION_FLAG_TYPE = 0x30
	WBEM_FLAG_NONSYSTEM_ONLY            WBEM_CONDITION_FLAG_TYPE = 0x40
	WBEM_MASK_CONDITION_ORIGIN          WBEM_CONDITION_FLAG_TYPE = 0x70
	WBEM_FLAG_CLASS_OVERRIDES_ONLY      WBEM_CONDITION_FLAG_TYPE = 0x100
	WBEM_FLAG_CLASS_LOCAL_AND_OVERRIDES WBEM_CONDITION_FLAG_TYPE = 0x200
	WBEM_MASK_CLASS_CONDITION           WBEM_CONDITION_FLAG_TYPE = 0x300
)

type WBEM_FLAVOR_TYPE

type WBEM_FLAVOR_TYPE uint32

WBEM_FLAVOR_TYPE lists qualifier flavors

const (
	WBEM_FLAVOR_DONT_PROPAGATE                  WBEM_FLAVOR_TYPE = 0
	WBEM_FLAVOR_FLAG_PROPAGATE_TO_INSTANCE      WBEM_FLAVOR_TYPE = 0x1
	WBEM_FLAVOR_FLAG_PROPAGATE_TO_DERIVED_CLASS WBEM_FLAVOR_TYPE = 0x2
	WBEM_FLAVOR_MASK_PROPAGATION                WBEM_FLAVOR_TYPE = 0xf
	WBEM_FLAVOR_OVERRIDABLE                     WBEM_FLAVOR_TYPE = 0
	WBEM_FLAVOR_NOT_OVERRIDABLE                 WBEM_FLAVOR_TYPE = 0x10
	WBEM_FLAVOR_MASK_PERMISSIONS                WBEM_FLAVOR_TYPE = 0x10
	WBEM_FLAVOR_ORIGIN_LOCAL                    WBEM_FLAVOR_TYPE = 0
	WBEM_FLAVOR_ORIGIN_PROPAGATED               WBEM_FLAVOR_TYPE = 0x20
	WBEM_FLAVOR_ORIGIN_SYSTEM                   WBEM_FLAVOR_TYPE = 0x40
	WBEM_FLAVOR_MASK_ORIGIN                     WBEM_FLAVOR_TYPE = 0x60
	WBEM_FLAVOR_NOT_AMENDED                     WBEM_FLAVOR_TYPE = 0
	WBEM_FLAVOR_AMENDED                         WBEM_FLAVOR_TYPE = 0x80
	WBEM_FLAVOR_MASK_AMENDED                    WBEM_FLAVOR_TYPE = 0x80
)

type WBEM_GENERIC_FLAG_TYPE

type WBEM_GENERIC_FLAG_TYPE uint32

WBEM_GENERIC_FLAG_TYPE enumeration is used to indicate and update the type of the flag

const (
	WBEM_FLAG_RETURN_WBEM_COMPLETE   WBEM_GENERIC_FLAG_TYPE = 0x0
	WBEM_FLAG_RETURN_IMMEDIATELY     WBEM_GENERIC_FLAG_TYPE = 0x10
	WBEM_FLAG_FORWARD_ONLY           WBEM_GENERIC_FLAG_TYPE = 0x20
	WBEM_FLAG_NO_ERROR_OBJECT        WBEM_GENERIC_FLAG_TYPE = 0x40
	WBEM_FLAG_SEND_STATUS            WBEM_GENERIC_FLAG_TYPE = 0x80
	WBEM_FLAG_ENSURE_LOCATABLE       WBEM_GENERIC_FLAG_TYPE = 0x100
	WBEM_FLAG_DIRECT_READ            WBEM_GENERIC_FLAG_TYPE = 0x200
	WBEM_MASK_RESERVED_FLAGS         WBEM_GENERIC_FLAG_TYPE = 0x1F000
	WBEM_FLAG_USE_AMENDED_QUALIFIERS WBEM_GENERIC_FLAG_TYPE = 0x20000
	WBEM_FLAG_STRONG_VALIDATION      WBEM_GENERIC_FLAG_TYPE = 0x100000
)

type WBEM_TIMEOUT_TYPE

type WBEM_TIMEOUT_TYPE uint32

WBEM_TIMEOUT_TYPE contains values used to specify the timeout for the IEnumWbemClassObject::Next method

const (
	WBEM_NO_WAIT  WBEM_TIMEOUT_TYPE = 0
	WBEM_INFINITE WBEM_TIMEOUT_TYPE = 0xFFFFFFFF
)

type Win32_DiskDrive

type Win32_DiskDrive struct {
	Availability                uint16
	BytesPerSector              uint32
	Capabilities                []uint16
	CapabilityDescriptions      []string
	Caption                     string
	CompressionMethod           string
	ConfigManagerErrorCode      uint32 `wmi:",nil=0xFFFFFFFF"` // If property not available, use 0xFFFFFFFF
	ConfigManagerUserConfig     bool
	CreationClassName           string
	DefaultBlockSize            uint64
	Description                 string
	DeviceID                    string
	ErrorCleared                bool
	ErrorDescription            string
	ErrorMethodology            string
	FirmwareRevision            string
	Index                       uint32 `wmi:",nil=0xFFFFFFFF"` // If property not available, use 0xFFFFFFFF
	InstallDate                 string
	InterfaceType               string
	LastErrorCode               uint32
	Manufacturer                string
	MaxBlockSize                uint64
	MaxMediaSize                uint64
	MediaLoaded                 bool
	MediaType                   string
	MinBlockSize                uint64
	Model                       string
	Name                        string
	NeedsCleaning               bool
	NumberOfMediaSupported      uint32
	Partitions                  uint32
	PNPDeviceID                 string
	PowerManagementCapabilities []uint16
	PowerManagementSupported    bool
	SCSIBus                     uint32 `wmi:",nil=0xFFFFFFFF"` // If property not available, use 0xFFFFFFFF
	SCSILogicalUnit             uint16 `wmi:",nil=0xFFFF"`     // If property not available, use 0xFFFF
	SCSIPort                    uint16 `wmi:",nil=0xFFFF"`     // If property not available, use 0xFFFF
	SCSITargetId                uint16 `wmi:",nil=0xFFFF"`     // If property not available, use 0xFFFF
	SectorsPerTrack             uint32
	SerialNumber                string
	Signature                   uint32
	Size                        uint64
	Status                      string
	StatusInfo                  uint16
	SystemCreationClassName     string
	SystemName                  string
	TotalCylinders              uint64
	TotalHeads                  uint32
	TotalSectors                uint64
	TotalTracks                 uint64
	TracksPerCylinder           uint32
}

Win32_DiskDrive WMI class

func GetNimbleWin32DiskDrive

func GetNimbleWin32DiskDrive(serialNumber string) ([]*Win32_DiskDrive, error)

GetNimbleWin32DiskDrive enumerates only Nimble volumes

func GetWin32DiskDrive

func GetWin32DiskDrive(whereOperator string) (diskDevices []*Win32_DiskDrive, err error)

GetWin32DiskDrive enumerates this host's Win32_DiskDrive objects

type Win32_DiskPartition

type Win32_DiskPartition struct {
	Access                      uint16
	Availability                uint16
	BlockSize                   uint64
	Bootable                    bool
	BootPartition               bool
	Caption                     string
	ConfigManagerErrorCode      uint32 `wmi:",nil=0xFFFFFFFF"` // If property not available, use 0xFFFFFFFF
	ConfigManagerUserConfig     bool
	CreationClassName           string
	Description                 string
	DeviceID                    string
	DiskIndex                   uint32 `wmi:",nil=0xFFFFFFFF"` // If property not available, use 0xFFFFFFFF
	ErrorCleared                bool
	ErrorDescription            string
	ErrorMethodology            string
	HiddenSectors               uint32
	Index                       uint32 `wmi:",nil=0xFFFFFFFF"` // If property not available, use 0xFFFFFFFF
	InstallDate                 string
	LastErrorCode               uint32
	Name                        string
	NumberOfBlocks              uint64
	PNPDeviceID                 string
	PowerManagementCapabilities []uint16
	PowerManagementSupported    bool
	PrimaryPartition            bool
	Purpose                     string
	RewritePartition            bool
	Size                        uint64
	StartingOffset              uint64
	Status                      string
	StatusInfo                  uint16
	SystemCreationClassName     string
	SystemName                  string
	Type                        string
}

Win32_DiskPartition WMI class

func GetWin32DiskPartition

func GetWin32DiskPartition(whereOperator string) (diskPartitions []*Win32_DiskPartition, err error)

GetWin32DiskPartition enumerates this host's Win32_DiskPartition objects

func GetWin32DiskPartitionForDiskIndex

func GetWin32DiskPartitionForDiskIndex(diskIndex int) ([]*Win32_DiskPartition, error)

GetWin32DiskPartitionForDiskIndex enumerates only the given disk's partitions

type Win32_OperatingSystem

type Win32_OperatingSystem struct {
	BootDevice                                string
	BuildNumber                               string
	BuildType                                 string
	Caption                                   string
	CodeSet                                   string
	CountryCode                               string
	CreationClassName                         string
	CSCreationClassName                       string
	CSDVersion                                string
	CSName                                    string
	CurrentTimeZone                           int16 `wmi:",nil=0x7FFF"` // If property not available, use 0x7FFF
	DataExecutionPrevention_Available         bool
	DataExecutionPrevention_32BitApplications bool
	DataExecutionPrevention_Drivers           bool
	DataExecutionPrevention_SupportPolicy     uint8
	Debug                                     bool
	Description                               string
	Distributed                               bool
	EncryptionLevel                           uint32 `wmi:",nil=0xFFFFFFFF"` // If property not available, use 0xFFFFFFFF
	ForegroundApplicationBoost                uint8  `wmi:",nil=0xFF"`       // If property not available, use 0xFF
	FreePhysicalMemory                        uint64
	FreeSpaceInPagingFiles                    uint64
	FreeVirtualMemory                         uint64
	InstallDate                               string
	LargeSystemCache                          uint32
	LastBootUpTime                            string
	LocalDateTime                             string
	Locale                                    string
	Manufacturer                              string
	MaxNumberOfProcesses                      uint32
	MaxProcessMemorySize                      uint64
	MUILanguages                              []string
	Name                                      string
	NumberOfLicensedUsers                     uint32 `wmi:",nil=0xFFFFFFFF"` // If property not available, use 0xFFFFFFFF
	NumberOfProcesses                         uint32
	NumberOfUsers                             uint32
	OperatingSystemSKU                        uint32
	Organization                              string
	OSArchitecture                            string
	OSLanguage                                uint32
	OSProductSuite                            uint32
	OSType                                    uint16
	OtherTypeDescription                      string
	PAEEnabled                                bool
	PlusProductID                             string
	PlusVersionNumber                         string
	PortableOperatingSystem                   bool
	Primary                                   bool
	ProductType                               uint32
	RegisteredUser                            string
	SerialNumber                              string
	ServicePackMajorVersion                   uint16
	ServicePackMinorVersion                   uint16
	SizeStoredInPagingFiles                   uint64
	Status                                    string
	SuiteMask                                 uint32
	SystemDevice                              string
	SystemDirectory                           string
	SystemDrive                               string
	TotalSwapSpaceSize                        uint64
	TotalVirtualMemorySize                    uint64
	TotalVisibleMemorySize                    uint64
	Version                                   string
	WindowsDirectory                          string
}

Win32_OperatingSystem WMI class

func GetWin32OperatingSystem

func GetWin32OperatingSystem() (operatingSystem *Win32_OperatingSystem, err error)

GetWin32OperatingSystem enumerates this host's Win32_OperatingSystem object

type Win32_Volume

type Win32_Volume struct {
	Access                       uint16
	Automount                    bool
	Availability                 uint16
	BlockSize                    uint64
	BootVolume                   bool
	Capacity                     uint64
	Caption                      string
	Compressed                   bool
	ConfigManagerErrorCode       uint32 `wmi:",nil=0xFFFFFFFF"` // If property not available, use 0xFFFFFFFF
	ConfigManagerUserConfig      bool
	CreationClassName            string
	Description                  string
	DeviceID                     string
	DirtyBitSet                  bool
	DriveLetter                  string
	DriveType                    uint32
	ErrorCleared                 bool
	ErrorDescription             string
	ErrorMethodology             string
	FileSystem                   string
	FreeSpace                    uint64
	IndexingEnabled              bool
	InstallDate                  string
	Label                        string
	LastErrorCode                uint32
	MaximumFileNameLength        uint32
	Name                         string
	NumberOfBlocks               uint64
	PageFilePresent              bool
	PNPDeviceID                  string
	PowerManagementCapabilities  []uint16
	PowerManagementSupported     bool
	Purpose                      string
	QuotasEnabled                bool
	QuotasIncomplete             bool
	QuotasRebuilding             bool
	SerialNumber                 uint32
	Status                       string
	StatusInfo                   uint16
	SupportsDiskQuotas           bool
	SupportsFileBasedCompression bool
	SystemCreationClassName      string
	SystemName                   string
	SystemVolume                 bool
}

Win32_Volume WMI class

func GetWin32Volume

func GetWin32Volume() (volumes []*Win32_Volume, err error)

GetWin32Volume enumerates this host's Win32_Volume objects

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL