PowerShell script exchange
Post Reply
Andreas Neufert
Veeam Software
Posts: 3713
Liked: 656 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Post Job Script - Remote script without PS & ActiveDirectory

Post by Andreas Neufert » May 13, 2013 8:38 am

Hi everybody,

I searched for an easy way to run a script after backup on a remote System and want to share my ideas and findings with you.
Because the backup admin has no rights and control of the remote system and the admin do not want to make changes on the System, we used the Windows Task Scheduler and start it from remote.

Situation:
- No VMware Tools on the remote VM
- Remote VM not in a Active Directory
- Not possible whyever to change things on the System (open remote powershell stuff)
- Admin on remote VM uses Windows Task Scheduler for other things.


So we did the following:

Remote System:
Added a new task to the windows task scheduler.
- run the task Scheduler to check if everything is working.

B&R Server:

Logon with User that B&R Service runs.

Save the Username and Password for the remote System in the windows Default Password store.- Run:

Code: Select all

rundll32.exe keymgr.dll, KRShowKeyMgr
or brows to the same menu. This is the same place your Passwords are added if you save them when you open a share on a remote computer.
Add the Name of the remote Server or IP address (which you will use later in the script) and Username (servername\username) and Password.
- Open task scheduler and connect to the remote System. Test if you can run the task remotely.

- Create a Folder for your scripts with rights for the user who run the B&R Service (c:\scripts)
- Add a textfile rename it to younameit.cmd (check if filetype is shown in windows explorer so that you not end up with a younameit.cmd.txt)
- Edit the cmd and add

Code: Select all

schtasks /run /S remotenameorip /TN nameoftask 
Add the cmd as Post Job Script in the related Job- Run the Job and check if the script runs succesfully.

Post Reply

Who is online

Users browsing this forum: sammt and 6 guests