Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SetRegistryValue "SOFTWARE\Level Platforms\Managed
- Workplace\Onsite Manager\Install\", "DmSilentMode", "true"
- '=============================================
- ' Set the registry value in HKLM. The registry key is created.
- Sub SetRegistryValue(ByVal path, ByVal name, ByVal value)
- Dim strComputer, oReg, createResp, status
- const HKEY_LOCAL_MACHINE = &H80000002
- strComputer = "."
- Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &
- strComputer & "\root\default:StdRegProv")
- createResp = oReg.CreateKey(HKEY_LOCAL_MACHINE, path)
- status = oReg.SetStringValue(HKEY_LOCAL_MACHINE, path, name, value)
- Set oReg = Nothing
- End Sub
- ' I found the below here: http://www.robvanderwoude.com/vbstech_internet_download.php
- ' httpdownload "source URL", "local folder destination"
- HTTPDownload "http://dropbox.com/location/myfile.exe", "%temp%\myfile.exe"
- Set WshShell = WScript.CreateObject("WScript.Shell")
- Command = "%temp%\myfile.exe -y"
- WshShell.Run Command
- Sub HTTPDownload( myURL, myPath )
- ' This Sub downloads the FILE specified in myURL to the path specified in myPath.
- '
- ' myURL must always end with a file name
- ' myPath may be a directory or a file name; in either case the directory must exist
- '
- ' Written by Rob van der Woude
- ' http://www.robvanderwoude.com
- '
- ' Based on a script found on the Thai Visa forum
- ' http://www.thaivisa.com/forum/index.php?showtopic=21832
- ' Standard housekeeping
- Dim i, objFile, objFSO, objHTTP, strFile, strMsg
- Const ForReading = 1, ForWriting = 2, ForAppending = 8
- ' Create a File System Object
- Set objFSO = CreateObject( "Scripting.FileSystemObject" )
- ' Check if the specified target file or folder exists,
- ' and build the fully qualified path of the target file
- If objFSO.FolderExists( myPath ) Then
- strFile = objFSO.BuildPath( myPath, Mid( myURL, InStrRev( myURL, "/" ) + 1 ) )
- ElseIf objFSO.FolderExists( Left( myPath, InStrRev( myPath, "\" ) - 1 ) ) Then
- strFile = myPath
- Else
- WScript.Echo "ERROR: Target folder not found."
- Exit Sub
- End If
- ' Create or open the target file
- Set objFile = objFSO.OpenTextFile( strFile, ForWriting, True )
- ' Create an HTTP object
- Set objHTTP = CreateObject( "WinHttp.WinHttpRequest.5.1" )
- ' Download the specified URL
- objHTTP.Open "GET", myURL, False
- objHTTP.Send
- ' Write the downloaded byte stream to the target file
- For i = 1 To LenB( objHTTP.ResponseBody )
- objFile.Write Chr( AscB( MidB( objHTTP.ResponseBody, i, 1 ) ) )
- Next
- ' Close the target file
- objFile.Close( )
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement