Link to home
Start Free TrialLog in
Avatar of Frutarom IT
Frutarom IT

asked on

Run Bat File on Remote Computer - PSExec

Why am I getting access denied when entering this through PSExec in my C# program

 string ip = getIP();
            string scope = @"-accepteula -d -i \\" + ip + @" -u frutarom\" + textBox2.Text + " -p " + textBox3.Text + " cmd /c " + @" \\njfs01\public\testing\bat files\IP Release-Renew.bat";
            ProcessStartInfo info = new ProcessStartInfo("psexec.exe", scope);

            info.UseShellExecute = false;
            Process p = Process.Start(info);

Open in new window


I have the same code, minus the path being different... the Path IS valid, and have used it on other programs before.

Here is my .bat file

Start-Process powershell -Verb runAs
ipconfig /all

TIMEOUT /t 40

Open in new window


I am trying to make even a simple one work, and even this is giving me access is denied.
Avatar of kaufmed
kaufmed
Flag of United States of America image

Are you an admin on the target machine?
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.