Deploy script to muliple server

Welcome Forums General PowerShell Q&A Deploy script to muliple server

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
3 years, 7 months ago.

  • Author
    Posts
  • #23075

    Participant
    Points: 0
    Rank: Member

    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

    Keymaster
    Points: 2
    Rank: Member

    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 on each of the computers – 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

    Participant
    Points: 0
    Rank: Member

    Thx for the feedback , -FilePath worked 🙂

The topic ‘Deploy script to muliple server’ is closed to new replies.