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

 

 


Tema destacado: Estamos en la red social de Mastodon


+  Foro de elhacker.net
|-+  Programación
| |-+  Scripting
| | |-+  Ayuda con este codigo. error(WScript.scriptfullname)
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Ayuda con este codigo. error(WScript.scriptfullname)  (Leído 3,694 veces)
70N1


Desconectado Desconectado

Mensajes: 355


Ver Perfil
Ayuda con este codigo. error(WScript.scriptfullname)
« en: 19 Febrero 2010, 15:18 pm »

Tengo este codigo y lo estoy ejecutando desde vb 2005 express.

Me tirava el error de que faltaba el objeto wscript asi que agregue esta linea:

Código:
Set Wscript = CreateObject("WScript.SHELL")

Pero ahora me tira otro error en esta linea
Código:
wscript.scriptfullname

Al pareser no es miembro de wscript, Saveis que es lo que pasa?.
Por que no reconose a wscript?
Que tipo de objeto debo crear?

Código:
'RunAs Admin!
Set Wscript = CreateObject("WScript.SHELL")

If IsAdmin() = False Then
 
  Set objShell = CreateObject("Shell.Application")
  objShell.ShellExecute "wscript.exe", Chr(34) & _
  Wscript.ScriptFullName & Chr(34), "", "runas", 1
  Wscript.Quit 0
msgbox()
End If


'Remove any previous instances and install a fresh version
'Run("cscript uninstall_tap.vbs uac")
driver = ScriptPath() & "Windows_" & GetOSArchitecture()
driverhelper = Chr(34) & driver & "/driverhelper.exe" & Chr(34)
inf = Chr(34) & driver & "/IpopTap.inf" & Chr(34)
Run(driverhelper & " Install " & inf & " IpopTap")

res = Run(driverhelper & " Status IpopTap")
'Make sure the device is installed and that it has the correct name!
If ChangeNetworkName(res, "tapipop") = 0 Then
  Wscript.Echo "Installation Successful!"
Else
  Wscript.Echo "Installation Failed!  Please uninstall and then reinstall again."
End If

'Changes the Network Name given a PnpInstanceID
'Note:  Windows does a poor job of cleanup and often times, uninstalled devices will have
'  the PnpInstanceID of running devices.  Because of this, all devices with a given
'  PnpInstanceId will be renamed
Function ChangeNetworkName(pnpInstanceID, name)
  Const HKEY_LOCAL_MACHINE = &H80000002
  Const NETWORK_CONNECTIONS = "SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}"
  Dim oReg, path
  Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
  oReg.EnumKey HKEY_LOCAL_MACHINE, NETWORK_CONNECTIONS, arrSubKeys
  Set WshShell = WScript.CreateObject("WScript.Shell")
  ChangeNetworkName = 1
  For Each subkey In arrSubKeys
    path = "HKLM\" & NETWORK_CONNECTIONS & "\" & subkey & "\Connection\"
    'Turn error reporting off
    On Error Goto 0
    On Error Resume Next
    id = wshShell.RegRead(path & "PnpInstanceID")
    If id = pnpInstanceID Then
      wshShell.RegWrite path & "Name", name
      ChangeNetworkName = 0
      Exit For
    End If
  Next
End Function

'Executes the app and returns the first line from StdOut
Function Run(app)
  Dim oExec, WshShell
  Set WshShell = CreateObject("Wscript.Shell")
  Set oExec = WshShell.Exec(app)

  Do While oExec.Status = 0
  Loop
  Run = OExec.StdOut.ReadLine()
End Function

'Returns 32 or 64 for the OS Architecture
Function GetOSArchitecture()
  GetOSArchitecture = "64"
  On Error Goto 0
  On Error Resume Next
  Set WshShell = WScript.CreateObject("WScript.Shell")
  Const KEY = "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PROCESSOR_ARCHITECTURE"
  arch =  WshShell.RegRead(KEY)
  If arch = "x86" Then
    GetOSArchitecture = "32"
  End If
End Function

Function ScriptPath()
  ScriptPath = Left(WScript.ScriptFullName, _
    Len(WScript.ScriptFullName) - Len(WScript.ScriptName))
End Function

Function IsAdmin()
  IF Instr(1, "XP", Run("%comspec% /c ver | findstr XP"), 0) = 0 Then
    IsAdmin = True
    Exit Function
  End If

  'Check for elevated
  IsAdmin = RunCleanExit("%comspec% /c whoami /all | findstr /I /C:""S-1-16-12288""")
End Function

Function RunCleanExit(app)
  RunCleanExit = False
  Set oShell = CreateObject("WScript.Shell")
  Set oExec = oShell.Exec(app)

  Do While oExec.Status = 0
  Loop
  If oExec.ExitCode = 0 Then
    RunCleanExit = True
  End If
End Function


« Última modificación: 19 Febrero 2010, 16:06 pm por 70N1 » En línea

70N1
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
¿Hay algo que se me escapa de las manos en este código y me genera error?
Programación C/C++
theluigy13etv 2 2,110 Último mensaje 27 Abril 2012, 06:21 am
por Beakman
que error le encuentran a este codigo en nasm?
ASM
Belial & Grimoire 6 3,575 Último mensaje 15 Julio 2013, 12:25 pm
por mr.blood
Me sale error al inentar abrir objeto WScript
Programación Visual Basic
mike3636522 4 2,835 Último mensaje 13 Octubre 2013, 02:15 am
por BlackZeroX
El dreamweaver me detecta error en este codigo ayuda.
PHP
70N1 2 1,776 Último mensaje 13 Junio 2014, 06:08 am
por engel lex
Ayuda Con este codigo (ERROR)
Desarrollo Web
ifaniorunmila 7 3,120 Último mensaje 6 Abril 2021, 14:15 pm
por UnaiiM
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines