Sign in to follow this  
Followers 0
oleg

Launch Application Remotely

7 posts in this topic

#1 ·  Posted (edited)

Hi

Im writing a small toolkit and want to add a feature of launching interactive applications on remote pcs .

DONT THROW SEARCH FOR PSTOOLS at me :lmao: I want to use as less third party software as possible .

For now my options is.

PsTools o:) BAD

Launch with wmi non interactive :king: BAD

Launch with wmi schedule task :lol: BAD

So i have wrote TCP/IP Command Service application that listens for commands and executes them.

Im using srvany.exe and wmi to install it remotely.

The problem is i want to run it under specifeied user accounts interactively but when i try to install it as service it fails :) I have noticed that windows on its own dont provide the abilty to run interactivley under user accounts .

The problem is that when installed as service under "LocalSytem" account it runs interactively but no acess to the network ;) i can run it as network service but then again its not what i want ;)

So the question is dose anybody has an idea how to run service under user accounts interactively without using tools such firedaemon .

Should i look for another process/service tool taht will allow to run under user accounts interactively ?

Is there other way to launch process remotely and interactively under specified user account?

Thanks Dudes ;)

Edited by oleg

There is a hex ( 31303030303030 ) reasons i love AutoIt !

Share this post


Link to post
Share on other sites



anybody ?


There is a hex ( 31303030303030 ) reasons i love AutoIt !

Share this post


Link to post
Share on other sites

@Oleg you have like 6 different questions that do not have the same answer. o:) If you are wanting to add the auto it script as a service you are going to have to install it using the SC command via the command line. You can then configure it MMC to run as the user you want it to. :lmao: As far as remote installation goes all you need is a share on the remote host and access to the SC command. SC will install/remove/restart/enable/disable services on a remote and local machine. I really have no clue what you are trying to do so if you could please respond back and provide me with a little more detail that would be great else all I have to say is: HUH? ;)


[quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()

Share this post


Link to post
Share on other sites

Oh yeah, one more quick thing. You have have to have the Windows Support Tools installed on the machine you are trying to deploy the software with. You may or may not, I can't remember.


[quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()

Share this post


Link to post
Share on other sites

Again, if you are just wanting to launch the application as a certain user via the network you could have a script that listens for a certain packet, using Beta ofcourse, and then use the RunAsSet() once the packet has been recieved and then you may not have to use a service.


[quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Hi Thanks for the reply .

What im trying to do is

Install autoit service that executes commands remotely .

I would like to execute commands remotely without using service mentioned above if possible .

The main problem that i want to executed applications to run INTERACTIVELY and under SPECIFIED USER ACCOUNTS .

I have the script that uses srvany and installs autoit service on the machine but im not able to execute INTERACTIVELY. The only way to run interactively is to run service unedr "LocalService" but when using RunAsSet there is no privilidges to run apps under other users accounts :lmao:

If service installed under normal user accounts RunAsSet works but still applications is not runed interactively .

Forgot to mention i dont want to acess system physically only remotely .

So either im going to start autoit service or install it as windows service this should be done remotely .

Here is the part of script that installs the service

;Service Installing Procedure

Func Connect()

If Not $strComputer = "" Then

GUICtrlSetData($mainstatus, "Connecting To :" & $strComputer)

$objLocator = ObjCreate ( "WbemScripting.SWbemLocator")

$objWMIService = $objLocator.ConnectServer ($strComputer, "root/cimv2", $strComputer & "\" & $Username, $Password)

$objWMIService.Security_.impersonationlevel = 3

Check()

Else

GUICtrlSetData($mainstatus, "Input Error ! Try Again")

EndIf

EndFunc ;==>Connect

Func Check()

If FileExists("\\" & $strComputer & "\Admin$") Then

GUICtrlSetData($mainstatus, "Admin$ Alredy Exist")

Sleep(1000)

install()

Else

Share()

EndIf

EndFunc ;==>Check

Func Share()

$objNewShare = $objWMIService.Get ("Win32_Share")

$errReturn = $objNewShare.Create ("C:\Windows\", "Admin$", "0", "1", "", 1)

If $errReturn = 22 Then

GUICtrlSetData($mainstatus, "Share Already Associated")

Sleep(1000)

EndIf

install()

EndFunc ;==>Share

Func Install()

GUICtrlSetData($mainstatus, "Installing Service")

FileInstall("exe\service.exe", "\\" & $strComputer & "\Admin$\system32\service.exe", 1)

FileInstall("exe\srvany.exe", "\\" & $strComputer & "\Admin$\system32\srvany.exe", 1)

If @error = 1 Then

GUICtrlSetData($mainstatus, "Error Installing Service Application")

EndIf

$objNewService = $objWMIService.Get ("Win32_Service")

$errReturn = $objNewService.Create ("ToolSv", "Smartlaunch Toolkit Service", "C:\Windows\System32\srvany.exe", "16", "0", "Automatic", "False",".\test","test")

If $errReturn = 0 Then

GUICtrlSetData($mainstatus, "Successfully Installed")

Sleep(1000)

Else

If $errReturn = 23 Then

GUICtrlSetData($mainstatus, "Service Already Installed")

Sleep(1000)

Else

GUICtrlSetData($mainstatus, "Error Occured :"&$errReturn)

Sleep(5000)

EndIf

EndIf

Register()

EndFunc ;==>install

Func Register()

GUICtrlSetData($mainstatus, "Connecting To :" & $strComputer)

$objLocator = ObjCreate ( "WbemScripting.SWbemLocator")

$objWMIService = $objLocator.ConnectServer ($strComputer, "Root\DEFAULT", $strComputer & "\" & $Username, $Password)

$objWMIService.Security_.impersonationlevel = 3

$objRegistry = $objWMIService.Get("StdRegProv")

$errReturn = $objRegistry.CreateKey("2147483650","SYSTEM\CurrentControlSet\Services\ToolSv\Parameters")

$errReturn = $objRegistry.SetStringValue("2147483650","System\CurrentControlSet\Services\ToolSv\Parameters\","Application",@SystemDir&"\service.exe")

GUICtrlSetData($mainstatus,$errReturn)

start()

EndFunc

Func Start()

GUICtrlSetData($mainstatus, "Starting Service On :" & $strComputer)

$objLocator = ObjCreate ( "WbemScripting.SWbemLocator")

$objWMIService = $objLocator.ConnectServer ($strComputer, "root/cimv2", $strComputer & "\" & $Username, $Password)

$objWMIService.Security_.impersonationlevel = 3

$colListOfServices = $objWMIService.ExecQuery("Select * from Win32_Service Where Name ='ToolSv'")

For $objService in $colListOfServices

$errReturn = $objService.StartService()

GUICtrlSetData($mainstatus,$errReturn)

Next

EndFunc

Edited by oleg

There is a hex ( 31303030303030 ) reasons i love AutoIt !

Share this post


Link to post
Share on other sites

Hi Thanks for the reply .

What im trying to do is

Install autoit service that executes commands remotely .

I would like to execute commands remotely without using service mentioned above if possible .

The main problem that i want to executed applications to run INTERACTIVELY and under SPECIFIED USER ACCOUNTS .

I have the script that uses srvany and installs autoit service on the machine but im not able to execute INTERACTIVELY. The only way to run interactively is to run service unedr "LocalService" but when using RunAsSet there is no privilidges to run apps under other users accounts ;)

If service installed under normal user accounts RunAsSet works but still applications is not runed interactively .

Forgot to mention i dont want to acess system physically only remotely .

So either im going to start autoit service or install it as windows service this should be done remotely .

Here is the part of script that installs the service

;Service Installing Procedure

Func Connect()

If Not $strComputer = "" Then

GUICtrlSetData($mainstatus, "Connecting To :" & $strComputer)

$objLocator = ObjCreate ( "WbemScripting.SWbemLocator")

$objWMIService = $objLocator.ConnectServer ($strComputer, "root/cimv2", $strComputer & "\" & $Username, $Password)

$objWMIService.Security_.impersonationlevel = 3

Check()

Else

GUICtrlSetData($mainstatus, "Input Error ! Try Again")

EndIf

EndFunc ;==>Connect

Func Check()

If FileExists("\\" & $strComputer & "\Admin$") Then

GUICtrlSetData($mainstatus, "Admin$ Alredy Exist")

Sleep(1000)

install()

Else

Share()

EndIf

EndFunc ;==>Check

Func Share()

$objNewShare = $objWMIService.Get ("Win32_Share")

$errReturn = $objNewShare.Create ("C:\Windows\", "Admin$", "0", "1", "", 1)

If $errReturn = 22 Then

GUICtrlSetData($mainstatus, "Share Already Associated")

Sleep(1000)

EndIf

install()

EndFunc ;==>Share

Func Install()

GUICtrlSetData($mainstatus, "Installing Service")

FileInstall("exe\service.exe", "\\" & $strComputer & "\Admin$\system32\service.exe", 1)

FileInstall("exe\srvany.exe", "\\" & $strComputer & "\Admin$\system32\srvany.exe", 1)

If @error = 1 Then

GUICtrlSetData($mainstatus, "Error Installing Service Application")

EndIf

$objNewService = $objWMIService.Get ("Win32_Service")

$errReturn = $objNewService.Create ("ToolSv", "Smartlaunch Toolkit Service", "C:\Windows\System32\srvany.exe", "16", "0", "Automatic", "False",".\test","test")

If $errReturn = 0 Then

GUICtrlSetData($mainstatus, "Successfully Installed")

Sleep(1000)

Else

If $errReturn = 23 Then

GUICtrlSetData($mainstatus, "Service Already Installed")

Sleep(1000)

Else

GUICtrlSetData($mainstatus, "Error Occured :"&$errReturn)

Sleep(5000)

EndIf

EndIf

Register()

EndFunc ;==>install

Func Register()

GUICtrlSetData($mainstatus, "Connecting To :" & $strComputer)

$objLocator = ObjCreate ( "WbemScripting.SWbemLocator")

$objWMIService = $objLocator.ConnectServer ($strComputer, "Root\DEFAULT", $strComputer & "\" & $Username, $Password)

$objWMIService.Security_.impersonationlevel = 3

$objRegistry = $objWMIService.Get("StdRegProv")

$errReturn = $objRegistry.CreateKey("2147483650","SYSTEM\CurrentControlSet\Services\ToolSv\Parameters")

$errReturn = $objRegistry.SetStringValue("2147483650","System\CurrentControlSet\Services\ToolSv\Parameters\","Application",@SystemDir&"\service.exe")

GUICtrlSetData($mainstatus,$errReturn)

start()

EndFunc

Func Start()

GUICtrlSetData($mainstatus, "Starting Service On :" & $strComputer)

$objLocator = ObjCreate ( "WbemScripting.SWbemLocator")

$objWMIService = $objLocator.ConnectServer ($strComputer, "root/cimv2", $strComputer & "\" & $Username, $Password)

$objWMIService.Security_.impersonationlevel = 3

$colListOfServices = $objWMIService.ExecQuery("Select * from Win32_Service Where Name ='ToolSv'")

For $objService in $colListOfServices

$errReturn = $objService.StartService()

GUICtrlSetData($mainstatus,$errReturn)

Next

EndFunc

I'm not going to lie to you brotha. I totaly understand the concept of what you are trying to do, but your functions look like they contain VBS or something in them and I really don't know anything about it. Sorry man! Wish I could help more. :lmao:


[quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0