Documentation
¶
Index ¶
- Constants
- Variables
- func CloseAllClasses(classes []*WmiClass)
- func CloseAllInstances(instances []*WmiInstance)
- func CloseAllProperties(properties []*WmiProperty)
- func CoInitializeSecurity(authLevel RpcAuthenticationLevel, impLevel RpcImpersonationLevel) (err error)
- func EscapeQueryValue(rawString string) string
- func FindStringInSlice(stringList []string, value string) (int, bool)
- func GetVariantArrayValues(rawValues []ole.VARIANT) ([]interface{}, error)
- func GetVariantValue(rawValue *ole.VARIANT) (interface{}, error)
- func GetVariantValues(rawValue *ole.VARIANT) ([]interface{}, error)
- func PeekMessage(msg *ole.Msg, hwnd uint32, MsgFilterMin uint32, MsgFilterMax uint32, ...) (ret bool, err error)
- type DISPPARAMS
- type DispParams
- type JobState
- type RemoveMessageFlags
- type RpcAuthenticationLevel
- type RpcImpersonationLevel
- type UserAction
- type WbemAuthenticationLevelEnum
- type WbemImpersonationLevel
- type WmiClass
- func (c *WmiClass) Close() error
- func (c *WmiClass) Commit() error
- func (c *WmiClass) GetClassName() string
- func (c *WmiClass) GetDerivation() []string
- func (c *WmiClass) GetMethodsNames() []string
- func (c *WmiClass) GetNamespace() string
- func (c *WmiClass) GetPropertiesNames() []string
- func (c *WmiClass) GetProperty(name string) (interface{}, error)
- func (c *WmiClass) GetQualifiersNames() []string
- func (c *WmiClass) GetServerName() string
- func (c *WmiClass) GetSuperClass() *WmiClass
- func (c *WmiClass) GetSuperClassName() string
- func (c *WmiClass) GetSystemProperty(name string) (*WmiProperty, error)
- func (c *WmiClass) InvokeMethod(methodName string, params ...interface{}) ([]interface{}, error)
- func (c *WmiClass) MakeInstance() (*WmiInstance, error)
- func (c *WmiClass) MethodParameters(methodName string) []string
- func (c *WmiClass) Modify() error
- func (c *WmiClass) SetClassName(name string) error
- func (c *WmiClass) SetProperty(name string, value interface{}) error
- type WmiClassCollection
- type WmiEventSink
- type WmiEventSinkVtbl
- type WmiInstance
- func (c *WmiInstance) Clone() (*WmiInstance, error)
- func (c *WmiInstance) Close() (err error)
- func (c *WmiInstance) Commit() error
- func (c *WmiInstance) Delete() error
- func (c *WmiInstance) EmbeddedInstance() (string, error)
- func (c *WmiInstance) EmbeddedXMLInstance() (string, error)
- func (c *WmiInstance) EnumerateReferencingInstances(resultClassName, sourceRole string) (WmiInstanceCollection, error)
- func (c *WmiInstance) Equals(instance *WmiInstance) bool
- func (c *WmiInstance) GetAllRelated(resultClassName string) (WmiInstanceCollection, error)
- func (c *WmiInstance) GetAllRelatedWithQuery(q *query.WmiQuery) (WmiInstanceCollection, error)
- func (c *WmiInstance) GetAssociated(associatedClassName, resultClassName, resultRole, sourceRole string) (WmiInstanceCollection, error)
- func (c *WmiInstance) GetAssociatedEx(associatedClassName string) (WmiInstanceCollection, error)
- func (c *WmiInstance) GetClass() *WmiClass
- func (c *WmiInstance) GetClassName() string
- func (c *WmiInstance) GetFirstRelatedEx(associatedClassName, resultClassName, resultRole, sourceRole string) (*WmiInstance, error)
- func (c *WmiInstance) GetIDispatch() *ole.IDispatch
- func (c *WmiInstance) GetInstance() (*WmiInstance, error)
- func (c *WmiInstance) GetProperty(name string) (interface{}, error)
- func (c *WmiInstance) GetRawInstance() *ole.VARIANT
- func (c *WmiInstance) GetReferences(associatedClassName string) (WmiInstanceCollection, error)
- func (c *WmiInstance) GetRelated(resultClassName string) (*WmiInstance, error)
- func (c *WmiInstance) GetRelatedEx(associatedClassName, resultClassName, resultRole, sourceRole string) (WmiInstanceCollection, error)
- func (c *WmiInstance) GetSession() *WmiSession
- func (c *WmiInstance) GetSystemProperty(name string) (*WmiProperty, error)
- func (c *WmiInstance) GetWmiHost() *host.WmiHost
- func (c *WmiInstance) GetWmiMethod(methodName string) (*WmiMethod, error)
- func (c *WmiInstance) InstancePath() string
- func (c *WmiInstance) InvokeMethod(methodName string, params ...interface{}) ([]interface{}, error)
- func (c *WmiInstance) InvokeMethodAsync(methodName string, action UserAction, percentComplete, timeoutSeconds uint32, ...) ([]interface{}, error)
- func (c *WmiInstance) InvokeMethodWithReturn(methodName string, params ...interface{}) (int32, error)
- func (c *WmiInstance) Modify() error
- func (c *WmiInstance) Refresh() error
- func (c *WmiInstance) RelativePath() string
- func (c *WmiInstance) ResetProperty(name string) error
- func (c *WmiInstance) SetProperty(name string, value interface{}) error
- func (c *WmiInstance) String() string
- type WmiInstanceCollection
- type WmiJob
- func (job *WmiJob) GetException() error
- func (job *WmiJob) GetJobState() (js JobState)
- func (job *WmiJob) IsComplete() bool
- func (job *WmiJob) JobType() (value int32, err error)
- func (job *WmiJob) PercentComplete() (uint16, error)
- func (job *WmiJob) String() string
- func (job *WmiJob) WaitForAction(action UserAction, percentComplete uint16, timeoutSeconds int16) error
- func (job *WmiJob) WaitForJobCompletion(result int32, timeoutSeconds int16) error
- func (job *WmiJob) WaitForPercentComplete(percentComplete uint16, timeoutSeconds int16) error
- type WmiJobCollection
- type WmiMethod
- type WmiMethodCollection
- type WmiMethodParam
- type WmiMethodParamCollection
- type WmiMethodResult
- type WmiProperty
- type WmiQualifier
- type WmiSession
- func (c *WmiSession) Close()
- func (c *WmiSession) Connect() (bool, error)
- func (c *WmiSession) CreateNewClass() (*WmiClass, error)
- func (c *WmiSession) Credentials() *wmi.Credentials
- func (c *WmiSession) Dispose()
- func (c *WmiSession) EnumerateClasses(className string) ([]*WmiClass, error)
- func (c *WmiSession) EnumerateInstances(className string) ([]*WmiInstance, error)
- func (c *WmiSession) EnumerateReferencingInstances(namespaceName string, sourceInstance WmiInstance, ...) (*[]WmiInstance, error)
- func (c *WmiSession) ExecNotificationQuery(query string) (*WmiSynchronousEventsList, error)
- func (c *WmiSession) ExecNotificationQueryAsync(eventSink *WmiEventSink, query string) (interface{}, error)
- func (c *WmiSession) GetClass(classDefinition string) (*WmiClass, error)
- func (c *WmiSession) GetInstance(path string) (*WmiInstance, error)
- func (c *WmiSession) PerformRawQuery(queryExpression string) (*ole.IEnumVARIANT, error)
- func (c *WmiSession) QueryClasses(queryString string) ([]*WmiClass, error)
- func (c *WmiSession) QueryInstances(queryExpression string) ([]*WmiInstance, error)
- func (c *WmiSession) QueryInstancesEx(query wmi.Query) (*[]wmi.Instance, error)
- func (c *WmiSession) TestConnection() bool
- type WmiSessionManager
- type WmiSynchronousEventsList
Constants ¶
const ( EOAC_NONE tagEOLE_AUTHENTICATION_CAPABILITIES = 0 EOAC_MUTUAL_AUTH tagEOLE_AUTHENTICATION_CAPABILITIES = 0x1 EOAC_STATIC_CLOAKING tagEOLE_AUTHENTICATION_CAPABILITIES = 0x20 EOAC_DYNAMIC_CLOAKING tagEOLE_AUTHENTICATION_CAPABILITIES = 0x40 EOAC_ANY_AUTHORITY tagEOLE_AUTHENTICATION_CAPABILITIES = 0x80 EOAC_MAKE_FULLSIC tagEOLE_AUTHENTICATION_CAPABILITIES = 0x100 EOAC_DEFAULT tagEOLE_AUTHENTICATION_CAPABILITIES = 0x800 EOAC_SECURE_REFS tagEOLE_AUTHENTICATION_CAPABILITIES = 0x2 EOAC_ACCESS_CONTROL tagEOLE_AUTHENTICATION_CAPABILITIES = 0x4 EOAC_APPID tagEOLE_AUTHENTICATION_CAPABILITIES = 0x8 EOAC_DYNAMIC tagEOLE_AUTHENTICATION_CAPABILITIES = 0x10 EOAC_REQUIRE_FULLSIC tagEOLE_AUTHENTICATION_CAPABILITIES = 0x200 EOAC_AUTO_IMPERSONATE tagEOLE_AUTHENTICATION_CAPABILITIES = 0x400 EOAC_NO_CUSTOM_MARSHAL tagEOLE_AUTHENTICATION_CAPABILITIES = 0x2000 EOAC_DISABLE_AAA tagEOLE_AUTHENTICATION_CAPABILITIES = 0x1000 )
const (
RPC_E_TOO_LATE uint32 = 0x80010119
)
const S_FALSE = 0x00000001
Variables ¶
var IID_ISWbemLocator = &ole.GUID{0x76a6415b, 0xcb41, 0x11d1, [8]byte{0x8b, 0x02, 0x00, 0x60, 0x08, 0x06, 0xd9, 0xb6}}
var IID_ISWbemObjectPath = &ole.GUID{0x5791BC27, 0xCE9C, 0x11d1, [8]byte{0x97, 0xBF, 0x00, 0x00, 0xF8, 0x1E, 0x84, 0x9C}}
var IID_ISWbemSinkEvents = &ole.GUID{0x75718CA0, 0xF029, 0x11d1, [8]byte{0xA1, 0xAC, 0x00, 0xC0, 0x4F, 0xB6, 0xC2, 0x23}}
Functions ¶
func CloseAllProperties ¶
func CloseAllProperties(properties []*WmiProperty)
func CoInitializeSecurity ¶
func CoInitializeSecurity(authLevel RpcAuthenticationLevel, impLevel RpcImpersonationLevel) (err error)
func EscapeQueryValue ¶
func GetVariantArrayValues ¶
func GetVariantArrayValues(rawValues []ole.VARIANT) ([]interface{}, error)
func GetVariantValue ¶
func GetVariantValue(rawValue *ole.VARIANT) (interface{}, error)
func GetVariantValues ¶
func GetVariantValues(rawValue *ole.VARIANT) ([]interface{}, error)
func PeekMessage ¶
func PeekMessage(msg *ole.Msg, hwnd uint32, MsgFilterMin uint32, MsgFilterMax uint32, RemoveMsg RemoveMessageFlags) (ret bool, err error)
PeekMessage in message queue from runtime.
This function appears to block. PeekMessage does not block.
Types ¶
type DISPPARAMS ¶
type DISPPARAMS struct {
// contains filtered or unexported fields
}
DISPPARAMS are the arguments that passed to methods or property.
type DispParams ¶
type DispParams struct {
// contains filtered or unexported fields
}
func GetDispParamsFromRaw ¶
func GetDispParamsFromRaw(dispparams *DISPPARAMS) *DispParams
type JobState ¶ added in v0.1.5
type JobState int
JobState
const ( // New enum JobState_Unknown JobState = 0 // New enum JobState_New JobState = 2 // Starting enum JobState_Starting JobState = 3 // Running enum JobState_Running JobState = 4 // Suspended enum JobState_Suspended JobState = 5 // Shutting_Down enum JobState_Shutting_Down JobState = 6 // Completed enum JobState_Completed JobState = 7 // Terminated enum JobState_Terminated JobState = 8 // Killed enum JobState_Killed JobState = 9 // Exception enum JobState_Exception JobState = 10 // Service enum JobState_Service JobState = 11 // Query_Pending enum JobState_Query_Pending JobState = 12 // DMTF_Reserved enum JobState_DMTF_Reserved JobState = 13 // Vendor_Reserved enum JobState_Vendor_Reserved JobState = 14 )
type RemoveMessageFlags ¶
type RemoveMessageFlags uint32
const ( PM_NOREMOVE RemoveMessageFlags = 0 PM_REMOVE RemoveMessageFlags = 1 PM_NOYIELD RemoveMessageFlags = 2 )
type RpcAuthenticationLevel ¶
type RpcAuthenticationLevel uint32
const ( RPC_C_AUTHN_LEVEL_DEFAULT RpcAuthenticationLevel = 0 RPC_C_AUTHN_LEVEL_NONE RpcAuthenticationLevel = 1 RPC_C_AUTHN_LEVEL_CONNECT RpcAuthenticationLevel = 2 RPC_C_AUTHN_LEVEL_CALL RpcAuthenticationLevel = 3 RPC_C_AUTHN_LEVEL_PKT RpcAuthenticationLevel = 4 RPC_C_AUTHN_LEVEL_PKT_INTEGRITY RpcAuthenticationLevel = 5 RPC_C_AUTHN_LEVEL_PKT_PRIVACY RpcAuthenticationLevel = 6 )
type RpcImpersonationLevel ¶
type RpcImpersonationLevel uint32
const ( RPC_C_IMP_LEVEL_DEFAULT RpcImpersonationLevel = 0 RPC_C_IMP_LEVEL_ANONYMOUS RpcImpersonationLevel = 1 RPC_C_IMP_LEVEL_IDENTIFY RpcImpersonationLevel = 2 RPC_C_IMP_LEVEL_IMPERSONATE RpcImpersonationLevel = 3 RPC_C_IMP_LEVEL_DELEGATE RpcImpersonationLevel = 4 )
type UserAction ¶
type UserAction uint32
const ( None UserAction = 0 Async UserAction = 1 Wait UserAction = 2 Cancel UserAction = 3 Default UserAction = 4 )
type WbemAuthenticationLevelEnum ¶
type WbemAuthenticationLevelEnum uint32
type WbemImpersonationLevel ¶
type WbemImpersonationLevel uint32
type WmiClass ¶
type WmiClass struct {
// contains filtered or unexported fields
}
func CreateWmiClass ¶
func CreateWmiClass(classVar *ole.VARIANT, session *WmiSession) (*WmiClass, error)
func (*WmiClass) GetProperty ¶
GetProperty gets the property of the instance specified by name and returns in value
func (*WmiClass) GetSystemProperty ¶
func (c *WmiClass) GetSystemProperty(name string) (*WmiProperty, error)
func (*WmiClass) InvokeMethod ¶
Invoke static method on a wmi class
func (*WmiClass) MakeInstance ¶
func (c *WmiClass) MakeInstance() (*WmiInstance, error)
Makes a new instance of the class
func (*WmiClass) MethodParameters ¶
MethodParameters
func (*WmiClass) SetProperty ¶
SetProperty sets a value of property representation by name with value
type WmiClassCollection ¶ added in v0.24.2
type WmiClassCollection []*WmiClass
WmiInstanceCollection is a slice of WmiClass
func (*WmiClassCollection) Close ¶ added in v0.24.2
func (wmic *WmiClassCollection) Close()
Close all class in a collection
type WmiEventSink ¶
type WmiEventSink struct {
// contains filtered or unexported fields
}
func CreateWmiEventSink ¶
func CreateWmiEventSink(session *WmiSession, callbackContext interface{}, onObjectReady func(interface{}, []*WmiInstance), onCompleted func(interface{}, []*WmiInstance), onProgress func(interface{}, []*WmiInstance), onObjectPut func(interface{}, []*WmiInstance)) (*WmiEventSink, error)
func (*WmiEventSink) Close ¶
func (c *WmiEventSink) Close()
func (*WmiEventSink) Connect ¶
func (c *WmiEventSink) Connect() (cookie uint32, err error)
func (*WmiEventSink) GetAndDispatchMessages ¶
func (c *WmiEventSink) GetAndDispatchMessages()
func (*WmiEventSink) IsClosed ¶ added in v0.1.3
func (c *WmiEventSink) IsClosed() bool
func (*WmiEventSink) IsReadyToClose ¶
func (c *WmiEventSink) IsReadyToClose() bool
func (*WmiEventSink) PeekAndDispatchMessages ¶
func (c *WmiEventSink) PeekAndDispatchMessages() bool
type WmiEventSinkVtbl ¶
type WmiEventSinkVtbl struct {
// contains filtered or unexported fields
}
type WmiInstance ¶
type WmiInstance struct {
// contains filtered or unexported fields
}
WmiInstance is a representation of a WMI instance
func CreateWmiInstance ¶
func CreateWmiInstance(instanceVar *ole.VARIANT, session *WmiSession) (*WmiInstance, error)
func (*WmiInstance) Clone ¶ added in v0.1.2
func (c *WmiInstance) Clone() (*WmiInstance, error)
Clone
func (*WmiInstance) EmbeddedInstance ¶
func (c *WmiInstance) EmbeddedInstance() (string, error)
EmbeddedInstance
func (*WmiInstance) EmbeddedXMLInstance ¶ added in v0.1.2
func (c *WmiInstance) EmbeddedXMLInstance() (string, error)
EmbeddedXMLInstance
func (*WmiInstance) EnumerateReferencingInstances ¶
func (c *WmiInstance) EnumerateReferencingInstances(resultClassName, sourceRole string) (WmiInstanceCollection, error)
EnumerateReferencingInstances
func (*WmiInstance) GetAllRelated ¶
func (c *WmiInstance) GetAllRelated(resultClassName string) (WmiInstanceCollection, error)
GetAllRelated
func (*WmiInstance) GetAllRelatedWithQuery ¶ added in v0.1.2
func (c *WmiInstance) GetAllRelatedWithQuery(q *query.WmiQuery) (WmiInstanceCollection, error)
GetAllRelatedWithQuery returns all related instances matching the query
func (*WmiInstance) GetAssociated ¶
func (c *WmiInstance) GetAssociated(associatedClassName, resultClassName, resultRole, sourceRole string) (WmiInstanceCollection, error)
GetAssociated
func (*WmiInstance) GetAssociatedEx ¶ added in v0.1.5
func (c *WmiInstance) GetAssociatedEx(associatedClassName string) (WmiInstanceCollection, error)
func (*WmiInstance) GetFirstRelatedEx ¶ added in v0.2.2
func (c *WmiInstance) GetFirstRelatedEx(associatedClassName, resultClassName, resultRole, sourceRole string) (*WmiInstance, error)
GetFirstRelatedEx
func (*WmiInstance) GetIDispatch ¶ added in v0.1.2
func (c *WmiInstance) GetIDispatch() *ole.IDispatch
func (*WmiInstance) GetInstance ¶
func (c *WmiInstance) GetInstance() (*WmiInstance, error)
GetInstance returns the latest Instance
func (*WmiInstance) GetProperty ¶
func (c *WmiInstance) GetProperty(name string) (interface{}, error)
GetProperty gets the property of the instance specified by name and returns in value
func (*WmiInstance) GetRawInstance ¶ added in v0.1.2
func (c *WmiInstance) GetRawInstance() *ole.VARIANT
func (*WmiInstance) GetReferences ¶ added in v0.1.5
func (c *WmiInstance) GetReferences(associatedClassName string) (WmiInstanceCollection, error)
GetReferences
func (*WmiInstance) GetRelated ¶
func (c *WmiInstance) GetRelated(resultClassName string) (*WmiInstance, error)
GetRelated
func (*WmiInstance) GetRelatedEx ¶
func (c *WmiInstance) GetRelatedEx(associatedClassName, resultClassName, resultRole, sourceRole string) (WmiInstanceCollection, error)
GetRelatedEx
func (*WmiInstance) GetSession ¶ added in v0.1.2
func (c *WmiInstance) GetSession() *WmiSession
func (*WmiInstance) GetSystemProperty ¶
func (c *WmiInstance) GetSystemProperty(name string) (*WmiProperty, error)
func (*WmiInstance) GetWmiHost ¶ added in v0.1.2
func (c *WmiInstance) GetWmiHost() *host.WmiHost
func (*WmiInstance) GetWmiMethod ¶ added in v0.1.2
func (c *WmiInstance) GetWmiMethod(methodName string) (*WmiMethod, error)
func (*WmiInstance) InvokeMethod ¶
func (c *WmiInstance) InvokeMethod(methodName string, params ...interface{}) ([]interface{}, error)
InvokeMethod
func (*WmiInstance) InvokeMethodAsync ¶
func (c *WmiInstance) InvokeMethodAsync(methodName string, action UserAction, percentComplete, timeoutSeconds uint32, params ...interface{}) ([]interface{}, error)
InvokeMethodAsync
func (*WmiInstance) InvokeMethodWithReturn ¶
func (c *WmiInstance) InvokeMethodWithReturn(methodName string, params ...interface{}) (int32, error)
InvokeMethodWithReturn invokes a method with return
func (*WmiInstance) ResetProperty ¶
func (c *WmiInstance) ResetProperty(name string) error
ResetProperty resets a property
func (*WmiInstance) SetProperty ¶
func (c *WmiInstance) SetProperty(name string, value interface{}) error
SetProperty sets a value of property representation by name with value
func (*WmiInstance) String ¶ added in v0.1.5
func (c *WmiInstance) String() string
type WmiInstanceCollection ¶
type WmiInstanceCollection []*WmiInstance
WmiInstanceCollection is a slice of WmiInstance
func GetVariantArrayAsWmiInstances ¶
func GetVariantArrayAsWmiInstances(rawValues []ole.VARIANT, session *WmiSession) (WmiInstanceCollection, error)
func (*WmiInstanceCollection) Close ¶ added in v0.1.2
func (wmic *WmiInstanceCollection) Close()
Close all instances in a collection
func (*WmiInstanceCollection) EmbeddedXMLInstances ¶ added in v0.1.5
func (wmic *WmiInstanceCollection) EmbeddedXMLInstances() (xmls []string, err error)
type WmiJob ¶ added in v0.1.5
type WmiJob struct {
*WmiInstance
}
func NewWmiJob ¶ added in v0.1.5
func NewWmiJob(instance *WmiInstance) (*WmiJob, error)
func (*WmiJob) GetException ¶ added in v0.1.5
func (*WmiJob) GetJobState ¶ added in v0.1.5
func (*WmiJob) IsComplete ¶ added in v0.1.5
func (*WmiJob) PercentComplete ¶ added in v0.1.5
PercentComplete
func (*WmiJob) WaitForAction ¶ added in v0.1.5
func (job *WmiJob) WaitForAction(action UserAction, percentComplete uint16, timeoutSeconds int16) error
WaitForAction waits for the task based on the action type, percent complete and timeoutSeconds
func (*WmiJob) WaitForJobCompletion ¶ added in v0.1.5
type WmiJobCollection ¶ added in v0.1.5
type WmiJobCollection []*WmiJob
func (*WmiJobCollection) Close ¶ added in v0.1.5
func (c *WmiJobCollection) Close() error
type WmiMethod ¶ added in v0.1.2
type WmiMethod struct { Name string // contains filtered or unexported fields }
func NewWmiMethod ¶ added in v0.1.2
func NewWmiMethod(methodName string, instance *WmiInstance) (*WmiMethod, error)
NewWmiMethod
func (*WmiMethod) Execute ¶ added in v0.1.2
func (c *WmiMethod) Execute(inParam, outParam WmiMethodParamCollection) (result *WmiMethodResult, err error)
type WmiMethodCollection ¶ added in v0.1.2
type WmiMethodCollection []*WmiMethod
func (*WmiMethodCollection) Close ¶ added in v0.1.2
func (c *WmiMethodCollection) Close() error
type WmiMethodParam ¶ added in v0.1.2
type WmiMethodParam struct { Name string Value interface{} }
func NewWmiMethodParam ¶ added in v0.1.2
func NewWmiMethodParam(name string, val interface{}) *WmiMethodParam
func NewWmiMethodParam(name string, val interface{}, propertyVariant *ole.VARIANT, session *WmiSession) (*WmiMethodParam, error) {
type WmiMethodParamCollection ¶ added in v0.1.2
type WmiMethodParamCollection []*WmiMethodParam
func (*WmiMethodParamCollection) Close ¶ added in v0.1.2
func (c *WmiMethodParamCollection) Close() error
type WmiMethodResult ¶ added in v0.1.5
type WmiMethodResult struct { ReturnValue int32 OutMethodParams map[string]*WmiMethodParam }
type WmiProperty ¶
type WmiProperty struct {
// contains filtered or unexported fields
}
func CreateWmiProperty ¶
func CreateWmiProperty(propertyVariant *ole.VARIANT, session *WmiSession) (*WmiProperty, error)
type WmiQualifier ¶
type WmiQualifier struct { }
type WmiSession ¶
type WmiSession struct { ServerName string Namespace string Username string Password string Domain string WMIHost *host.WmiHost Status wmi.SessionStatus RawSession *ole.VARIANT Session *ole.IDispatch CimwmiService *ole.IDispatch }
WmiSession struct to hold the current session information
func CreateSession ¶
func CreateSession(CimwmiService *ole.IDispatch, wmiNamespace, serverName, domain, userName, password string) (*WmiSession, error)
CreateSession creates a new session with the server and namespace
func CreateSessionEx ¶
func CreateSessionEx(CimwmiService *ole.IDispatch, serverName, wmiNamespace string, credentials wmi.Credentials) (*WmiSession, error)
CreateSessionEx creates a session based on credentials
func (*WmiSession) CreateNewClass ¶
func (c *WmiSession) CreateNewClass() (*WmiClass, error)
Tells WMI to create a new class for us
func (*WmiSession) EnumerateClasses ¶
func (c *WmiSession) EnumerateClasses(className string) ([]*WmiClass, error)
EnumerateClasses
func (*WmiSession) EnumerateInstances ¶
func (c *WmiSession) EnumerateInstances(className string) ([]*WmiInstance, error)
EnumerateInstances
func (*WmiSession) EnumerateReferencingInstances ¶
func (c *WmiSession) EnumerateReferencingInstances(namespaceName string, sourceInstance WmiInstance, associationClassName, sourceRole string) (*[]WmiInstance, error)
EnumerateReferencingInstances
func (*WmiSession) ExecNotificationQuery ¶
func (c *WmiSession) ExecNotificationQuery(query string) (*WmiSynchronousEventsList, error)
Synchronous approach to handling events Documentation: https://docs.microsoft.com/en-us/windows/win32/wmisdk/receiving-synchronous-and-semisynchronous-event-notifications
func (*WmiSession) ExecNotificationQueryAsync ¶
func (c *WmiSession) ExecNotificationQueryAsync(eventSink *WmiEventSink, query string) (interface{}, error)
Asynchronous approach to handling events Documentation: https://docs.microsoft.com/en-us/windows/win32/wmisdk/receiving-synchronous-and-semisynchronous-event-notifications Security considerations with Asynchronous calls: https://docs.microsoft.com/en-us/windows/win32/wmisdk/making-an-asynchronous-call-with-vbscript
func (*WmiSession) GetClass ¶
func (c *WmiSession) GetClass(classDefinition string) (*WmiClass, error)
func (*WmiSession) GetInstance ¶
func (c *WmiSession) GetInstance(path string) (*WmiInstance, error)
GetInstance
func (*WmiSession) PerformRawQuery ¶
func (c *WmiSession) PerformRawQuery(queryExpression string) (*ole.IEnumVARIANT, error)
func (*WmiSession) QueryClasses ¶
func (c *WmiSession) QueryClasses(queryString string) ([]*WmiClass, error)
QueryClasses
func (*WmiSession) QueryInstances ¶
func (c *WmiSession) QueryInstances(queryExpression string) ([]*WmiInstance, error)
QueryInstances
func (*WmiSession) QueryInstancesEx ¶
QueryInstancesEx
type WmiSessionManager ¶
type WmiSessionManager struct {
// contains filtered or unexported fields
}
func NewWmiSessionManager ¶
func NewWmiSessionManager() *WmiSessionManager
func (*WmiSessionManager) Dispose ¶
func (c *WmiSessionManager) Dispose()
Dispose clears the WmiSessionManager
func (*WmiSessionManager) GetLocalSession ¶
func (c *WmiSessionManager) GetLocalSession(wmiNamespace string) (*WmiSession, error)
GetLocalSession
func (*WmiSessionManager) GetSession ¶
func (c *WmiSessionManager) GetSession(wmiNamespace, serverName, domain, userName, password string) (*WmiSession, error)
GetSession
type WmiSynchronousEventsList ¶
type WmiSynchronousEventsList struct {
// contains filtered or unexported fields
}
func CreateWmiSynchronousEventsList ¶
func CreateWmiSynchronousEventsList(instanceVar *ole.VARIANT, session *WmiSession) *WmiSynchronousEventsList
func (*WmiSynchronousEventsList) Close ¶
func (c *WmiSynchronousEventsList) Close()
func (*WmiSynchronousEventsList) WaitForNextEvent ¶
func (c *WmiSynchronousEventsList) WaitForNextEvent() (*WmiInstance, error)
func (*WmiSynchronousEventsList) WaitForNextEventUntil ¶
func (c *WmiSynchronousEventsList) WaitForNextEventUntil(timeout int32) (*WmiInstance, error)