Advertisement
Guest User

Untitled

a guest
Jan 15th, 2016
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. SetRegistryValue "SOFTWARE\Level Platforms\Managed
  3. Workplace\Onsite Manager\Install\", "DmSilentMode", "true"
  4. '=============================================
  5. ' Set the registry value in HKLM. The registry key is created.
  6. Sub SetRegistryValue(ByVal path, ByVal name, ByVal value)
  7. Dim strComputer, oReg, createResp, status
  8. const HKEY_LOCAL_MACHINE = &H80000002
  9. strComputer = "."
  10. Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &
  11. strComputer & "\root\default:StdRegProv")
  12. createResp = oReg.CreateKey(HKEY_LOCAL_MACHINE, path)
  13. status = oReg.SetStringValue(HKEY_LOCAL_MACHINE, path, name, value)
  14. Set oReg = Nothing
  15. End Sub
  16.  
  17.  
  18.  
  19. ' I found the below here: http://www.robvanderwoude.com/vbstech_internet_download.php
  20.  
  21. ' httpdownload "source URL", "local folder destination"
  22. HTTPDownload "http://dropbox.com/location/myfile.exe", "%temp%\myfile.exe"
  23.  
  24. Set WshShell = WScript.CreateObject("WScript.Shell")
  25. Command = "%temp%\myfile.exe -y"
  26. WshShell.Run Command
  27.  
  28.  
  29. Sub HTTPDownload( myURL, myPath )
  30. ' This Sub downloads the FILE specified in myURL to the path specified in myPath.
  31. '
  32. ' myURL must always end with a file name
  33. ' myPath may be a directory or a file name; in either case the directory must exist
  34. '
  35. ' Written by Rob van der Woude
  36. ' http://www.robvanderwoude.com
  37. '
  38. ' Based on a script found on the Thai Visa forum
  39. ' http://www.thaivisa.com/forum/index.php?showtopic=21832
  40.  
  41.     ' Standard housekeeping
  42.    Dim i, objFile, objFSO, objHTTP, strFile, strMsg
  43.     Const ForReading = 1, ForWriting = 2, ForAppending = 8
  44.  
  45.     ' Create a File System Object
  46.    Set objFSO = CreateObject( "Scripting.FileSystemObject" )
  47.  
  48.     ' Check if the specified target file or folder exists,
  49.    ' and build the fully qualified path of the target file
  50.    If objFSO.FolderExists( myPath ) Then
  51.         strFile = objFSO.BuildPath( myPath, Mid( myURL, InStrRev( myURL, "/" ) + 1 ) )
  52.     ElseIf objFSO.FolderExists( Left( myPath, InStrRev( myPath, "\" ) - 1 ) ) Then
  53.         strFile = myPath
  54.     Else
  55.         WScript.Echo "ERROR: Target folder not found."
  56.         Exit Sub
  57.     End If
  58.  
  59.     ' Create or open the target file
  60.    Set objFile = objFSO.OpenTextFile( strFile, ForWriting, True )
  61.  
  62.     ' Create an HTTP object
  63.    Set objHTTP = CreateObject( "WinHttp.WinHttpRequest.5.1" )
  64.  
  65.     ' Download the specified URL
  66.    objHTTP.Open "GET", myURL, False
  67.     objHTTP.Send
  68.  
  69.     ' Write the downloaded byte stream to the target file
  70.    For i = 1 To LenB( objHTTP.ResponseBody )
  71.         objFile.Write Chr( AscB( MidB( objHTTP.ResponseBody, i, 1 ) ) )
  72.     Next
  73.  
  74.     ' Close the target file
  75.    objFile.Close( )
  76. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement