salar info del registro de las impresoras

Estado
Cerrado para nuevas respuestas

alukard82bcn

Nuevo Miembro
Miembro
#3
bueno ya tengo mi script acabado, para que no digais que soy un rancio :D:

dim fso

dim aux

dim file

dim f

dim fc

dim fs

dim f3

dim wshshell

Const ForReading = 1

Set WshShell = WScript.CreateObject("WScript.Shell")

Set fso = CreateObject("Scripting.FileSystemObject")

set fs = CreateObject ("scripting.filesystemobject")

set f = fs.getfolder("c:\home")

set fc = f.subfolders

dim networks

dim onetfs, fprint

Set oNetFS = CreateObject("WScript.Network")

set fs = CreateObject("Scripting.FileSystemObject")

If fs.FileExists("l:\networks\net" & oNetFS.ComputerName) Then

fs.deletefile ("l:\networks\net" & oNetFS.ComputerName)

end if

Set fprint = fs.CreateTextFile("c:\temp\net" & oNetFS.ComputerName, True)

'for each user ...

for each f3 in fc

'if the user is the current (administrator) user.

if ucase(f3.name) = ucase(onetfs.username) then

'nothing to do

else

'sets the path for the user registry file

path = "C:\documents and settings\" & f3.name & "\ntuser.dat"

'load the user registry at hklm\"username"

wshshell.run "cmd /k cd c:\ & c:\winnt\system32\reg.exe load " & chr(34) & "C:\Documents and Settings\" & f3.name &"\NTUSER.dat" & chr(34) & " hklm\" & f3.name & " & exit",0,true

'get the user's networks

networks = Getnetworks(f3.name)

If (networks <> "") Then

'WScript.Echo "linea" & networks

fprint.writeline (networks)

End if

end if

next

fprint.close

for each f3 in fc

if ucase(f3.name) = ucase(onetfs.username) then

else

path = "C:\documents and settings\" & f3.name & "\ntuser.dat"

'unload the user registry

wshshell.run ("cmd /k cd c:\ & c:\winnt\system32\reg.exe unload hklm\" & f3.name & " & exit "),0,true



end if

next

function Getnetworks (user)

const HKEY_LOCAL_MACHINE = &H80000002

const REG_SZ = 1

const REG_EXPAND_SZ = 2

const REG_BINARY = 3

const REG_DWORD = 4

const REG_MULTI_SZ = 7

dim arrValueNames ()

strComputer = "."

linea=""

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_

strComputer & "\root\default:StdRegProv")



strKeyPath = user &"\Network\"

oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys



if Not isNull(arrSubkeys) Then

'WScript.Echo "aaaaaaa"

For Each subkey In arrSubKeys

'WScript.echo subkey

strKeyPath = user &"\Network\" & subkey

oReg.EnumValues HKEY_LOCAL_MACHINE, strKeyPath, arrValueNames, arrValueTypes

if Not isNull(arrValueNames) then

For Each entry in arrValueNames

'WScript.Echo entry

If entry= "RemotePath" Then

oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,entry,strValue_name

oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,arrValueNames(i),strValue

'WScript.Echo "---------->" & strvalue

If (linea="") Then

linea=user & "#" & subkey & "#" & strvalue

'WScript.Echo "............" & linea

Else

linea=linea & "#" & subkey & "#" & strvalue

'WScript.Echo ",,,,,,,,,,,," & linea

End If

End if

next

end If

next



End If

'WScript.Echo "ººººººººººººº" & linea

Getnetworks = linea

end Function

alukard82bcn@hotmail.com
 
Estado
Cerrado para nuevas respuestas
Arriba Pie