Search code examples
powershellpowershell-remotingdcom

Start explorer.exe remotely with a path specified in Powershell


The problem I have is that I am able to Invoke-command explorer.exe on a remote machine without giving it any path parameters, yet when I enter:

Invoke-Command -ComputerName PC01 -Credential $cred -ScriptBlock  {explorer.exe "C:\Foldername"} 

Nothing happens, except for the fact that I get an error entry in the logs saying:

The server {75DFF2B7-6936-4C06-A8BB-676A7B00B24B} did not register with DCOM within the required timeout.


Solution

  • First thing, If you are trying this directly on the local system, the GUI will pop up properly.

    Invoke-Command  -ScriptBlock  {C:\Windows\explorer.exe "C:\folder"}
    

    But the problem, is how powershell will open a GUI console invoked from the remote system. Basically, it does not have the session to hold. You need a desktop session to do that.

    In that case, you should use PSEXEC with -i

    psexec -i -d -s c:\windows\explorer.exe C:\folder
    

    Download it from Here: PSExec-v2.11. This link has all the explanations with examples on how to use each utility.

    Hope it helps.