Running Programs with PsExec64 as System User
PsExec64 is a powerful tool that allows users to run programs and scripts on remote systems. One common use case is running a program as a system user, which can be done using the following command:
psexec64 -s -i cmdThis command opens a new command prompt window running as the system user. From this window, you can run any program or script that you have permissions to execute.
Example: Running a Synchronization Task with ToyCmd
Suppose you want to run a synchronization task using ToyCmd, a command-line tool for synchronizing files and directories. You can use PsExec64 to run ToyCmd as the system user, ensuring that the synchronization task has the necessary privileges to complete successfully.
psexec64 -s -i cmd > gcpm > toycmd.exe -sync Source DestinationIn this example, the "gcpm" command is used to open the Group Policy Management Editor, and the ToyCmd synchronization task is run with the "-sync" option, specifying the source and destination directories.
Using PsExec64 with PowerShell
PsExec64 can also be used with PowerShell to run scripts and commands on remote systems. Here's an example of how to run a PowerShell script as the system user:
psexec64 -s -i powershell.exe -File C:\path\to\script.ps1In this example, the PowerShell script "script.ps1" is executed as the system user on the local system. Note that you may need to modify the execution policy of PowerShell to allow running scripts in this way.
Using PsExec64 with Task Scheduler
Another common use case for PsExec64 is running scripts and programs as scheduled tasks. Here's an example of how to create a scheduled task that runs a PowerShell script as the system user:
- Open the Task Scheduler and create a new task.
- In the "General" tab, set the "Run whether user is logged on or not" and "Run with highest privileges" options.
- In the "Actions" tab, add a new action that runs the following command:
- In the "Triggers" tab, set the schedule for the task.
psexec64 -s -i powershell.exe -File C:\path\to\script.ps1
With these steps, the PowerShell script "script.ps1" will be executed as the system user at the specified schedule.
PsExec64 is a powerful tool for running programs and scripts on remote systems as the system user. By using PsExec64 with tools like ToyCmd and PowerShell, you can perform a wide range of tasks with the necessary privileges to complete them successfully. Additionally, PsExec64 can be used with Task Scheduler to automate these tasks at specified schedules.