Search code examples
goinstallationsilent

Authentication Issue while installing Microsoft Visual c++ 2008 Redistributable package


When i try to install Microsoft Redistributable package silently through golang i get this error

**

fork/exec C:\Windows2008R2.exe: The requested operation requires elevation.

**

And my code is as follows

package main

import (
    "fmt"
    "os/exec"
)

func main() {
    co := exec.Command("C:\\Windows2008R2.exe","/q","/c:\"msiexec","/i","Windows2008R2.msi","/qn","/l*v","C:\\Windows2008R2_x64.log\"")
    if err := co.Run(); err != nil { 
        fmt.Println("Error: ", err)
    }  
}

Solution

  • Seems like you are not the owner of the file. In order to change the ownership of the files you can...

    1. go in to the properties of the folder that contains the files you need to take ownership of
    2. click on the security tab
    3. click Advanced
    4. click on the Owner tab
    5. Click Edit...
    6. Select the account name in the Change owner to list that you want to take ownership
    7. Check the box, Replace owner on subcontainers and objects
    8. Click OK