Skip to content

VMware Support Upload Script

Tired from uploading VMware Support logs to VMware tickets i wanted to do this job with just one click. I wrote a script which can be used to upload files to VMwares FTP server quite fast. The script uses the FTPupload howto from KB1008525. Please open a ticket with VMware prior to start this script, to get a support request number. You need the ticketnumber to run the script.

Download: VMware-upload-v1

Usage:

  • Simply put the script on your desktop and drag the file you want to upload to the script.
  • Console usage is also possible. Start the script with VMware-upload.vbs [SUPPORTFILE] 
  • If you want to use the Windows Send To function you can copy the script to your sendto folder. Open Start -> Run -> shell:sendto and copy the script to this folder.

Source:

' VMware Support Upload Script v1.0 (2012-09-08)
' http://www.virten.net
' 
' Usage:
'  - Drag you vm-support file to the script
'  - Copy the script to your SendTo Folder
'  - Console Usage: VMware-upload.vbs [SUPPORTFILE] 

Set objArgs = WScript.Arguments

'VMware FTP Data
ftpHost="ftpsite.vmware.com"
ftpUsername="inbound"
ftpPassword="inbound"

'Only one file per Upload possible
If objArgs.Count <> 1 then
 msgbox "Please drop one file to the script."
 WScript.Quit
Else
  SupportFile = objArgs(0)
End If

'Inputbox to enter VMware Support Request Number
ftpTicket=InputBox("Enter VMware Support Request Number", "Upload vm-support")
If ftpTicket = "" Or Not IsNumeric(ftpTicket)  then
 msgbox "Illegal Support Request Number"
 WScript.Quit
End If

'Confirm upload
intAnswer = Msgbox("Upload " & SupportFile & " to VMware Ticket ID " & ftpTicket & "?", vbYesNo, "Upload vm-support")
If intAnswer = vbNo Then
 WScript.Quit
End If

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")

'Add quotes for supporting whitespace in filenames  
SupportFile = Trim(SupportFile)
SupportFile = chr(34) & SupportFile & chr(34)

'Build FTP commands 
ftpCommands = "USER " & ftpUsername & vbCRLF
ftpCommands = ftpCommands & ftpPassword & vbCRLF
ftpCommands = ftpCommands & "mkdir " & ftpTicket & vbCRLF
ftpCommands = ftpCommands & "cd " & chr(92) & ftpTicket & vbCRLF
ftpCommands = ftpCommands & "binary" & vbCRLF
ftpCommands = ftpCommands & "put " & SupportFile & vbCRLF
ftpCommands = ftpCommands & "quit" & vbCRLF

'Create temporary command files
tempdir = objShell.ExpandEnvironmentStrings("%TEMP%")
CommandFile = tempdir & chr(92) & objFSO.GetTempName
ResultFile = tempdir & chr(92) & objFSO.GetTempName
Set objCommandFile = objFSO.CreateTextFile(CommandFile, True)
objCommandFile.WriteLine(ftpCommands)
objCommandFile.Close

'Do the job
objShell.Run "%comspec% /c ftp -n -i -s:" & CommandFile & " " & ftpHost & " > " & ResultFile, 0, TRUE

'Display the result
Set Result = objFSO.OpenTextFile(ResultFile, 1, 0, -2)
Wscript.Echo Result.ReadAll
Result.Close

'Clean up 
objFSO.DeleteFile (CommandFile)
objFSO.DeleteFile (ResultFile)

 

Leave a Reply

Your email address will not be published. Required fields are marked *