elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Entrar al Canal Oficial Telegram de elhacker.net


  Mostrar Mensajes
Páginas: 1 ... 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 [713] 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 ... 1236
7121  Programación / Scripting / Re: [APORTE] [VBS] Añade una ventana Debug para tus scripts! en: 16 Abril 2014, 16:38 pm
¿Un debugger casero y económico para VBS?, ¡simplemente me parece genial!

PD: Benditos gurús de SO que tienen tiempo para sacar estas ideas xD.
7122  Sistemas Operativos / Windows / Re: Tutorial: Instalar "Windows To Go" en: 16 Abril 2014, 16:30 pm
Genial tuto, me gusta la forma en la que lo has redactado (ojalá se me diera la redacción igual de bien a mi xD).

Gracias por compartir.
Saludos!
7123  Programación / Scripting / Re: Programa en batch (Herramientas utiles nivel medio-Avanzado) en: 15 Abril 2014, 20:13 pm
Citar
Código:
echo ß    contrasena basica de todas las opciones:17                    ß
echo ß    conexiones y composicion de IP "1001.2213.100.0.1"            ß
echo ß    para hack basico y compuesto de cuentas online "http"         ß
echo ß    para hack basico y compuesto de juegos online "shirp"         ß
echo ß    para hack basico y compuesto de conexiones y redes "FTP"      ß
echo ß                                                                  ß
echo ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
echo ß     (TUS OPCIONES)                                               ß
echo ß   1-Servicio de Ping.                                            ß
echo ß   2-Servicio de FTP.                                             ß
echo ß   3-informacion de sistema                                       ß
echo ß   4-informacion de puertos habilitados y desabilitados           ß
echo ß   5-                                                             ß
echo ß   6-abrir los registros de hadwares y software(regedit)          ß
echo ß   7-                                                             ß
echo ß   8-                                                             ß
echo ß   9-Aprende a usar FTP, STP Y HTP                                ß


( Bueno, daré mi crítica constructiva respecto al código, especialmente la parte de arriba que he citado. )


Esto te lo digo sin ánimo de ofender, pero es la verdad, podría darte muchos motivos por el cual el Script no se puede tomar en serio, pero te comentaré la razón principal:
Si quieres que alguien te pueda tomar en serio ...como mínimo debes saber de lo que estás hablando, y lo que estás intentando hacer.


1. El rango máximo de una dirección IPv4 es 255.255.255.255, no "1001.2213.100.0.1" (¿eso que es?).

2. Los protocolos "STP" y "HTP" no existen, te debes estar refiriendo a "SFTP" y "HTTP".

3. El comando externo FTP.exe de Microsoft no soporta Secure FTP y tampoco existe nada en Batch para manejar HTTP, por lo tanto esa parte del Script es una tontería.

4. La idea de desarrollar un Keylogger en Batch es simplemente absurda (ya sea un Batch-Script híbrido usando VBS) necesitas usar un lenguaje que pueda usar la API de Windows (Ej: VB.NET).

5. Sobre "hack básico" prefiero ahorrarme demasiados comentarios, pero bueno, todo el mundo se lo puede imaginar...
   Con un ping no haces "hack", la herramienta ping.exe de Microsoft no sirve para hacer un POD ni ningún otro tipo de ataque, ya que solo envia un par de paquetes, no los envía simultaneamente, y los paquetes no están cifrados, el comando externo ping.exe sirve para hacer Ping, nada más.

6. Teniendo en cuenta los puntos que he mencionado, el título que le pusiste al tema es "Herramientas utiles nivel medio-Avanzado", ¿estás hablando en serio?.
    Me da la sensación de que has tropezado con la peor piedra del camino, esa pieda que te hace creer saber sobre un tema específico a nivel "avanzado".

7. Para desarrollar un Script y/o aplicación a la que se pueda referir como "Utilidad de "hack" básico y herramientas utiles nivel medio-Avanzado", lo último que se debe utilizar es el simple Batch, no está capacitado, debes usar un lenguaje de verdad.

8. Hay un pequeño error de escritura, donde debería poner Hardware pusiste hadwares (otro detalle a mencionar es que el término Hardware es singular, no plurarl), yo no me puedo tomar un código en serio en donde todos los terminos importantes están mal escritos.

9.  Dices que para navegar por el menú o usar no se que opciones hay que especificar una contraseña, pero dicha contraseña la especificas claramente en el menú ...eso no tiene ningún sentido.

10. Si esperas que alguien te facilite el 99% de un código incompleto que resultaría muy laborioso (e imposible) entonces este no es el lugar, aquí ayudamos en todo lo posible, pero no hacemos trabajos.


Siento decir muchas cosas negativas y ninguna positiva, pero por más que leo el código no puedo encontrar nada positivo y hay ciertas cosas que me sacan de mis casillas, lo siento mucho.

Si decides cambiar tu forma de pensar y sobretodo el lenguaje en el que piensas trabajar entonces ya podré decir dos cosas buenas sobre esto, porque por ahora el código "avanzado" no es más que una noobatada cosa sin sentido (no pretendo ofender, me he tomado minutos en escribir este post con la intención de ayudar y abrirte los ojos).


PD: El icono se debe usar cuando un tema haya quedado resuelto, no se debe usar al publicar un tema.


Saludos!
7124  Sistemas Operativos / Windows / Re: Guía de personalización de imágenes de implementación de Windows (WIM) (Parte 1) en: 15 Abril 2014, 05:19 am
Excelente siempre he anelado saber esto te felicito por este gran aporte. Estoy ansioso de aprender con las nuevas entregas.

Gracias por tu interés.

PD: Por si no lo habias en el foro:

· Guía de personalización de imágenes de implementación de Windows (WIM) (Parte 2)
· Guía de personalización de imágenes de implementación de Windows (WIM) (Parte 3)
· Guía de personalización de imágenes de implementación de Windows (WIM) (Parte 4)
· Guía de personalización de imágenes de implementación de Windows (WIM) (Parte 5)

Aun tengo que publicar más :)

Saludos!
7125  Programación / Scripting / Re: Ayuda con Batch en: 15 Abril 2014, 04:29 am
1. Está prohibido los títulos tipo "ayuda", un título debe ser descriptivo, fíjate en la edición del nuevo título.



la pregunta es, como se puede realizar un bat que lea las 6 direcciones de Targets.txt y las ingrese en cada .doc ?

No puedes realizar esa operación de esa manera, un documento doc/docx es un archivo binario, no un archivo de texto plano, olvídate del simple Batch.

Aquí está explicado el modo de leer un archivo DOC de manera Raw (byte a byte): http://msdn.microsoft.com/en-us/library/gg615596%28v=office.14%29.aspx#UnderstandMS_DOC_ExtractText

Necesitas usar un lenguaje (un lenguaje de verdad, no Batch) orientado a objetos, que esté capacitado para la tarea y utilizaar las Classes que ofrezca el lenguaje, el componene ActiveX de Word o librerías de terceros que sean capaces de manipular documentos de Office, o como última opción puede añadir bytes de forma manual al documentos.

VisualBasic.NET sería una gran opción al ser de Microsoft, compatibilidad y sencillez de uso gracias a sus Classes.

Otra opción más simple sería usar VisualBasicScript.

Add Formatted Text to a Word Document

Código
  1. Set objWord = CreateObject("Word.Application")
  2.  
  3. objWord.Visible = True
  4. Set objDoc = objWord.Documents.Add()
  5. Set objSelection = objWord.Selection
  6.  
  7. objSelection.Font.Name = "Arial"
  8. objSelection.Font.Size = "18"
  9. objSelection.TypeText "Network Adapter Report"
  10. objSelection.TypeParagraph()
  11.  
  12. objSelection.Font.Size = "14"
  13. objSelection.TypeText "" & Date()
  14. objSelection.TypeParagraph()

Cabe mencionar que un requisito esencial (a menos que se usen librerías de terceros capacitadas) es disponer de MSWord instalado (instalación original, nada de portables), ya que este te instala los controles ActiveX (Word.Application) para la manipulación de documentos usando el lenguaje VBS.

Yo no tengo el Office instalado porque no me agrada el producto, así que si vas a usar VisualBasicScript yo solo te puedo indicar el modo de leer y procesar las direcciones IP del archivo de texto que las contiene:

Código
  1. File = ".\Targets.txt"
  2. IPS  = Split(CreateObject("Scripting.FileSystemObject").OpenTextFile(File, 1).ReadAll, VBCrlf)
  3.  
  4. For Each IP in IPS
  5.    Wscript.Echo IP
  6. Next
  7.  
  8. Wscript.Quit(0)

Saludos
7126  Sistemas Operativos / Windows / Re: Guía de personalización de imágenes de implementación de Windows (WIM) (Parte 1) en: 15 Abril 2014, 04:03 am
Entonces WAIK es para versiones windows 7 (funciona para ambas arquitecturas??) y WADK es para windows 8 cierto?? creo que podrias enfatizar ese punto en tus puntos explicatorios, pues se me hace algo confuso que paquete utilizar.

WAIK es para windows 7 y anteriores por lo tanto no se recomienda el uso para manipular Windows 8, en mi experiencia las herramientas de DISM del WAIK funcionan para Windows 8, pero por ejemplo otras como WSIM indican que el sistema operativo (Windows 8) es incompatible con la versión actual de WSIM.

En resumen, si vas a manipular una ISO de Windows 7, usa WAIK, si vas a manipular Windows +8, usa WADK.

Sistemas operativos compatibles con la instalación del paquete Windows ADK:
• Windows® 8
• Windows® 7
• Windows Vista®
• Windows Server® 2008
• Windows Server® 2008 R2
• Windows Server® 2012

Sistemas operativos compatibles con la instalación del paquete Windows AIK (para Windows 7)
• Windows 7
• Windows Vista SP1
• Windows Server 2003 with Service Pack 2
• Windows Server 2008
• Windows Server 2008 R2


Citar
(funciona para ambas arquitecturas??)
Si, traen herramientas de 32 y 64 Bits.


Citar
estos son los paquetes necesarios para el WAIK con Windows 7?
Solo este: The Windows® Automated Installation Kit (AIK) for Windows® 7
Los otros dos que dijiste solo es documentación del paquete.


Citar
Realmente hay diferencias entre windows 8 y windows 8.1???

Sabes que hay diferencias de opiniones entre todos los que usamos Windows, por mi parte yo valoro a Windows 7 como el SO estándar perfecto para cualquier PC, pero por otro lado en mi caso el SO perfecto para mis necesidades y uso habitual es Windows 8.1.

Windows 8.1 es una actualización (no una Upgrade) que se puede conseguir gratis para los que usan Windows 8 (aquí está explicado: http://windows.microsoft.com/en-us/windows-8/update-from-windows-8-tutorial), y como toda actualización que mejora el SO ...conviene tenerla instalada, así que para ser sinceros el mayor motivo por el cual uso windows 8.1 en lugar de usar Windows 8 es por estar actualizado y usar un SO con el potencial de hoy en día.

Pero Windows 8.1 tiene cambios importantes en la personalización, el más popular es el nuevo botón de inicio, que aunque sea una *****, es mucho mejor que no tener nada y esto la gente lo agradecerá, y el resto de cambios la mayoria son para las aplicaciones/interfaz Metro, lo cual a mi la verdad no me interesa en absoluto.
· Windows 8.1: A complete list of changes and new features

Pero aparte de eso, hay cambios más internos, Windows 8 instala el framework 4.5 mientras que Windows 8.1 trae .NET Framework 4.5.1 instalado por defecto, y esto me sirve como programador de VB.NET para explotar las nuevas Classes del 4.5.1 (aunque el VisualStudio 2013 te instala este framework via online, prefiero tenerlo instalado por defecto en el SO para poder ejecutar aplicaciones compiladas para el 4.5.1)
· Diferencias entre .Net framework 4.5 y .NET Framework 4.5.1
· Windows 8.1: New APIs and features for developers


Citar
yo me sigo quedando con Windows 7 x64 Profesional, por el simple hecho de que es el mejor para juegos. Crees que Windows 8/8.1 apuntara a eso también algún día??
Windows 7 el mejor SO para juegos?, en que sentido? ...para explotar la capacidad Gamer? Donde has leido tal cosa?

No me considero muy gamer, aunque tengo cientos de portables antiguos, juegos de emuladores, y me he pasado juegos de última generación como el Tomb Raider, el último Assasin's Creed, el Call of Dutty Ghosts, y otros juegos "del momento" que requieren mucho potencial de Hardware, como ya digo no soy muy gamer pero si que puedo hablar de juegos, y para ser sinceros yo no creo que el SO afecte más de un 10% al rendimiento de un juego, es obvio qu si tienes decenas de programas en ejecución y servicios de Windows inútiles puede influir bastante negatívamente, pero esto no lo veo como algo que dependa del SO, sino más bien del usuario y el modo en que este emplea el SO, así pues en mi opinión teniendo una buena gráfica y una buena configuración de rendimiento en el SO... creo que te va a ir igual de bien ya sea Windows 7 o Windows 8.
A mi todos los juegos me van perfectos en Windows 8.1 y puedo exprimir la calidad visual de los gráficos, pero en Windows 7 me iban con los FPS lentos y casi no podia ni jugar, supongo que la mejora tambien se debe a que hice una renovación de los componentes de mi PC xD.


Citar
Me quede pensando en el DISM, es lo que usas tú no???
Si, es el requisito esencial y te lo instala el WAIK/WADK.

PD: ya sea en el lenguaje que sea todas las aplicaciones necesitan usar DISM (como el WinToolkit del que te hablé)


Saludos!
7127  Programación / Programación General / Re: (consulta) terminos en: 15 Abril 2014, 02:47 am
Hola.

Dispones de todo lo necesario para aprender CSharp en la documentación de MSDN, solo tienes que buscar.


· void    (C# Reference)
· static  (C# Reference)
· private (C# Reference)
· public  (C# Reference)
· Accessibility Levels (C# Reference)
· Static Classes and Static Class Members


Resumídamente:

Generálmente Void se usa para especificar que un método no devuelve un valor (un método que devuelve un valor es una Función y por lo tanto se debe especificar el tipo de retorno de datos del método (Ej: Int))

Private: Modificador de acceso para especificar que el miembro solo es visible desde la Class donde lo declaraste.
Public: Modificador de acceso para especificar que el miembro no tiene restricciones de visibilidad (es decir, puedes acceder a él desde otras Classes y ensamblados).
Static: No tengo muy claro el concepto de este Keyword en C# (yo soy de VB.NET y el uso es distinto).

PD: Las consultas de C# deben formularse en al subforo de .NET.



EDITO:
Para Java, obviamente también tienes la documentación online de este lenguaje en la web de Oracle.

· Language Basics

· Learning the Java Language

Saludos
7128  Programación / .NET (C#, VB.NET, ASP) / Re: timer + webbrowser en vb.net en: 14 Abril 2014, 12:32 pm
Para esta y el resto de preguntas sencillas que se deberían aprender leyendo lo básico, MSDN.

· WebBrowser Class > WebBrowser Methods
· Timer Class > Timer Methods

Saludos!
7129  Programación / Scripting / [APORTE] [BATCH] WIM Resource Replacer en: 14 Abril 2014, 05:51 am
Este Script sirve para automatizar la tarea de montar una imagen WIM de Windows y reemplazar recursos de imágenes (bmp/ico) en las librerías de recursos de la instalación de Windows, así como también sirve para reemplazar archivos.

Ejemplo de los recursos a los que me refiero:



Se necesitan unos requisitos y dependencias para usar este Script:
· Saber de lo que estoy hablando.
· Conocer el nombre de los recursos que quieres reemplazar y disponer de tus imágenes ya modificados (obviamente).
· Dism e ImageX (WAIK/WADK).
· Anolis Resourcer > http://www.anol.is/resourcer/


Las instrucciones de uso y un extenso tutorial lo publiqué en este otro tema: http://foro.elhacker.net/windows/guia_de_personalizacion_de_imagenes_de_implementacion_de_windows_wim_parte_4-t412468.0.html así que lo haré de nuevo de manera resumida: solo tienen que escribir en un archivo de texto delimitando por puntoycomas los recursos que quieren reemplazar, el nombre del recurso y el índice, así como los archivos que quieran reemplazar, y configurar las variables documentadas del Script (La ubicación de la imagen, el directorio de montaje, etc...)

Nota: Ver el ejemplo del archivo delimitado dentro del enlace de abajo o en las instrucciones extendidas del enlace de arriba.

Todo lo necesario está incluido en este archivo comprimido:
http://www.mediafire.com/download/ktzms7i09qt4n2b/wim+resource+replacer+0.2.rar

Imágenes:


(Código corregido, el otro que subí estaba incompleto)
WIM Resource Replacer.cmd
Código
  1. @Echo OFF
  2.  
  3.  
  4.  
  5. REM =================
  6. REM Console Settings:
  7. REM =================
  8.  
  9. Title WIM Resource Replacer - By Elektro
  10. Mode Con Cols=150 Lines=50
  11. CHCP 1252 1>NUL & REM Windows-1252, Spanish-Latin.
  12.  
  13.  
  14.  
  15. REM =====
  16. REM Info:
  17. REM =====
  18.  
  19. Echo  --------------------------------------------------------------------------------------------------
  20. Echo  This script mounts a Windows Image ^(WIM^) and then replaces image resources inside resource files
  21. Echo  --------------------------------------------------------------------------------------------------
  22.  
  23.  
  24.  
  25. REM ====================
  26. REM User defined values:
  27. REM ====================
  28.  
  29. REM This value indicates whether the Windows Image should be mounted.
  30. REM True  = 'DISM' will try to mount the 'WIM' image.
  31. REM False = 'DISM' will not try to mount the WIM image.
  32. REM Set this value to 'FALSE' if the 'WIM' image is already mounted in the specified mount directory,
  33. REM Otherwise, keep it as 'TRUE'.
  34. Set "MountImage=True"
  35.  
  36. REM This value indicates whether the Windows Image should be unmounted at the end.
  37. REM True  = 'DISM' will try to unmount the 'WIM' image.
  38. REM False = 'DISM' will not try to unmount the WIM image.
  39. REM Set this value to 'FALSE' if you want to keep the image mounted to make other changes,
  40. REM Otherwise, keep it as 'TRUE'.
  41. Set "UnmountImage=True"
  42.  
  43. REM This value indicates whether the Windows Image should be rebuilt at the end.
  44. REM True  = 'ImageX' will try to rebuild the 'WIM' image.
  45. REM False = 'ImageX' will keep the 'WIM' image as is.
  46. REM Set this value to 'FALSE' if you want to keep the image with normal size to make other changes,
  47. REM Otherwise, keep it as 'TRUE'.
  48. Set "Rebuild=True"
  49.  
  50. REM This value indicates whether the Windows Image should be cleaned-up at the end.
  51. REM True  = 'Dism' will try to CleanUp the 'WIM' image components.
  52. REM False = 'Dism' will keep the 'WIM' image as is.
  53. REM Set this value to 'FALSE' if you want to keep the image with normal size to make other changes,
  54. REM Otherwise, keep it as 'TRUE'.
  55. Set "CleanUp=True"
  56.  
  57. REM This value indicates the 'WIM' image to be mounted.
  58. Set "WindowsImage=%UserProfile%\Desktop\win 8 .1\win\sources\Boot.wim"
  59.  
  60. REM This value indicates the Image Index of the 'WIM' image.
  61. Set "ImageIndex=2"
  62.  
  63. REM This value indicates the directory where to mount the 'WIM' image.
  64. Set "MountDir=%HomeDrive%\WinBootMount"
  65.  
  66. REM This value indicates the ubication of Anolis Resourcer 'Anolis.exe' file.
  67. Set "Anolis=%CD%\Tools\Anolis.exe"
  68.  
  69. REM This value indicates the textfile that contains the Recource files to replace.
  70. Set "ResourceList=%CD%\Resources.txt"
  71.  
  72. REM This value indicates the ubication of 'ImageX.exe' file.
  73. Set "ImageX=%CD%\Tools\Dism\ImageX.exe"
  74.  
  75. REM This value indicates the ubication of a custom 'DISM.exe' file if needed.
  76. REM Default ubication: "%SystemRoot%\System32\Dism.exe"
  77. Set "Dism=%CD%\Tools\Dism\Dism.exe"
  78.  
  79. REM This value indicates the ubication of the logfile that will record 'DISM' errors.
  80. Set "DismLogfile=%CD%\%~n0 DISM.log"
  81.  
  82. REM This value indicates the logging-level of the 'DISM' process.
  83. REM 1 = Errors only
  84. REM 2 = Errors and warnings
  85. REM 3 = Errors, warnings, and informational
  86. REM 4 = All of the information listed previously, plus debug output
  87. Set /A "DismLogLevel=2"
  88.  
  89. REM This value indicates the ubication of the logfile that will record Main information.
  90. Set "Logfile=%CD%\%~n0.log"
  91.  
  92.  
  93.  
  94. REM =====
  95. REM Main:
  96. REM =====
  97.  
  98. :: Call Methods.
  99. Call :CheckErrors
  100. Call :CreateLogs
  101. Call :CreateMountDir
  102. Call :GetWIMSizeBefore
  103. Call :StartTimer
  104. Call :Mount
  105. CLS
  106. Call :ParseResources
  107. Call :Unmount
  108. Call :StopTimer
  109. Call :GetWIMSizeAfter
  110. Call :EndLog
  111. Pause&Exit
  112.  
  113.  
  114.  
  115. REM ========
  116. REM Methods:
  117. REM ========
  118.  
  119. :CreateLogs
  120. :: Create the 'DISM' logfile with 'ANSI' encoding,
  121. :: this is necessary to record a non-default 'DISM' loglevel such as '1' or '2'.
  122. Echo+ >"%Logfile%"
  123.  
  124. :: Create the Main Logfile and record starting info on it.
  125. (
  126. Echo    WIM Resource Replacer
  127. Echo ===========================
  128. Echo   %DATE% ^| %TIME:~0,-3%
  129. Echo /\/\/\/\/\/\/\/\/\/\/\/\/\/
  130. Echo [i] Mount Image?...: %MountImage%
  131. Echo [i] Unmount Image?.: %UnmountImage%
  132. Echo [i] CleanUp Image?.: %CleanUp%
  133. Echo [i] Rebuild Image?.: %Rebuild%
  134. Echo [i] Windows Image..: %WindowsImage%
  135. Echo [i] Image Index....: %ImageIndex%
  136. Echo [i] Mount Directory: %MountDir%
  137. Echo [i] ImageX Path....: %ImageX%
  138. Echo [i] Dism Path......: %Dism%
  139. Echo [i] Dism Log File..: %DismLogfile%
  140. Echo [i] Dism Log Level.: %DismLogLevel%
  141. Echo [i] Anolis Path....: %Anolis%
  142. Echo [i] Resource List..: %ResourceList%
  143. Echo [i] Log File.......: %LogFile%
  144. Echo ===========================
  145. )>"%Logfile%"
  146.  
  147. :: Display starting log info.
  148. Type "%Logfile%"
  149.  
  150. :: Continue writting log.
  151. (
  152. Echo Resource conflicts:
  153. Echo ===================
  154. )>>"%LogFile%"
  155.  
  156. Goto:EOF
  157.  
  158.  
  159. :EndLog
  160. (
  161. Echo [i] Done!
  162. Echo [i] WIM Size Before....: %WIMSizeBefore%
  163. Echo [i] WIM Size After.....: %WIMSizeAfter%
  164. Echo [i] Resources Success..: %ResourceSuccessCount% files.
  165. Echo [i] Resources Failed...: %ResourceFailsCount% files.
  166. Echo [i] Resources Not Found: %ResourceNotFoundCount% files.
  167. Echo [i] Files Added........: %FilesAddedCount% files.
  168. Echo [i] Files Failed.......: %FilesFailsCount% files.
  169. Echo [i] Files Not Found....: %FilesNotFoundCount% files.
  170. Echo [i] Elapsed Time.......: %ElapsedTime%
  171. )>>"%LogFile%"
  172.  
  173. :: Display ending information.
  174. CLS
  175. Type "%LogFile%"
  176. Goto:EOF
  177.  
  178.  
  179. :CreateMountDir
  180. :: Create the mount directory.
  181. (
  182. If Not Exist "%MountDir%" If /I "%MountImage%" EQU "True" (
  183. MkDir "%MountDir%" 2>NUL
  184. )
  185. ) || (
  186. Echo [x] Error trying to create the directory "%MountDir%" to mount the Windows Image.
  187. Echo [i] Ensure that you have Admin rights to create the directory.
  188. Echo [i] Ensure that the directory name does not contains illegal characters.
  189. Pause&Exit
  190. )
  191. Goto:EOF
  192.  
  193.  
  194. :Mount
  195. :: Mount the Windows Image into the directory.
  196. Echo [+] Mounting WIM Image...
  197. If /I "%MountImage%" EQU "True" (
  198.  
  199. "%Dism%" /Mount-Image /ImageFile:"%WindowsImage%" /Index:"%ImageIndex%" /MountDir:"%MountDir%" /English /LogPath:"%DismLogfile%" /LogLevel:"%DismLogLevel%" || (
  200. Echo [x] Error mounting the Image Index "%ImageIndex%" in "%MountDir%"
  201. Echo [i] Ensure that the Image Index exist.
  202. Echo [i] Ensure that you have Admin rights to write inside the directory.
  203. Echo [i] Ensure that the directory is not already mounted.
  204. Echo [i] Ensure that the directory is fully empty.
  205. REM Try to unmount the failed image and discard changes.
  206. If /I "%UnmountImage%" EQU "True" (
  207. Echo [+] Unmounting and discarding changes...
  208. "%Dism%" /Unmount-WIM /Discard /MountDir:"%MountDir%"
  209. )
  210. Pause&Exit
  211. )
  212.  
  213. )
  214. Goto:EOF
  215.  
  216.  
  217. :CleanUp
  218. Echo [+] CleaningUp WIM Image...
  219. "%Dism%" /CleanUp-Image /StartComponentCleanUp /Image:"%MountDir%" /English /LogPath:"%DismLogfile%" /LogLevel:"%DismLogLevel%" /Quiet
  220. Goto:EOF
  221.  
  222.  
  223. :Unmount
  224. :: Unmount the Windows Image commiting changes.
  225. Echo [+] Unmounting WIM Image...
  226. If /I "%UnmountImage%" EQU "True" (
  227. "%Dism%" /Unmount-WIM /Commit /MountDir:"%MountDir%" /English /LogPath:"%DismLogfile%" /LogLevel:"%DismLogLevel%"
  228. )
  229. Goto:EOF
  230.  
  231.  
  232. :Rebuild
  233. If /I "%Rebuild%" EQU "False" (Goto:EOF)
  234.  
  235. Echo [+] Rebuilding WIM image...
  236.  
  237. ("%ImageX%" /Compress Maximum /Export "%WindowsImage%" "*" "%TEMP%\Rebuilt Image.wim" /Check) && (
  238. Del /Q /F "%WindowsImage%" 1>NUL
  239. Move /Y "%TEMP%\Rebuilt Image.wim" "%WindowsImage%" 1>NUL
  240. ) || (
  241. Echo [x] Error rebuilding Image "%WindowsImage%" to "%TEMP%\Rebuilt Image.wim".
  242. )
  243.  
  244. Goto :EOF
  245.  
  246.  
  247. :StartTimer
  248. Set "StartingDate=%Date%"
  249. Set "StarttingTime=%Time:~0,-3%"
  250. Goto :EOF
  251.  
  252.  
  253. :StopTimer
  254. (
  255. Echo Minutes = DateDiff^("n", "%StartingDate% %StarttingTime%", Now^)
  256. Echo WScript.Echo Minutes ^& " Minutes"
  257. )>"%TEMP%\%~n0 MinuteDiff.vbs"
  258.  
  259. For /F "Tokens=*" %%# In (
  260. 'Cscript.exe /Nologo "%TEMP%\%~n0 MinuteDiff.vbs"'
  261. ) Do (
  262. Set "ElapsedTime=%%#"
  263. )
  264.  
  265. Goto:EOF
  266.  
  267.  
  268. :WriteConvertBytesScript
  269. If Exist "%TEMP%\%~n0 Convert Bytes.vbs" (Goto:EOF)
  270. (
  271. Echo Suffix = Array^("Bytes", "KB", "MB", "GB", "TB"^)
  272. Echo Function Convert^(Bytes^)
  273. Echo Convert = convert0^(Bytes, 0^)
  274. Echo End Function
  275. Echo Function Convert0^(Bytes, Level^)
  276. Echo If Bytes ^>= 1024 Then
  277. Echo Bytes = Round^(Bytes / 1024, 2^)
  278. Echo Level = Level + 1
  279. Echo Convert0 = Convert0^(Bytes, Level^)
  280. Echo End If
  281. Echo Convert0 = Bytes ^& " " ^& Suffix^(Level^)
  282. Echo End Function
  283. Echo WScript.Echo Convert^(WScript.Arguments^(0^)^)
  284. )>"%TEMP%\%~n0 Convert Bytes.vbs"
  285. Goto:EOF
  286.  
  287.  
  288. :GetWIMSizeBefore
  289. Call :WriteConvertBytesScript
  290. For %%# in ("%WindowsImage%") Do (Set "WIMSizeBefore=%%~z#")
  291. For /F "Tokens=*" %%# In (
  292. 'Cscript.exe /Nologo "%TEMP%\%~n0 Convert Bytes.vbs" "%WIMSizeBefore%"'
  293. ) Do (
  294. Set "WIMSizeBefore=%%#"
  295. )
  296. Del /Q "%TEMP%\%~n0 Convert Bytes.vbs"
  297. Goto:EOF
  298.  
  299.  
  300. :GetWIMSizeAfter
  301. Call :WriteConvertBytesScript
  302. For %%# in ("%WindowsImage%") Do (Set "WIMSizeAfter=%%~z#")
  303. For /F "Tokens=*" %%# In (
  304. 'Cscript.exe /Nologo "%TEMP%\%~n0 Convert Bytes.vbs" "%WIMSizeAfter%"'
  305. ) Do (
  306. Set "WIMSizeAfter=%%#"
  307. )
  308. Del /Q "%TEMP%\%~n0 Convert Bytes.vbs"
  309. Goto:EOF
  310.  
  311.  
  312. :TakeOwn
  313. (
  314. Takeown.exe /F "%~f1"
  315. ICacls.exe "%~f1" /Grant "%UserName%":"F"
  316. Attrib.exe -R -A -S -H -I "%~f1"
  317. )>NUL || (Exit /B 1)
  318. Goto:EOF
  319.  
  320.  
  321. :ParseResources
  322. Set /A "ResourceSuccessCount=0"
  323. Set /A "ResourceFailsCount=0"
  324. Set /A "ResourceNotFoundCount=0"
  325. Set /A "FilesAddedCount=0"
  326. Set /A "FilesFailsCount=0"
  327. Set /A "FilesNotFoundCount=0"
  328.  
  329. For /F "UseBackQ Tokens=1,2,* Delims=;" %%a In ("%ResourceList%") Do (
  330.  
  331. If /I "%%~xa" EQU ".dll" (Call :ReplaceResource "%MountDir%\%%~a" "%%~b" "%%~c")
  332. If /I "%%~xa" NEQ ".dll" (Call :CopyFile        "%MountDir%\%%~a" "%%~b")
  333.  
  334. )
  335. Goto:EOF
  336.  
  337.  
  338. :CopyFile
  339. If Not Exist "%~2" (
  340. Echo Can't locate file to copy from: "%~2">>"%LogFile%"
  341. Set /A "FilesNotFoundCount+=1"
  342. Goto:EOF
  343. )
  344.  
  345. Call :TakeOwn "%~f1" || (
  346. Echo Unable to grant file permissions in file: "%~1">>"%Logfile%"
  347. Set /A "FilesFailsCount+=1"
  348. Goto:EOF
  349. )
  350.  
  351. Echo [o] Copying "%~2" to "%~1"
  352. Copy /Y "%~f2" "%~f1" 1>NUL || (
  353. Echo Unable to copy file "%~2">>"%Logfile%"
  354. Set /A "FilesFailsCount+=1"
  355. Goto:EOF
  356. )
  357. Set /A "FilesAddedCount+=1"
  358. Goto:EOF
  359.  
  360.  
  361. :ReplaceResource
  362. If Not Exist "%~f3" (
  363. Echo Can't locate the resource to copy from: "%~3">>"%LogFile%"
  364. Set /A "ResourceNotFoundCount+=1"
  365. Goto:EOF
  366. )
  367.  
  368. If Not Exist "%~f1" (
  369. Echo Can't locate the resource file to edit "%~1">>"%Logfile%"
  370. Set /A "ResourceNotFoundCount+=1"
  371. Goto:EOF
  372. )
  373.  
  374. Call :TakeOwn "%~f1" || (
  375. Echo Unable to grant file permissions in file: "%~1">>"%Logfile%"
  376. Set /A "ResourceFailsCount+=1"
  377. Goto:EOF
  378. )
  379.  
  380. Echo [o] Replacing resource with name "%~2" in resource file "%~f1", with "%~3".
  381.  
  382. If /I "%~x3" EQU ".bmp" (
  383. Start /W "Anolis" "%Anolis%" -op:upd -src:"%~f1" -type:Bitmap -name:"%~2" -lang:1033 -file:"%~f3")
  384. )
  385. If /I "%~x3" EQU ".ico" (
  386. Start /W "Anolis" "%Anolis%" -op:upd -src:"%~f1" -type:Icon -name:"%~2" -lang:1033 -file:"%~f3")
  387. )
  388. Set /A "ResourceSuccessCount+=1"
  389. Goto:EOF
  390.  
  391.  
  392.  
  393. REM ====================
  394. REM File Error Controls:
  395. REM ====================
  396.  
  397. :CheckErrors
  398. :: WIM File Error-Check.
  399. If /I "MountImage" EQU "True" If Not Exist "%WindowsImage%" (
  400. Echo [x] Windows Image not found at: "%WindowsImage%" | MORE
  401. Pause&Exit
  402. )
  403.  
  404. :: ResourceList File Error-Check.
  405. If Not Exist "%ResourceList%" (
  406. Echo [x] Resource-List file not found in: "%ResourceList%" | MORE
  407. Pause&Exit
  408. )
  409.  
  410. :: 'DISM.exe' File Error-Check.
  411. If Not Exist "%DISM%" (
  412. Echo [x] 'DISM' process not found at: "%DISM%" | MORE
  413. Pause&Exit
  414. )
  415.  
  416. :: 'ImageX.exe' File Error-Check.
  417. If Not Exist "%ImageX%" (
  418. Echo [x] 'ImageX' process not found at: "%ImageX%" | MORE
  419. Pause&Exit
  420. )
  421.  
  422. :: 'MountImage' Value check.
  423. If /I "%MountImage%" NEQ "True" If /I "%MountImage%" NEQ "False" (
  424. Echo [x] Error parsing parameter 'MountImage',
  425. Echo     value '%MountImage%' is not a Boolean value.
  426. Pause&Exit
  427. )
  428.  
  429. :: 'UnmountImage' Value check.
  430. If /I "%UnmountImage%" NEQ "True" If /I "%UnmountImage%" NEQ "False" (
  431. Echo [x] Error parsing parameter 'UnmountImage',
  432. Echo     value '%UnmountImage%' is not a Boolean value.
  433. Pause&Exit
  434. )
  435.  
  436. :: 'Rebuild' Value check.
  437. If /I "%Rebuild%" NEQ "True" If /I "%Rebuild%" NEQ "False" (
  438. Echo [x] Error parsing parameter 'Rebuild',
  439. Echo     value '%Rebuild%' is not a Boolean value.
  440. Pause&Exit
  441. )
  442.  
  443. :: 'CleanUp' Value check.
  444. If /I "%CleanUp%" NEQ "True" If /I "%CleanUp%" NEQ "False" (
  445. Echo [x] Error parsing parameter 'CleanUp',
  446. Echo     value '%CleanUp%' is not a Boolean value.
  447. Pause&Exit
  448. )
  449.  
  450. :: 'DismLogLevel' Value check.
  451. Echo "%DismLogLevel%"| Findstr.exe "^\"[^1-4]\"$" 1>NUL 2>&1 || (
  452. Echo [x] Error parsing parameter 'DismLogLevel',
  453. Echo     value '%DismLogLevel%' is not in range '1-4'.
  454. Pause&Exit
  455. )
  456.  
  457. :: Anolis Resourcer File Error-Check.
  458. If Not Exist "%Anolis%" (
  459. Echo [x] Anolis process not found in: "%Anolis%" | MORE
  460. Pause&Exit
  461. )
  462.  
  463. Goto:EOF
7130  Programación / Scripting / [APORTE] [BATCH] WIM Package Uninstaller en: 14 Abril 2014, 05:50 am
Este Script sirve para automatizar la tarea de montar una imagen WIM de Windows y eliminar paquetes de la instalación de Windows.

Se necesitan unos requisitos y dependencias para usar este Script:
· Saber de lo que estoy hablando.
· Conocer el nombre de los paquetes que quieres elimiar (obviamente).
· Dism e ImageX (WAIK/WADK).
· win6x_registry_tweak > http://www.msfn.org/board/topic/152688-win6x-registry-tweak/


Las instrucciones de uso y un extenso tutorial lo publiqué en este otro tema: http://foro.elhacker.net/windows/guia_de_personalizacion_de_imagenes_de_implementacion_de_windows_wim_parte_5-t412551.0.html así que lo haré de nuevo de manera resumida: solo tienen que escribir en un archivo de texto los paquetes que quieren eliminar, y configurar las variables documentadas del Script (La ubicación de la imagen, el directorio de montaje, etc...)


Todo lo necesario está incluido en este archivo comprimido:
http://www.mediafire.com/download/mq7o7q7brq6h4ca/WIM_Package_Uninstaller.rar

Imágenes:



WIM Package Uninstaller.cmd
Código
  1. @Echo OFF
  2.  
  3.  
  4.  
  5. REM =================
  6. REM Console Settings:
  7. REM =================
  8.  
  9. Title WIM Package Uninstaller - By Elektro
  10. Mode Con Cols=150 Lines=50
  11. CHCP 1252 1>NUL & REM Windows-1252, Spanish-Latin.
  12.  
  13.  
  14.  
  15. REM =====
  16. REM Info:
  17. REM =====
  18.  
  19. Echo  ----------------------------------------------------------------------------------
  20. Echo  This script mounts a Windows Image ^(WIM^) and then removes pre-installed packages
  21. Echo  ----------------------------------------------------------------------------------
  22.  
  23.  
  24.  
  25. REM ====================
  26. REM User defined values:
  27. REM ====================
  28.  
  29. REM This value indicates whether the Windows Image should be mounted.
  30. REM True  = 'DISM' will try to mount the 'WIM' image.
  31. REM False = 'DISM' will not try to mount the WIM image.
  32. REM Set this value to 'FALSE' if the 'WIM' image is already mounted in the specified mount directory,
  33. REM Otherwise, keep it as 'TRUE'.
  34. Set "MountImage=True"
  35.  
  36. REM This value indicates whether the Windows Image should be unmounted at the end.
  37. REM True  = 'DISM' will try to unmount the 'WIM' image.
  38. REM False = 'DISM' will not try to unmount the WIM image.
  39. REM Set this value to 'FALSE' if you want to keep the image mounted to make other changes,
  40. REM Otherwise, keep it as 'TRUE'.
  41. Set "UnmountImage=True"
  42.  
  43. REM This value indicates whether the Windows Image should be rebuilt at the end.
  44. REM True  = 'ImageX' will try to rebuild the 'WIM' image.
  45. REM False = 'ImageX' will keep the 'WIM' image as is.
  46. REM Set this value to 'FALSE' if you want to keep the image with normal size to make other changes,
  47. REM Otherwise, keep it as 'TRUE'.
  48. Set "Rebuild=True"
  49.  
  50. REM This value indicates the 'WIM' image to be mounted.
  51. Set "WindowsImage=%UserProfile%\Desktop\win 8 .1\win\sources\install.wim"
  52.  
  53. REM This value indicates the Image Index of the 'WIM' image.
  54. Set "ImageIndex=1"
  55.  
  56. REM This value indicates the directory where to mount the 'WIM' image.
  57. Set "MountDir=%HomeDrive%\WinMount"
  58.  
  59. REM This value indicates the textfile that contains the names of the packages to remove.
  60. Set "PackageList=%CD%\Packages.txt"
  61.  
  62. REM This value indicates the ubication of the 'WIM Registry Tweak Tool.exe' file.
  63. Set "WIMRegistryTweakTool=%CD%\Tools\WIM Registry Tweak Tool\WIM Registry Tweak Tool.exe"
  64.  
  65. REM This value indicates the ubication of 'ImageX.exe' file.
  66. Set "ImageX=%CD%\Tools\Dism\ImageX.exe"
  67.  
  68. REM This value indicates the ubication of a custom 'DISM.exe' file if needed.
  69. REM Default ubication: "%SystemRoot%\System32\Dism.exe"
  70. Set "Dism=%CD%\Tools\Dism\Dism.exe"
  71.  
  72. REM This value indicates the ubication of the logfile that will record 'DISM' errors.
  73. Set "DismLogfile=%CD%\%~n0 DISM.log"
  74.  
  75. REM This value indicates the logging-level of the 'DISM' process.
  76. REM 1 = Errors only
  77. REM 2 = Errors and warnings
  78. REM 3 = Errors, warnings, and informational
  79. REM 4 = All of the information listed previously, plus debug output
  80. Set /A "DismLogLevel=2"
  81.  
  82. REM This value indicates the ubication of the logfile that will record Main information.
  83. Set "Logfile=%CD%\%~n0.log"
  84.  
  85.  
  86.  
  87. REM =====
  88. REM Main:
  89. REM =====
  90.  
  91. :: Call Methods.
  92. Call :CheckErrors
  93. Call :CreateLogs
  94. Call :CreateMountDir
  95. Call :GetWIMSizeBefore
  96. Call :StartTimer
  97. Call :Mount
  98. CLS
  99. Call :ParsePackages
  100. CLS
  101. Call :CleanUp
  102. Call :Unmount
  103. Call :Rebuild
  104. Call :StopTimer
  105. Call :GetWIMSizeAfter
  106. Call :EndLog
  107. Pause&Exit
  108.  
  109.  
  110.  
  111. REM ========
  112. REM Methods:
  113. REM ========
  114.  
  115.  
  116. :CreateLogs
  117.  
  118. :: Create the 'DISM' logfile with 'ANSI' encoding,
  119. :: this is necessary to record a non-default 'DISM' loglevel such as '1' or '2'.
  120. Echo+ >"%DismLogfile%"
  121.  
  122.  
  123. :: Create the Main logfile and record starting info on it.
  124. Echo+ >"%Logfile%"
  125. (
  126. Echo   WIM Package Uninstaller
  127. Echo ===========================
  128. Echo   %DATE% ^| %TIME:~0,-3%
  129. Echo /\/\/\/\/\/\/\/\/\/\/\/\/\/
  130. Echo [i] Mount Image?...: %MountImage%
  131. Echo [i] Unmount Image?.: %UnmountImage%
  132. Echo [i] Windows Image..: %WindowsImage%
  133. Echo [i] Image Index....: %ImageIndex%
  134. Echo [i] Mount Directory: %MountDir%
  135. Echo [i] ImageX Path....: %ImageX%
  136. Echo [i] Dism Path......: %Dism%
  137. Echo [i] Dism Log File..: %DismLogfile%
  138. Echo [i] Dism Log Level.: %DismLogLevel%
  139. Echo [i] WIMRegistryTool: %WIMRegistryTweakTool%
  140. Echo [i] Package List...: %PackageList%
  141. Echo [i] Log File.......: %Logfile%
  142. Echo ===========================
  143. )>"%Logfile%"
  144.  
  145. :: Display starting log info.
  146. Type "%Logfile%"
  147.  
  148. :: Continue writting log.
  149. (
  150. Echo Package conflicts:
  151. Echo ==================
  152. )>>"%LogFile%"
  153. Goto:EOF
  154.  
  155.  
  156. :EndLog
  157. (
  158. Echo [i] Done!
  159. Echo [i] WIM Image Size Before........: %WIMSizeBefore%
  160. Echo [i] WIM Image Size After.........: %WIMSizeAfter%
  161. Echo [i] Packages Successfully Removed: %PackagesRemovedCount% Packages.
  162. Echo [i] Packages Failed To Remove....: %PackagesFailedCount% Packages.
  163. Echo [i] Packages Not Found...........: %PackagesNotFoundCount% Packages.
  164. Echo [i] Elapsed Time.................: %ElapsedTime%
  165. )>>"%LogFile%"
  166.  
  167. :: Display ending information.
  168. CLS
  169. Type "%LogFile%"
  170. Goto:EOF
  171.  
  172.  
  173. :CreateMountDir
  174. :: Create the mount directory.
  175. (
  176. If Not Exist "%MountDir%" If /I "%MountImage%" EQU "True" (
  177. MkDir "%MountDir%" 2>NUL
  178. )
  179. ) || (
  180. Echo [x] Error trying to create the directory "%MountDir%" to mount the Windows Image.
  181. Echo [i] Ensure that you have Admin rights to create the directory.
  182. Echo [i] Ensure that the directory name does not contains illegal characters.
  183. Pause&Exit
  184. )
  185. Goto:EOF
  186.  
  187.  
  188. :Mount
  189. :: Mount the Windows Image into the directory.
  190. Echo [+] Mounting WIM Image...
  191. If /I "%MountImage%" EQU "True" (
  192.  
  193. "%Dism%" /Mount-Image /ImageFile:"%WindowsImage%" /Index:"%ImageIndex%" /MountDir:"%MountDir%" /English /LogPath:"%DismLogfile%" /LogLevel:"%DismLogLevel%" || (
  194. Echo [x] Error mounting the Image Index "%ImageIndex%" in "%MountDir%"
  195. Echo [i] Ensure that the Image Index exist.
  196. Echo [i] Ensure that you have Admin rights to write inside the directory.
  197. Echo [i] Ensure that the directory is not already mounted.
  198. Echo [i] Ensure that the directory is fully empty.
  199. REM Try to unmount the failed image and discard changes.
  200. If /I "%UnmountImage%" EQU "True" (
  201. Echo [+] Unmounting and discarding changes...
  202. "%Dism%" /Unmount-WIM /Discard /MountDir:"%MountDir%"
  203. )
  204. Pause&Exit
  205. )
  206.  
  207. )
  208. Goto:EOF
  209.  
  210.  
  211. :CleanUp
  212. Echo [+] CleaningUp WIM Image...
  213. "%Dism%" /CleanUp-Image /StartComponentCleanUp /Image:"%MountDir%" /English /LogPath:"%DismLogfile%" /LogLevel:"%DismLogLevel%" /Quiet
  214. Goto:EOF
  215.  
  216.  
  217. :Unmount
  218. :: Unmount the Windows Image commiting changes.
  219. Echo [+] Unmounting WIM Image...
  220. If /I "%UnmountImage%" EQU "True" (
  221. "%Dism%" /Unmount-WIM /Commit /MountDir:"%MountDir%" /English /LogPath:"%DismLogfile%" /LogLevel:"%DismLogLevel%"
  222. )
  223. Goto:EOF
  224.  
  225.  
  226. :Rebuild
  227. If /I "%Rebuild%" EQU "False" (Goto:EOF)
  228.  
  229. Echo [+] Rebuilding WIM image...
  230.  
  231. ("%ImageX%" /Compress Maximum /Export "%WindowsImage%" "*" "%TEMP%\Rebuilt Image.wim" /Check) && (
  232. Del /Q /F "%WindowsImage%" 1>NUL
  233. Move /Y "%TEMP%\Rebuilt Image.wim" "%WindowsImage%" 1>NUL
  234. ) || (
  235. Echo [x] Error rebuilding Image "%WindowsImage%" to "%TEMP%\Rebuilt Image.wim".
  236. )
  237.  
  238. Goto :EOF
  239.  
  240.  
  241. :StartTimer
  242. Set "StartingDate=%Date%"
  243. Set "StarttingTime=%Time:~0,-3%"
  244. Goto :EOF
  245.  
  246.  
  247. :StopTimer
  248. (
  249. Echo Minutes = DateDiff^("n", "%StartingDate% %StarttingTime%", Now^)
  250. Echo WScript.Echo Minutes ^& " Minutes"
  251. )>"%TEMP%\%~n0 MinuteDiff.vbs"
  252.  
  253. For /F "Tokens=*" %%# In (
  254. 'Cscript.exe /Nologo "%TEMP%\%~n0 MinuteDiff.vbs"'
  255. ) Do (
  256. Set "ElapsedTime=%%#"
  257. )
  258.  
  259. Goto:EOF
  260.  
  261.  
  262. :WriteConvertBytesScript
  263. If Exist "%TEMP%\%~n0 Convert Bytes.vbs" (Goto:EOF)
  264. (
  265. Echo Suffix = Array^("Bytes", "KB", "MB", "GB", "TB"^)
  266. Echo Function Convert^(Bytes^)
  267. Echo Convert = convert0^(Bytes, 0^)
  268. Echo End Function
  269. Echo Function Convert0^(Bytes, Level^)
  270. Echo If Bytes ^>= 1024 Then
  271. Echo Bytes = Round^(Bytes / 1024, 2^)
  272. Echo Level = Level + 1
  273. Echo Convert0 = Convert0^(Bytes, Level^)
  274. Echo End If
  275. Echo Convert0 = Bytes ^& " " ^& Suffix^(Level^)
  276. Echo End Function
  277. Echo WScript.Echo Convert^(WScript.Arguments^(0^)^)
  278. )>"%TEMP%\%~n0 Convert Bytes.vbs"
  279. Goto:EOF
  280.  
  281.  
  282. :GetWIMSizeBefore
  283. Call :WriteConvertBytesScript
  284. For %%# in ("%WindowsImage%") Do (Set "WIMSizeBefore=%%~z#")
  285. For /F "Tokens=*" %%# In (
  286. 'Cscript.exe /Nologo "%TEMP%\%~n0 Convert Bytes.vbs" "%WIMSizeBefore%"'
  287. ) Do (
  288. Set "WIMSizeBefore=%%#"
  289. )
  290. Del /Q "%TEMP%\%~n0 Convert Bytes.vbs"
  291. Goto:EOF
  292.  
  293.  
  294. :GetWIMSizeAfter
  295. Call :WriteConvertBytesScript
  296. For %%# in ("%WindowsImage%") Do (Set "WIMSizeAfter=%%~z#")
  297. For /F "Tokens=*" %%# In (
  298. 'Cscript.exe /Nologo "%TEMP%\%~n0 Convert Bytes.vbs" "%WIMSizeAfter%"'
  299. ) Do (
  300. Set "WIMSizeAfter=%%#"
  301. )
  302. Del /Q "%TEMP%\%~n0 Convert Bytes.vbs"
  303. Goto:EOF
  304.  
  305.  
  306. :ParsePackages
  307.  
  308. Set /A "PackagesRemovedCount=0"
  309. Set /A "PackagesFailedCount=0"
  310. Set /A "PackagesNotFoundCount=0"
  311.  
  312. :: Unhide packages and take registry ownership.
  313. "%WIMRegistryTweakTool%" /p "%MountDir%"
  314.  
  315. :: Remove Packages.
  316. For /F "UseBackQ Tokens=* Delims=" %%# In ("%PackageList%") Do (
  317.  
  318. Echo [+] Removing package: %%~#
  319.  
  320. "%Dism%" /Remove-Package /PackageName:"%%~#" /Image:"%MountDir%" /English /LogPath:"%DismLogfile%" /LogLevel:"%DismLogLevel%" /Quiet 1>NUL
  321.    Call Set /A "ExitCode=%%Errorlevel%%"
  322.  
  323.    (Call Echo "%%ExitCode%%"| Findstr.exe "^\"0\"$" 1>NUL 2>&1) && (
  324.     Call Set /A "PackagesRemovedCount+=1"
  325.    )
  326.  
  327. (Call Echo "%%ExitCode%%"| Findstr.exe "^\"5\"$" 1>NUL 2>&1) && (
  328. Call Set /A "PackagesFailedCount+=1"
  329. Echo Failed to remove package: %%~#>>"%LogFile%"
  330. )
  331.  
  332. (Call Echo "%%ExitCode%%"| Find.exe "-2146498555" 1>NUL 2>&1) && (
  333. Call Set /A "PackagesNotFoundCount+=1"
  334. Echo Package is not installed: %%~#>>"%LogFile%"
  335. )
  336.  
  337. )
  338. Goto:EOF
  339.  
  340.  
  341.  
  342. REM ===============
  343. REM Error Controls:
  344. REM ===============
  345.  
  346. :CheckErrors
  347. :: WIM File Error-Check.
  348. If /I "MountImage" EQU "True" If Not Exist "%WindowsImage%" (
  349. Echo [x] Windows Image not found at: "%WindowsImage%" | MORE
  350. Pause&Exit
  351. )
  352.  
  353. :: PackageList File Error-Check.
  354. If Not Exist "%PackageList%" (
  355. Echo [x] PackageList not found at: "%PackageList%" | MORE
  356. Pause&Exit
  357. )
  358.  
  359. :: 'DISM.exe' File Error-Check.
  360. If Not Exist "%DISM%" (
  361. Echo [x] 'DISM' process not found at: "%DISM%" | MORE
  362. Pause&Exit
  363. )
  364.  
  365. :: 'ImageX.exe' File Error-Check.
  366. If Not Exist "%ImageX%" (
  367. Echo [x] 'ImageX' process not found at: "%ImageX%" | MORE
  368. Pause&Exit
  369. )
  370.  
  371. :: 'WIM Registry Tweak Tool.exe' File Error-Check.
  372. If Not Exist "%WIMRegistryTweakTool%" (
  373. Echo [x] 'WIM Registry Tweak Tool' process not found at: "%WIMRegistryTweakTool%" | MORE
  374. Pause&Exit
  375. )
  376.  
  377. :: 'MountImage' Value check.
  378. If /I "%MountImage%" NEQ "True" If /I "%MountImage%" NEQ "False" (
  379. Echo [x] Error parsing parameter 'MountImage',
  380. Echo     value '%MountImage%' is not a Boolean value.
  381. Pause&Exit
  382. )
  383.  
  384. :: 'UnmountImage' Value check.
  385. If /I "%UnmountImage%" NEQ "True" If /I "%UnmountImage%" NEQ "False" (
  386. Echo [x] Error parsing parameter 'UnmountImage',
  387. Echo     value '%UnmountImage%' is not a Boolean value.
  388. Pause&Exit
  389. )
  390.  
  391. :: 'Rebuild' Value check.
  392. If /I "%Rebuild%" NEQ "True" If /I "%Rebuild%" NEQ "False" (
  393. Echo [x] Error parsing parameter 'Rebuild',
  394. Echo     value '%Rebuild%' is not a Boolean value.
  395. Pause&Exit
  396. )
  397.  
  398. :: 'DismLogLevel' Value check.
  399. Echo "%DismLogLevel%"| Findstr.exe "^\"[^1-4]\"$" 1>NUL 2>&1 || (
  400. Echo [x] Error parsing parameter 'DismLogLevel',
  401. Echo     value '%DismLogLevel%' is not in range '1-4'.
  402. Pause&Exit
  403. )
  404.  
  405. Goto:EOF
Páginas: 1 ... 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 [713] 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 ... 1236
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines