Skip to content

Commit

Permalink
Added ability to specify custom service name for PAExec remote service
Browse files Browse the repository at this point in the history
elyuty committed Mar 31, 2015
1 parent 80ea3b2 commit a65d639
Showing 4 changed files with 12 additions and 4 deletions.
7 changes: 5 additions & 2 deletions Parsing.cpp
Original file line number Diff line number Diff line change
@@ -212,7 +212,8 @@ CommandList gSupportedCommands[] =
{L"rlo", true, true},
{L"dbg", false, false},
{L"to", true, true},
{L"noname", false, false},
{L"noname", false, false},
{L"sname", true, true},
{L"accepteula", false, false} //non-documented PSExec command that we'll just silently eat
};

@@ -536,7 +537,9 @@ bool ParseCommandLine(Settings& settings, LPCWSTR cmdLine)

if(cmdParser.HasKey(L"noname"))
settings.bNoName = true;

else if (cmdParser.HasKey(L"sname"))
settings.serviceName = cmdParser.GetVal(L"sname");

if(cmdParser.HasKey(L"csrc"))
{
if(false == settings.bCopyFiles)
2 changes: 2 additions & 0 deletions Remote.cpp
Original file line number Diff line number Diff line change
@@ -171,6 +171,8 @@ CString GetRemoteServiceName(Settings& settings)
{
if(settings.bNoName)
return L"PAExec";
else if (!settings.serviceName.IsEmpty())
return settings.serviceName;
else
{
//Installed service will use a unique name so we can have multiple running at once
6 changes: 4 additions & 2 deletions Usage.txt
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ Usage: PAExec [\\computer[,computer2[,...]] | @file]
[-u user [-p psswd]|[-p@ file [-p@d]]]
[-n s] [-l][-s|-e][-x][-i [session]][-c [-f|-v] [-csrc path]]
[-lo path][-rlo path][-ods][-w directory][-d][-<priority>][-a n,n,...]
[-dfr][-noname][-to seconds] cmd [arguments]
[-dfr][-noname][-sname name][-to seconds] cmd [arguments]

Standard PAExec\PsExec command line options:

@@ -136,7 +136,9 @@ Additional options only available in PAExec:
-noname In order to robustly handle multiple simultaneous connections to a server,
the source server's name is added to the remote service name and remote PAExec
executable file. If you do NOT want this behavior, use -noname


-sname Remote service name.
This option is not compatible with -noname

The application name, copy source, working directory and log file
entries can be quoted if the path contains a space. For example:
1 change: 1 addition & 0 deletions stdafx.h
Original file line number Diff line number Diff line change
@@ -337,6 +337,7 @@ class Settings
bool bNeedToDeleteServiceFile;
bool bNeedToDeleteService;
bool bNoName;
CString serviceName;
};

class ListenParam

0 comments on commit a65d639

Please sign in to comment.