Deploy script to muliple server

This topic contains 2 replies, has 2 voices, and was last updated by  Benito 2 years, 5 months ago.

  • Author
    Posts
  • #23075

    Benito
    Participant

    Hi ,

    I found a script from a guy to automate zabbix agent deployment after some fiddling with it I got I working. But now am trying to mass deploy it to all my domain servers. But I have no Idea how to do this.
    I tried the following after some googling but I lack the knowhow :

    Invoke-Command -ComputerName fine-rdsh01 -ScriptBlock {C:\Zabbix-Install.ps1} -Credential

    Can send one send me in the correct direction ?

  • #23076

    Don Jones
    Keymaster

    Well, you didn't mention why that command didn't work, but it's basically the correct syntax.

    It does assume that the script is C:\Zabbix-Install.ps1 [b]on each of the computers[/b] – meaning this assumes you've deployed the script already, and just need to run it. If the script is on your computer, then use -FilePath instead of -ScriptBlock to refer to your local script.

    This also assumes that the remote machines are allowed to run scripts according to their ExecutionPolicy.

  • #23077

    Benito
    Participant

    Thx for the feedback , -FilePath worked 🙂

You must be logged in to reply to this topic.