I do something similar: I use Ansible. Ansible does not have an agent, it uses either WinRM or ssh to get access to Windows. The command to stop a service would be: ansible 'somemachine.customer.tld' -m win_service? -a 'name=mydatabase state=stopped' On 06-10-2021 23:01, Aaron C. de Bruyn via samba wrote:> I use Saltstack. > Install the agent on all your Windows machines. > > From your server: > salt 'somemachine.customer.tld' cmd.run 'sc stop mydatabase' > > -A > > On Wed, Oct 6, 2021 at 1:54 PM Rommel Rodriguez Toirac via samba < > samba at lists.samba.org> wrote: > >> I use the following command to remotely shut down some Windows OS servers >> from >> a Linux OS PC (for example): >> >> net rpc SHUTDOWN -f -I 192.168.1.5 -U Administrador%su_contrasenna -W GTMBD >> >> but in one of them before shutting down I need to run some commands to >> disassemble and close a database system running on it. >> Is there a way to achieve it using some combination of samba? that is, >> from a >> PC with Linux operating system order the execution of a file.bat on a PC >> with >> Windows operating system. >> >> I hope understand the point. >> >> Thank in advance. >> >> -- >> Rommel Rodriguez Toirac >> rommelrt at nauta.cu >> >> -- >> To unsubscribe from this list go to the following URL and read the >> instructions: https://lists.samba.org/mailman/options/samba >>
I use winexe for a few things. I _think_ the source was actually incorporated into Samba ( https://git.samba.org/?p=samba.git;a=commitdiff;h=ffa1c040c625336209a6310e234f5087dd62e984) but I never was able to get it to build successfully. It's been a few years, though. Kris Lou klou at themusiclink.net On Wed, Oct 6, 2021 at 2:15 PM Kees van Vloten via samba < samba at lists.samba.org> wrote:> I do something similar: I use Ansible. > Ansible does not have an agent, it uses either WinRM or ssh to get > access to Windows. > The command to stop a service would be: > > ansible 'somemachine.customer.tld' -m win_service -a 'name=mydatabase > state=stopped' > > > On 06-10-2021 23:01, Aaron C. de Bruyn via samba wrote: > > I use Saltstack. > > Install the agent on all your Windows machines. > > > > From your server: > > salt 'somemachine.customer.tld' cmd.run 'sc stop mydatabase' > > > > -A > > > > On Wed, Oct 6, 2021 at 1:54 PM Rommel Rodriguez Toirac via samba < > > samba at lists.samba.org> wrote: > > > >> I use the following command to remotely shut down some Windows OS > servers > >> from > >> a Linux OS PC (for example): > >> > >> net rpc SHUTDOWN -f -I 192.168.1.5 -U Administrador%su_contrasenna -W > GTMBD > >> > >> but in one of them before shutting down I need to run some commands to > >> disassemble and close a database system running on it. > >> Is there a way to achieve it using some combination of samba? that is, > >> from a > >> PC with Linux operating system order the execution of a file.bat on a PC > >> with > >> Windows operating system. > >> > >> I hope understand the point. > >> > >> Thank in advance. > >> > >> -- > >> Rommel Rodriguez Toirac > >> rommelrt at nauta.cu > >> > >> -- > >> To unsubscribe from this list go to the following URL and read the > >> instructions: https://lists.samba.org/mailman/options/samba > >> > > > -- > To unsubscribe from this list go to the following URL and read the > instructions: https://lists.samba.org/mailman/options/samba >
Isn't there a GPO template allowing you to run a script on a machine when it shuts down? On 10/6/21 16:15, Kees van Vloten via samba wrote:> I do something similar: I use Ansible. > Ansible does not have an agent, it uses either WinRM or ssh to get > access to Windows. > The command to stop a service would be: > > ansible 'somemachine.customer.tld' -m win_service? -a 'name=mydatabase > state=stopped' > > > On 06-10-2021 23:01, Aaron C. de Bruyn via samba wrote: >> I use Saltstack. >> Install the agent on all your Windows machines. >> >> ?From your server: >> salt 'somemachine.customer.tld' cmd.run 'sc stop mydatabase' >> >> -A >> >> On Wed, Oct 6, 2021 at 1:54 PM Rommel Rodriguez Toirac via samba < >> samba at lists.samba.org> wrote: >> >>> I use the following command to remotely shut down some Windows OS >>> servers >>> from >>> a Linux OS PC (for example): >>> >>> net rpc SHUTDOWN -f -I 192.168.1.5 -U Administrador%su_contrasenna -W >>> GTMBD >>> >>> but in one of them before shutting down I need to run some commands to >>> disassemble and close a database system running on it. >>> Is there a way to achieve it using some combination of samba? that is, >>> from a >>> PC with Linux operating system order the execution of a file.bat on a PC >>> with >>> Windows operating system. >>> >>> I hope understand the point. >>> >>> Thank in advance. >>> >>> -- >>> Rommel Rodriguez Toirac >>> rommelrt at nauta.cu >>> >>> -- >>> To unsubscribe from this list go to the following URL and read the >>> instructions:? https://lists.samba.org/mailman/options/samba >>> > >