Usual way to do this within a script, basic idea is below
- Run a powershell remote session specifying the target windows server
- Once a remote powershell session is established the .bat file can be executed in a 'scriptblock' in the powershell
- The powershell will then keep running for the duration of the .bat file
- The Powershell will exit with the LASTEXIT code of the scriptblock and so the .bat file
Security wise can either use passthru from Linux onto Windows (same user/pass) or when the remote powershell session is started creds can be passed to eh Powershell script. It is useful to note that DUAS uprocs have a password type variable which is unreadible (a powershell type uproc could be specified or a script could be called by a Cl type uproc)
Need to be careful of an double hops as the source for running hte .bat is a remote server and the .bat itelf may be going to a remote DB for example.
Original Message:
Sent: Sep 15, 2023 07:20 AM
From: Melodi Roberts
Subject: Using Powershell (Core) on Linux Agent to execute Bat files on Windows VM
I read a post that indicated some were using powershell to log into and execute commands/jobs on machines on the network.
It appears to be an alternative to installing the windows agent on the machine that houses the commands and software that needs to be executed.
I understand it is perhaps not the optimal solution and does reduce the use of functionality of automic, but we do not have a license at this time to install an agent on a windows machine, and the project still needs to get done.
I was wondering if anyone has use the powershell option, and can share their experience.
Is there a way to still use automic built in logins functionality, with its encrypted passwords, in the powershell scripts or are you handling that security is some other way?
Thank you so much for any tips.