September 19, 2016

Execute Remote Script

Example of running a remotely hosted script on a VM. Demonstrates usage of Id() to specify the object to act on, as well as how to pass parameters (script URL) to a service method
package main

import (


var remoteScriptURL = ""

func main() {
    // Create a session
    sess := session.New()

    // Get the VirtualGuest service
    service := services.GetVirtualGuestService(sess)

    // Execute the script on VM with ID 12345678
    err := service.Id(12345678).ExecuteRemoteScript(&remoteScriptURL)

    if err != nil {
    } else {
        fmt.Println("Remote script sent for execution")


If this article contains any error, or leaves any of your questions unanswered, please help us out by opening up a github issue.
Open an issue