lib/hawatel_ps/windows/wmi/wmi_cli.rb
def connect_to_namespace
        if @session.nil?
          locator = WIN32OLE.new("WbemScripting.SWbemLocator")
          @session = locator.ConnectServer('.', @namespace)
        end
      rescue WIN32OLERuntimeError => ex
        raise WmiCliException, :exception => ex, :message => "Cannot connect to namespace '#{@namespace}'."
      end
# Connect to the WMI on the local server
# @example
#   connect_to_namespace
# @raise [WIN32OLERuntimeError] if problem with connection to the local server
# @return [WIN32OLE]
Connect to the WMI on the local server
Connect to the WMI on the local server
def connect_to_namespace
        if @session.nil?
          locator = WIN32OLE.new("WbemScripting.SWbemLocator")
          @session = locator.ConnectServer('.', @namespace)
        end
      rescue WIN32OLERuntimeError => ex
        raise WmiCliException, :exception => ex, :message => "Cannot connect to namespace '#{@namespace}'."
      end
def connect_to_namespace if @session . nil? locator = WIN32OLE . new ( "WbemScripting.SWbemLocator" ) @session = locator . ConnectServer ( '.' , @namespace ) end rescue WIN32OLERuntimeError => ex raise WmiCliException , :exception => ex , :message => "Cannot connect to namespace '#{@namespace}'." end
Connect to the WMI on the local server
Connect to the WMI on the local server
None
WIN32OLE
[WIN32OLERuntimeError] if problem with connection to the local server
[ WIN32OLERuntimeError ] if problem with connection to the local server
example
None