{"id":4651,"date":"2023-02-27T10:57:15","date_gmt":"2023-02-27T18:57:15","guid":{"rendered":"https:\/\/SUMMALAI.COM\/?p=4651"},"modified":"2023-02-27T11:46:41","modified_gmt":"2023-02-27T19:46:41","slug":"how-to-install-an-application-remotely-with-psexec","status":"publish","type":"post","link":"https:\/\/SUMMALAI.COM\/?p=4651","title":{"rendered":"How to Install an Application Remotely with PsExec?"},"content":{"rendered":"\n<p>Download PsExec from there.<\/p>\n\n\n\n<p><a href=\"https:\/\/download.sysinternals.com\/files\/PSTools.zip\"><\/a>&nbsp;<a href=\"https:\/\/download.sysinternals.com\/files\/PSTools.zip\"><strong>Download PsTools<\/strong><\/a>&nbsp;<strong>(3.5 MB)<\/strong><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>Quick reference<\/strong><\/p>\n\n\n\n<p>Create a BAT file (For example: cs.bat) with the below command line<\/p>\n\n\n\n<p><em>\\\\File_Server\\CrowdStrike\\WindowsSensor.MaverickGyr.exe&#8221; \/quiet \/norestart CID=4B01xxxxxxxxxxxxx<\/em><\/p>\n\n\n\n<p>Run the below command to install Crowdstrik windows Agent remotely<\/p>\n\n\n\n<p><em>psexec \\\\computer-to-be-installed-on -s -c \\\\File_Server\\CrowdStrike\\cs.bat<\/em><\/p>\n\n\n\n<p>Or you can create a serverlist.txt to install multiple servers with only one command<\/p>\n\n\n\n<p><em>psexec @serverlist.txt -s -c \\\\File_Server\\CrowdStrike\\cs.bat<\/em><\/p>\n\n\n\n<p>If you need to specify a user instead of the system account, please try the below.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><em>psexec \\\\remote-pc -u \u201cDOMAIN\\Administrator\u201d -p \u201cpassword\u201d cmd \/c \u201cmsiexec.exe \/i \u201c\\\\server\\share\\application.msi\u201d \/quiet \/norestart\u201d<\/em><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"introduction\">Introduction<\/h2>\n\n\n\n<p>Utilities like Telnet and remote control programs like Symantec&#8217;s PC Anywhere let you execute programs on remote systems, but they can be a pain to set up and require that you install client software on the remote systems that you wish to access. PsExec is a light-weight telnet-replacement that lets you execute processes on other systems, complete with full interactivity for console applications, without having to manually install client software. PsExec&#8217;s most powerful uses include launching interactive command-prompts on remote systems and remote-enabling tools like IpConfig that otherwise do not have the ability to show information about remote systems.<\/p>\n\n\n\n<p>Note: some anti-virus scanners report that one or more of the tools are infected with a &#8220;remote admin&#8221; virus. None of the PsTools contain viruses, but they have been used by viruses, which is why they trigger virus notifications.<a href=\"https:\/\/learn.microsoft.com\/en-us\/sysinternals\/downloads\/psexec#installation\"><\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"installation\">Installation<\/h2>\n\n\n\n<p>Just copy PsExec onto your executable path. Typing &#8220;psexec&#8221; displays its usage syntax.<a href=\"https:\/\/learn.microsoft.com\/en-us\/sysinternals\/downloads\/psexec#using-psexec\"><\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"using-psexec\">Using PsExec<\/h2>\n\n\n\n<p>See the July 2004 issue of&nbsp;<em>Windows IT Pro Magazine<\/em>&nbsp;for&nbsp;<a href=\"https:\/\/www.itprotoday.com\/compute-engines\/psexec\">Mark&#8217;s article<\/a>&nbsp;that covers advanced usage of PsExec.<\/p>\n\n\n\n<p><strong>Usage:<\/strong><\/p>\n\n\n\n<p>Windows Command PromptCopy<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>psexec &#91;\\\\computer&#91;,computer2&#91;,...] | @file]]&#91;-u user &#91;-p psswd]&#91;-n s]&#91;-r servicename]&#91;-h]&#91;-l]&#91;-s|-e]&#91;-x]&#91;-i &#91;session]]&#91;-c executable &#91;-f|-v]]&#91;-w directory]&#91;-d]&#91;-&lt;priority&gt;]&#91;-a n,n,...] cmd &#91;arguments]\n<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Parameter<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><strong>-a<\/strong><\/td><td>Separate processors on which the application can run with commas where 1 is the lowest numbered CPU. For example, to run the application on CPU 2 and CPU 4, enter: &#8220;-a 2,4&#8221;<\/td><\/tr><tr><td><strong>-c<\/strong><\/td><td>Copy the specified executable to the remote system for execution. If you omit this option the application must be in the system path on the remote system.<\/td><\/tr><tr><td><strong>-d<\/strong><\/td><td>Don&#8217;t wait for process to terminate (non-interactive).<\/td><\/tr><tr><td><strong>-e<\/strong><\/td><td>Does not load the specified account\u2019s profile.<\/td><\/tr><tr><td><strong>-f<\/strong><\/td><td>Copy the specified program even if the file already exists on the remote system.<\/td><\/tr><tr><td><strong>-i<\/strong><\/td><td>Run the program so that it interacts with the desktop of the specified session on the remote system. If no session is specified the process runs in the console session. This flag is&nbsp;<strong>required<\/strong>&nbsp;when attempting to run console applications interactively (with redirected standard IO).<\/td><\/tr><tr><td><strong>-h<\/strong><\/td><td>If the target system is Vista or higher, has the process run with the account&#8217;s elevated token, if available.<\/td><\/tr><tr><td><strong>-l<\/strong><\/td><td>Run process as limited user (strips the Administrators group and allows only privileges assigned to the Users group). On Windows Vista the process runs with Low Integrity.<\/td><\/tr><tr><td><strong>-n<\/strong><\/td><td>Specifies timeout in seconds connecting to remote computers.<\/td><\/tr><tr><td><strong>-p<\/strong><\/td><td>Specifies optional password for user name. If you omit this you will be prompted to enter a hidden password.<\/td><\/tr><tr><td><strong>-r<\/strong><\/td><td>Specifies the name of the remote service to create or interact with.<\/td><\/tr><tr><td><strong>-s<\/strong><\/td><td>Run the remote process in the System account.<\/td><\/tr><tr><td><strong>-u<\/strong><\/td><td>Specifies optional user name for login to remote computer.<\/td><\/tr><tr><td><strong>-v<\/strong><\/td><td>Copy the specified file only if it has a higher version number or is newer on than the one on the remote system.<\/td><\/tr><tr><td><strong>-w<\/strong><\/td><td>Set the working directory of the process (relative to remote computer).<\/td><\/tr><tr><td><strong>-x<\/strong><\/td><td>Display the UI on the Winlogon secure desktop (local system only).<\/td><\/tr><tr><td><strong>-priority<\/strong><\/td><td>Specifies -low, -belownormal, -abovenormal, -high or -realtime to run the process at a different priority. Use -background to run at low memory and I\/O priority on Vista.<\/td><\/tr><tr><td><strong>computer<\/strong><\/td><td>Direct PsExec to run the application on the remote computer or computers specified. If you omit the computer name, PsExec runs the application on the local system, and if you specify a wildcard (\\\\*), PsExec runs the command on all computers in the current domain.<\/td><\/tr><tr><td><strong>@file<\/strong><\/td><td>PsExec will execute the command on each of the computers listed in the file.<\/td><\/tr><tr><td><strong>cmd<\/strong><\/td><td>Name of application to execute.<\/td><\/tr><tr><td><strong>arguments<\/strong><\/td><td>Arguments to pass (note that file paths must be absolute paths on the target system).<\/td><\/tr><tr><td><strong>-accepteula<\/strong><\/td><td>This flag suppresses the display of the license dialog.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>You can enclose applications that have spaces in their name with quotation marks e.g.<\/p>\n\n\n\n<p>Windows Command PromptCopy<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>psexec \\\\marklap \"c:\\\\long name app.exe\"\n<\/code><\/pre>\n\n\n\n<p>Input is only passed to the remote system when you press the Enter key. Typing Ctrl-C terminates the remote process.<\/p>\n\n\n\n<p>If you omit a user name, the process will run in the context of your account on the remote system, but will not have access to network resources (because it is impersonating). Specify a valid user name in the&nbsp;<code>Domain\\User<\/code>&nbsp;syntax if the remote process requires access to network resources or to run in a different account. Note that the password and command are encrypted in transit to the remote system.<\/p>\n\n\n\n<p>Error codes returned by PsExec are specific to the applications you execute, not PsExec.<\/p>\n\n\n\n<p><a href=\"https:\/\/learn.microsoft.com\/en-us\/sysinternals\/downloads\/psexec#examples\"><\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"examples\">Examples<\/h2>\n\n\n\n<p>This article I wrote&nbsp;<a href=\"https:\/\/www.itprotoday.com\/compute-engines\/psexec\">describes how PsExec works<\/a>&nbsp;and gives tips on how to use it:<\/p>\n\n\n\n<p>The following command launches an interactive command prompt on&nbsp;<code>\\\\marklap<\/code>:<\/p>\n\n\n\n<p>Windows Command PromptCopy<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>psexec -i \\\\marklap cmd\n<\/code><\/pre>\n\n\n\n<p>This command executes IpConfig on the remote system with the&nbsp;<code>\/all<\/code>&nbsp;switch, and displays the resulting output locally:<\/p>\n\n\n\n<p>Windows Command PromptCopy<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>psexec -i \\\\marklap ipconfig \/all\n<\/code><\/pre>\n\n\n\n<p>This command copies the program&nbsp;<code>test.exe<\/code>&nbsp;to the remote system and executes it interactively:<\/p>\n\n\n\n<p>Windows Command PromptCopy<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>psexec -i \\\\marklap -c test.exe\n<\/code><\/pre>\n\n\n\n<p>Specify the full path to a program that is already installed on a remote system if its not on the system&#8217;s path:<\/p>\n\n\n\n<p>Windows Command PromptCopy<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>psexec -i \\\\marklap c:\\bin\\test.exe\n<\/code><\/pre>\n\n\n\n<p>Run Regedit interactively in the System account to view the contents of the SAM and SECURITY keys::<\/p>\n\n\n\n<p>Windows Command PromptCopy<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>psexec -i -d -s c:\\windows\\regedit.exe\n<\/code><\/pre>\n\n\n\n<p>To run Internet Explorer as with limited-user privileges use this command:<\/p>\n\n\n\n<p>Windows Command PromptCopy<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>psexec -l -d \"c:\\program files\\internet explorer\\iexplore.exe\"\n<\/code><\/pre>\n\n\n\n<p><a href=\"https:\/\/download.sysinternals.com\/files\/PSTools.zip\"><\/a><em>PsExec<\/em>\u00a0is part of a growing kit of Sysinternals command-line tools that aid in the administration of local and remote systems named\u00a0<em>PsTools<\/em>.<\/p>\n\n\n\n<p><strong>Runs on:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Client: Windows 8.1 and higher.<\/li><li>Server: Windows Server 2012 and higher.<\/li><\/ul>\n\n\n\n<p>Ref: <a href=\"https:\/\/learn.microsoft.com\/en-us\/sysinternals\/downloads\/psexec\">PsExec &#8211; Sysinternals | Microsoft Learn<\/a><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Download PsExec from there. &nbsp;Download PsTools&nbsp;(3.5 MB) Quick reference Create a BAT file (For example: cs.bat) with the below command line \\\\File_Server\\CrowdStrike\\WindowsSensor.MaverickGyr.exe&#8221; \/quiet \/norestart CID=4B01xxxxxxxxxxxxx Run the below command to install Crowdstrik windows Agent remotely psexec \\\\computer-to-be-installed-on -s -c \\\\File_Server\\CrowdStrike\\cs.bat Or you can create a serverlist.txt to install multiple servers with only one command psexec <a class=\"read-more\" href=\"https:\/\/SUMMALAI.COM\/?p=4651\">Read More<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[10,14,15],"tags":[1517,1516,1518],"class_list":["post-4651","post","type-post","status-publish","format-standard","hentry","category-microsoft","category-windows-7-8-10","category-windows-servers","tag-install-an-application-psexec","tag-install-an-application-remotely-with-psexec","tag-psexec"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/4651","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4651"}],"version-history":[{"count":3,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/4651\/revisions"}],"predecessor-version":[{"id":4655,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/4651\/revisions\/4655"}],"wp:attachment":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4651"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4651"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4651"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}