0

Using Powershell, I'm trying to connect to a remote machine and install an exe file on that system. Unfortunately I'm getting an Access is denied error when running the file. What's truly odd about this error, is that other exe's located on the same path run fine, so I'm wondering if something more cryptic could be involved?

I'm currently using this command to connect to the remote machine, upon which I'm a local admin.

$InstallFile = "\\networkshare\folder\folder\setup.exe"
$InstallParameters = "SampleParameter1 = 5"
$Server = SERVERNAME.DOMAINNAME.COM
$cred = Get-Credential
invoke-command -Computername $Server -authentication credssp -credential $cred -ScriptBlock { 
    $CurrentProcess = Start-Process -FilePath $InstallFile -ArgumentList $InstallParameters -Wait -PassThru
    $CurrentProcess | Wait-Process
}

I'm using CredSSP which seems to be working well since it fixed this issue for other files, but this one simply refuses. Any other thoughts? I ran into a similar issue with .NET 4 and was unable to resolve that install either.

npeterson
  • 182
  • 2
  • 12
  • See http://stackoverflow.com/questions/37859771/start-process-access-denied-with-domain-admin-privileges/37860877#37860877. I think the answer to your problem is similar. – Lionel Jun 28 '16 at 12:19

1 Answers1

0

I've noticed you are using Start-Process to run your executable. According to this: http://technet.microsoft.com/en-us/library/dd347667.aspx there's also -Credential parameter that can be passed to it. It very well might be the case that Start-Process is not executed by the user that called Invoke-Command. Try passing Credential to your Start-Process:

invoke-command -Computername $Server -authentication credssp -credential $cred -ScriptBlock { 
$CurrentProcess = Start-Process -FilePath $InstallFile - Credential $cred -ArgumentList $InstallParameters -Wait -PassThru
$CurrentProcess | Wait-Process }
Andrey Marchuk
  • 13,301
  • 2
  • 36
  • 52