| 
	
		|  Autor | Tema: Mapeo de impresoras en red por usuarioa  (Leído 24,672 veces) |  
	| 
			| 
					
						| efer27 
								
								 Desconectado 
								Mensajes: 27
								
								
								
								
								
								   | 
 
Hola, 
 ya revise los permisos y estan correcto pero no logro que el error no salga, no me elimina las impresoras que tengo mapeadas para luego agregarlas, ufff debe ser algo tonto pero no lo veo aun.
 
 saludos
 
 
 
 |  
						| 
								|  |  
								|  |  En línea | 
 
 |  |  |  | 
			| 
					
						| Novlucker 
								Ninja y 
								Colaborador
								      Desconectado 
								Mensajes: 10.683
								 
								Yo que tu lo pienso dos veces
								
								
								
								
								
								   | 
 
Por si acaso abre una consola con permisos de administrador, y desde ahí ejecuta el script.
 Saludos
 
 
 |  
						| 
								|  |  
								|  |  En línea | 
 
 Contribuye con la limpieza del foro, reporta los "casos perdidos" a un MOD XD"Hay dos cosas infinitas: el Universo y la estupidez  humana. Y de la primera no estoy muy seguro."
 Albert Einstein |  |  |  | 
			| 
					
						| efer27 
								
								 Desconectado 
								Mensajes: 27
								
								
								
								
								
								   | 
 
Hola, si lo ejecute con permisos pero el error continua lo que hice fue lo siguiente.
 
 Eliminar impresoras de RED
 
 strComputer = "."
 Set WshNetwork = WScript.CreateObject("WScript.Network")
 Set objShell = CreateObject("Wscript.Shell")
 Set objWMIService = GetObject("winmgmts:" _
 & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
 Set colInstalledPrinters = objWMIService.ExecQuery _
 ("Select * from Win32_Printer")
 For Each objPrinter in colInstalledPrinters
 if InStr(objPrinter.Name, "\\")> 0 then
 WshNetwork.RemovePrinterConnection objPrinter.Name
 end if
 Next
 
 Ahora me falta agregarlas.
 
 eh estado probando que leea desde un archivo plano pero no puedo lograrlo
 es decir tengo el siguiente txt.
 
 ouprueba1 \\server\printer
 ouprueba2 \\server\printer
 ouprueba3 \\server\printer
 
 quiero que leea este archivo y lo compare con las ou que tengo en el active directory si pertenece el ou comparando con el txt que agregue la impresora.
 
 a ver si me puedes ayudar yo sigo probando y te comento mis avances.
 
 saludos
 
 |  
						| 
								|  |  
								|  |  En línea | 
 
 |  |  |  | 
			| 
					
						| efer27 
								
								 Desconectado 
								Mensajes: 27
								
								
								
								
								
								   | 
 
Hola,
 eh estado revisando y es lo que tengo hasta el momento en algo me equivoco al momento de conectar
 
 Elimina correctamente, hace el array pero no puedo agregarlo a ver si alguien me ayuda.
 
 Gracias por la pasciencia.
 
 -------------------------------------------------------------------------
 
 'Set global script objects and variables
 Set wshShell = WScript.CreateObject("WScript.Shell")
 Set wshNetwork = WScript.CreateObject("WScript.Network")
 Set wshObj = WScript.CreateObject("Scripting.FileSystemObject")
 
 'Variables
 strNetworkPath = "C:\Copia de impresoras1.txt"
 
 
 '-----------------------------------------------------------------------------'
 Eliminar impresora
 
 'On Error Resume Next
 
 Call DisconnectNetworkPrinters()
 MsgBox "Ejecuta asignar prn"
 Call ConnectPrinters(strNetworkPath, wshNetwork.computername)
 
 Sub DisconnectNetworkPrinters()
 Set arPrinters = wshNetwork.EnumPrinterConnections
 
 For i = 0 to (arPrinters.Count - 1) Step 2
 If (Left(arPrinters.Item(i + 1), 2) = "\\") Then
 wshNetwork.RemovePrinterConnection arPrinters.Item(i + 1)
 End If
 Next
 End Sub
 
 '--------------------------------------------------------------------------------'
 Conectar impresoras
 
 Sub ConnectPrinters(strListFile, strCompname)
 Dim arrLinParts()
 Dim strCadTratar
 Set ListFile = wshObj.OpenTextFile(strListFile, 1)
 
 Do While ListFile.AtEndOfStream <> True
 strCadTratar = ListFile.ReadLine
 arrLineParts = Split(strCadTratar, Space(1))
 
 MsgBox strCompname & " " & strCadTratar
 If UCase(strCompname) = UCase(arrLineParts(0)) Then
 
 For i = 0 To UBound(arrLineParts)
 If arrLineParts(i) <> "" Then
 wshNetwork.AddWindowsPrinterConnection UCase(arrLineParts(i))
 End If
 Next
 
 If arrLineParts(1) <> "" Then
 wshNetwork.SetDefaultPrinter UCase(arrLineParts(1))
 End If
 End If
 Loop
 
 ListFile.Close
 End Sub
 |  
						| 
								|  |  
								|  |  En línea | 
 
 |  |  |  | 
			| 
					
						| efer27 
								
								 Desconectado 
								Mensajes: 27
								
								
								
								
								
								   | 
 
Hola, 
 Alguien me puede ayudar ??
 |  
						| 
								|  |  
								|  |  En línea | 
 
 |  |  |  |  |  
 
	
 
 
				
					
						| Mensajes similares |  
						|  | Asunto | Iniciado por | Respuestas | Vistas | Último mensaje |  
						|   |   | Mapeo de Fichero ASM
 | Иōҳ | 3 | 4,481 |  10 Diciembre 2011, 12:38 pm por Eternal Idol
 |  
						|   |   | Mapeo de unidades de red desconectadas. Redes
 | Chernova | 0 | 2,733 |  24 Mayo 2012, 14:53 pm por Chernova
 |  
						|   |   | mapeo de red con foca Redes
 | Pirat3net | 0 | 1,885 |  25 Octubre 2012, 14:57 pm por Pirat3net
 |  
						|   |   | mapeo de programa Hacking
 | c3r0x | 4 | 3,674 |  8 Marzo 2014, 00:30 am por unknwn
 |  
						|   |   | Dudas sobre el mapeo de IPs moviles Hacking
 | Helix | 2 | 4,145 |  25 Noviembre 2020, 19:10 pm por Helix
 |    |