Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Access denied when remotely running a batch file

$
0
0

Hello everyone,

I need to remotely run a batch file, same way as the author of this topic needed to: http://powershell.com/cs/forums/t/14235.aspx?PageIndex=3

My batch file needs to open the user's browser and perform a few actions, just as an user would do, like access google and perform a search, for example. It is an automated script triggered by a batch file, but I need to SEE it running.

Here is what I have so far:
- I have two computers (let me call them as comp1 and comp2) with psremoting enabled in both of them so they can "see" each other.
- I'm currently in comp1 and trying to run the following code:
Invoke-Command -Computer comp2 -Credentials domain\user -ScriptBlock { Start-Process "\\comp2\share\echo.bat"

But I'm getting the following error message:
This command cannot be executed due to the error: Access is denied
CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException
FullyQualifiedErrorId : InvalidOperationException,Microsoft.ProwerShell.Commands.StartProcessCommand

Both comp1 and comp2 are Administrators, and the file is in a shared folder. So what am I missing?

Additional info:
echo.bat is just echoing a "Hello World" and saving it in a txt file.
Reminding that this file is currently located in comp2, but I need to run it from comp1


I also tried the following:
wmic /NODE:comp2 process call create "C:\shared_folder_path\excho.bat"

This actually worked, but I couldn't see the actions being performed in comp2 screen.
Is there any way to get this done?

Sorry about the long (and kinda messy) post. I'd really appreciate any help
Thank you very much in advance


Viewing all articles
Browse latest Browse all 6937

Trending Articles