Página 1 de 1

Particiones del equipo

Publicado: 29 Abr 2017 20:35
por Nolramado
Buenas
alguien conoce alguna forma de obtener una lista de las letras de unidades o particiones montadas en un equipo con LUA
digamos = C:, D:, E: asi
muchas gracias

Re: Particiones del equipo

Publicado: 29 Abr 2017 22:56
por Dow Sher

Re: Particiones del equipo

Publicado: 30 Abr 2017 00:28
por Nolramado
muchas gracias dowsher, pero me referia a LUA no a Autoplay

Re: Particiones del equipo

Publicado: 30 Abr 2017 09:07
por iwantlearninf
first you need luacom to execute wmi

require( "luacom" )

luacom.config.abort_on_API_error = true
luacom.config.abort_on_error = false

if arg[1] == nil then
	computer = "."
else
	computer = arg[1]
end

function display( objval )
	if objval == nil then
		return ""
	end
	if type( objval ) == "table" then
		return table.concat( objval, ";" )
	end
	return tostring( objval )
end

objWMIService = luacom.GetObject( "winmgmts:{impersonationLevel=Impersonate}!//"..computer.."/root/CIMV2" )
objSWbemRefresher = luacom.CreateObject( "WbemScripting.SWbemRefresher" )
objSWbemRefresher.AutoReconnect = 1
refobjCIM_StorageVolume = objSWbemRefresher:AddEnum( objWMIService, "CIM_StorageVolume" )
objSWbemRefresher:Refresh( )
objCIM_StorageVolumeEnum = luacom.GetEnumerator( refobjCIM_StorageVolume.ObjectSet )

objSWbemRefresher:Refresh( )
objCIM_StorageVolumeEnum:Reset( )
test = refobjCIM_StorageVolume.ObjectSet.Count
if test == 1 then
	print( "1 instance:" )
else
	print( test.." instances:" )
end
print( )

objSWbemRefresher:Refresh( )
objCIM_StorageVolumeEnum:Reset( )
item = objCIM_StorageVolumeEnum:Next( )
while item do
	print( "DriveLetter                  : "..display( item:DriveLetter( ) ) )
	print( )
	item = objCIM_StorageVolumeEnum:Next( )
end
item = nil
collectgarbage( )

objWMIService = nil
objSWbemRefresher = nil
refobjCIM_StorageVolume = nil
objCIM_StorageVolumeEnum = nil
collectgarbage( )



HIDE: ON
Hidebb Message Hidden Description


if you dont want to use luacom you can use cmd or powershell execute using lua
and you can use also the io command when executing cmd or powershell

Re: Particiones del equipo

Publicado: 11 May 2017 21:37
por CHACKAL
Funciono? Lo checare

Re: Particiones del equipo

Publicado: 02 Ago 2018 19:27
por luasqlite
Gracias :pc:

Re: Particiones del equipo

Publicado: 13 Ago 2018 14:13
por sendai
thanks

Re: Particiones del equipo

Publicado: 13 Ago 2018 14:21
por sendai
thanks

Re: Particiones del equipo

Publicado: 12 Abr 2019 04:13
por electrobyte
gracias

Re: Particiones del equipo

Publicado: 06 Ago 2019 07:53
por RolandoLT
:friends:

Re: Particiones del equipo

Publicado: 12 Oct 2019 14:06
por sendai
gracias

Re: Particiones del equipo

Publicado: 21 Oct 2020 13:31
por jhonitimer
thank you

Re: Particiones del equipo

Publicado: 23 Oct 2020 22:06
por mecivic
Thanks