Guest User

windows10script.vbs

a guest
Aug 5th, 2015
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Set oWSH = CreateObject("WScript.Shell")
  2. Set oNET = CreateObject("WScript.Network")
  3. Set oAPP = CreateObject("Shell.Application")
  4. Set oFSO = CreateObject("Scripting.FileSystemObject")
  5. Set oWMI = GetObject("winmgmts:\\.\root\CIMV2")
  6. Set oARG = WScript.Arguments
  7.  
  8. 'http://superuser.com/questions/227860/how-to-toggling-uac-on-off-quickly-eg-using-command-line-in-windows-7
  9. 'http://stackoverflow.com/questions/5344021/bypass-uac-in-vbscript
  10.  
  11. 'https://github.com/10se1ucgo/DisableWinTracking/blob/master/run.py
  12. 'https://www.reddit.com/r/Windows10/comments/3f38ed/guide_how_to_disable_data_logging_in_w10/
  13.  
  14. Call ForceConsole()
  15. Call showBanner()
  16. Call runElevated()
  17. Call printf(" Requisitos OK...")
  18. Call showMenu
  19.  
  20. Function printf(txt)
  21.     WScript.StdOut.WriteLine txt
  22. End Function
  23.  
  24. Function printl(txt)
  25.     WScript.StdOut.Write txt
  26. End Function
  27.  
  28. Function scanf()
  29.     scanf = LCase(WScript.StdIn.ReadLine)
  30. End Function
  31.  
  32. Function Wait(n)
  33.     WScript.Sleep Int(n * 1000)
  34. End Function
  35.  
  36. Function ForceConsole()
  37.     If InStr(LCase(WScript.FullName), "cscript.exe") = 0 Then
  38.         oWSH.Run "cscript //NoLogo " & Chr(34) & WScript.ScriptFullName & Chr(34)
  39.         WScript.Quit
  40.     End If
  41. End Function
  42.  
  43. Function runElevated()
  44.     If isUACRequired Then
  45.         If Not isElevated Then RunAsUAC
  46.     Else
  47.         If Not isAdmin Then
  48.             printf " WARNING: Necesitas ejecutar este script como Administrador!"
  49.             printf ""
  50.             printf " Press <enter> to quit"
  51.             scanf
  52.             WScript.Quit
  53.         End If
  54.     End If
  55. End Function
  56.  
  57. Function isUACRequired()
  58.     r = isUAC()
  59.     If r Then
  60.         intUAC = oWSH.RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA")
  61.         r = 1 = intUAC
  62.     End If
  63.     isUACRequired = r
  64. End Function
  65.  
  66. Function isElevated()
  67.     isElevated = CheckCredential("S-1-16-12288")
  68. End Function
  69.  
  70. Function isAdmin()
  71.     isAdmin = CheckCredential("S-1-5-32-544")
  72. End Function
  73.  
  74. Function CheckCredential(p)
  75.     Set oWhoAmI = oWSH.Exec("whoami /groups")
  76.     Set WhoAmIO = oWhoAmI.StdOut
  77.     WhoAmIO = WhoAmIO.ReadAll
  78.     CheckCredential = InStr(WhoAmIO, p) > 0
  79. End Function
  80.  
  81. Function RunAsUAC()
  82.     If isUAC Then
  83.         printf ""
  84.         printf " El script necesita ejecutarse con permisos elevados"
  85.         printf " Acepta el siguiente mensaje..."
  86.         Wait(2.5)
  87.         oAPP.ShellExecute "cscript", "//NoLogo " & Chr(34) & WScript.ScriptFullName & Chr(34), "", "runas", 1
  88.         WScript.Quit
  89.     End If
  90. End Function
  91.  
  92. Function isUAC()
  93.     Set cWin = oWMI.ExecQuery("SELECT * FROM Win32_OperatingSystem")
  94.     r = False
  95.     For Each OS In cWin
  96.         If OS.Version > 5.2 Then
  97.             r = True
  98.         Else
  99.             r = False
  100.         End If
  101.     Next
  102.     isUAC = r
  103. End Function
  104.  
  105. Function showBanner()
  106.     printf("")
  107.     printf(" #############################")
  108.     printf(" #                           #")
  109.     printf(" # WINDOWS 10 SCRIPT TWEAKER #")
  110.     printf(" # by AikonCWD               #")
  111.     printf(" #                      v1.0 #")
  112.     printf(" #############################")
  113.     printf("")
  114.     printf(" Comprobando requisitos del sistema...")
  115.     Wait(1)
  116. End Function
  117.  
  118. Function showMenu()
  119.     Wait(1)
  120.     printf ""
  121.     printf " Selecciona una opcion:"
  122.     printf ""
  123.     printf "  1 = Habilitar el modo Dios"
  124.     printf "  2 = Deshabilitar Telemetry"
  125.     printf "  3 = Borrar ficheros log de seguimiento"
  126.     printf "  4 = Deshabilitar servicios de recoleccion de datos"
  127.     printf "  5 = Modificar entradas hosts para evitar publicidad"
  128.     printf "  0 = Salir"
  129.     printf ""
  130.     printl " > "
  131.     RP = scanf
  132.     If Not isNumeric(RP) = True Then
  133.         printf ""
  134.         printf " ERROR: Opcion invalida, solo se permiten numero..."
  135.         Call showMenu()
  136.         Exit Function
  137.     End If
  138.     Select Case RP
  139.         Case 1
  140.             Call createGodMode()
  141.         Case 2
  142.             printf "has pulsado 2"
  143.         Case 3
  144.             printf "has pulsado 3"
  145.         Case 4
  146.             printf "has pulsado 4"
  147.         Case 5
  148.             printf "has pulsado 5"
  149.         Case 0
  150.             printf ""
  151.             printf " Gracias por utilizar mi script. Adios!! ;D"
  152.             wait(2.5)
  153.             WScript.Quit
  154.         Case Else
  155.         printf ""
  156.         printf " INFO: Opcion invalida, ese numero no esta disponible"
  157.         Call showMenu()
  158.         Exit Function
  159.     End Select
  160. End Function
  161.  
  162. Function getNTversion()
  163.     Set cWin = oWMI.ExecQuery("SELECT * FROM Win32_OperatingSystem")
  164.     For Each OS In cWin
  165.         getNTversion = Split(OS.Version,".")(0)
  166.     Next
  167. End Function
  168.  
  169. Function createGodMode()
  170.     godFolder = oWSH.SpecialFolders("Desktop") & "\GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}"
  171.     If oFSO.FolderExists(godFolder) = False Then
  172.         printf ""
  173.         printl(" Quieres crear el acceso directo 'GodMode' en tu escritorio? (s/n) ")
  174.         If scanf = "s" Then
  175.             oFSO.CreateFolder(godFolder)
  176.             printf ""
  177.             printf " INFO: Se ha creado un acceso directo en tu escritorio"
  178.             Call showMenu
  179.         Else
  180.             printf ""
  181.             printf " INFO: Operacion cancelada por el usuario"
  182.             Call showMenu          
  183.         End If
  184.     Else
  185.         printf ""
  186.         printf " INFO: Ya existe el modo dios, ejecutalo desde tu Escritorio"
  187.         call showMenu
  188.     End If
  189. End Function
  190.  
  191. printf "Script executed. Press <enter> to quit"
  192. scanf
Add Comment
Please, Sign In to add comment