Created
November 12, 2013 07:14
-
-
Save ebibibi/7426819 to your computer and use it in GitHub Desktop.
This script installs SCOM agents to several clients. ex)
.\Install-SCOMAgent.ps1 -ServerName scomserver.domain.name -Targets @("client1.domain.name", "client2.domain.name")
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #This script installs SCOM agents to several clients. | |
| # | |
| #ex) | |
| #.\Install-SCOMAgent.ps1 -ServerName scomserver.domain.name -Targets @("client1.domain.name", "client2.domain.name") | |
| Param( | |
| [parameter(mandatory=$true)]$ServerName, | |
| [parameter(mandatory=$true)]$Targets | |
| ) | |
| $InstallAccount = Get-Credential | |
| $session = New-PSSession -ComputerName $ServerName -Credential $InstallAccount | |
| Invoke-Command -Session $session -ScriptBlock { | |
| Import-Module OperationsManager | |
| foreach($Target in $using:Targets) { | |
| Write-Host "Install SCOM Agent to $Target ..." | |
| $PrimaryMgmtServer = Get-SCOMManagementServer -Name $using:ServerName | |
| Install-SCOMAgent -Name $Target -PrimaryManagementServer $PrimaryMgmtServer -ActionAccount $using:InstallAccount | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment