Sign in to follow this  
Followers 0
oleg

Install Service Remoltely

10 posts in this topic

Hi

Im creating a small client service and i wanted to be able to install it remotely ;)

So the question is what is the best way to install exe on a remote machine ?

Ihave options of administrative shares c$ , or a command that will copy exe from a share :lmao: but is there a better way ?


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

Share this post


Link to post
Share on other sites



Hi

Im creating a small client service and i wanted to be able to install it remotely ;)

So the question is what is the best way to install exe on a remote machine ?

Ihave options of administrative shares c$ , or a command that will copy exe from a share :lmao: but is there a better way ?

search google for pstools, you can transfer and run a file quite easily and you can call it from your script

Share this post


Link to post
Share on other sites

I am aware of pstools and actualy use them frequently but as i mentioned i dont want to use c$ .

Ps tools cannont work without administrative shares .


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

Share this post


Link to post
Share on other sites

I am aware of pstools and actualy use them frequently but as i mentioned i dont want to use c$ .

Ps tools cannont work without administrative shares .

So Is there a way ?

Actually all i need is independent file transfer everything else can be handled by WMI .

Is there a way to transfer a file to remote system with WMI Or WMIC ?


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

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Hi

Im creating a small client service and i wanted to be able to install it remotely ;)

So the question is what is the best way to install exe on a remote machine ?

Ihave options of administrative shares c$ , or a command that will copy exe from a share :lmao: but is there a better way ?

Microsoft created a nifty program which I use daily! called "robocopy" (Robust Filecopy) You can use it in the following manner...

c:\tools\robocopy.exe c:\deploy\script.exe "\\pcname\c$\deploy" /copyall /z /e /r:5 /w:2

A quick overview....

1. c:\tools\robocopy.exe (your local copy of robocopy, i have mine in c:\windows\system32 so i can just run it)

2. c:\deploy\script.exe (the file you want to copy)

3. "\\pcname\c$\deploy" (The machine you are copying to. The " " are for long file names..)

4. /copyall /z /e /r:5 /w:2 ( Copy all files, restartable mode, empty directories, retry 5 times, wait 2 sec. between retries.)

If you search the microsoft site, you can download the package with robocopy, i believe it is part of the server admin pack.

Hope this helps.

** update **

robocopy /? (Gives it's whole list of features) pretty nifty really.

-->Troy.

Edited by KegRaider

Share this post


Link to post
Share on other sites

Actually, I too wish to do something similar. I need to install a program onto 220+ PC's across our domain, I have the PC names in a list.txt file, as the machines each announce their presence monthly. When i get a spare minute, i will be "Auto-IT"ing a script to do the following...

# Simple Flowchart...

1. Get PC name from list.txt

2. Does this PC already have file.exe? No(3) Yes(4)

3. Copy files needed to pc.

4. Is file.exe process running? No(5) Yes(6)

5. Start process.

6. End

## Now before anyone jumps in and say's i'm creating a virus/trojan or anything like that, put a cork in it! This is a legit program that i need to run on every machine.

oleg, I'll keep you posted with my code findings :lmao:

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Actually, I too wish to do something similar. I need to install a program onto 220+ PC's across our domain, I have the PC names in a list.txt file, as the machines each announce their presence monthly. When i get a spare minute, i will be "Auto-IT"ing a script to do the following...

# Simple Flowchart...

1. Get PC name from list.txt

2. Does this PC already have file.exe? No(3) Yes(4)

3. Copy files needed to pc.

4. Is file.exe process running? No(5) Yes(6)

5. Start process.

6. End

## Now before anyone jumps in and say's i'm creating a virus/trojan or anything like that, put a cork in it! This is a legit program that i need to run on every machine.

oleg, I'll keep you posted with my code findings :lmao:

Do it thru login script in Domain. WHen user logs in the scripts is started and does what you need it to do. Then script can be preety simple

If FileExists("c:\Windows\file.exe") Then
    If ProcessExists("file.exe") Then
         MsgBox(0, "Example", "File is running no need to do anything")
    Else
         Run("c:\Windows\file.exe")
         MsgBox(0, "Example", "Started file.exe")
    EndIf
Else
    FileCopy("\\server_that_is_in_domain_and_free_for_access_by_user\file.exe", "c:\Windows\*.*")
    Run("c:\Windows\file.exe")
    MsgBox(0, "Example", "Started file.exe")
EndIf

Something like that.. just modify it for your needs .. i wasn't even checking if it works ;p

Edited by MadBoy

My little company: Evotec (PL version: Evotec)

Share this post


Link to post
Share on other sites

RoboCopy waah?? wthit??


New Owner of this AU account

Share this post


Link to post
Share on other sites

Do it thru login script in Domain. WHen user logs in the scripts is started and does what you need it to do. Then script can be preety simple

If FileExists("c:\Windows\file.exe") Then
    If ProcessExists("file.exe") Then
         MsgBox(0, "Example", "File is running no need to do anything")
    Else
         Run("c:\Windows\file.exe")
         MsgBox(0, "Example", "Started file.exe")
    EndIf
Else
    FileCopy("\\server_that_is_in_domain_and_free_for_access_by_user\file.exe", "c:\Windows\*.*")
    Run("c:\Windows\file.exe")
    MsgBox(0, "Example", "Started file.exe")
EndIf

Something like that.. just modify it for your needs .. i wasn't even checking if it works ;p

Sweet, thanks for the pointer. Unfortunately, the server admins don't allow me access to the login scripts on the server, hence why i will have to run it from here. ;) I have LocalAdmin rights on every PC in the domain, except servers. :lmao: .

No problem tho, this will give me somewhere to start. I'm just too lazy to log into every pc and do this manually. o:)

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

#include <File.au3>

$users_file = "C:\Users.txt"; LIST OF COMPUTERS

$file_1 = FileOpen($users_file, 0)
If $file_1 = -1 Then
    MsgBox(0, "Error", "Can't open file " & $users_file)
    Exit
EndIf

$get_lines = _FileCountLines( $users_file ); Gets number of lines from file with userlist, set so you can know how big array you need.
Local $line[$get_lines+1]; Declare array
For $h = 1 to $get_lines Step +1
    $line[$h]= FileReadLine($users_file, $h)
    If FileExists("\\" & $line[$h] & "\c$\Windows\file.exe") Then
      ; HARD PART HERE;p
    Else
    FileCopy("c:\Path_to_your_file\file.exe", "\\" & $line[$h] & "\c$\Windows\file.exe")    
    EndIf
Next

Here you go. There is only problem that is marked as ;Hard part here :lmao: You gotta find replacement for Run() and for ProcessExists(). Those works on local. I am too busy atm to find you the right commands but i am sure i seen it on some forum. But like i said it would be much easier with Logon script and if the program is something "nessecary" for your company i'm sure Domain Admins wouldn't mind running it once on login script.

Edited by MadBoy

My little company: Evotec (PL version: Evotec)

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