This Script was created to deploy Operations Manager Agent remotely using Powershell.

Simply edit the PS1 file based on the comments in the file to match your environment and you will have a simple way of deploying Agent of Operations Manager 2012.

Be sure to take note of the comments in the PS1 file to insert your input according to your environment.


## Enter Variables## The first line stores the name of target computers in the $Agents variables## The second line the user for credentials and stores the credentials in the $InstallAccount variable.## The third line the user for a password for a user account named ActionAccount in the lab domain, and stores the credentials in the $AgentActionAccount variable.## The fourth line gets the management server object named OM.Lab.local and stores the object in the $PrimaryMgmtServer variable.## The fifth line installs an agent on the target computers stored in the $Agents variable by using the credentials stored in $InstallAccount. The command sets the primary management server for the agent to the management server stored in $PrimaryMgmtServer, and sets the agent action account to the ActionAccount user stored in $AgentActionAccount.$Agents = "Lync-FE13.lab.local"$InstallAccount = Get-Credential$AgentActionAccount = Get-Credential Lab\administrator 
$PrimaryMgmtServer = Get-SCOMManagementserver -ComputerName OM.Lab.local 
Install-SCOMAgent -DNSHostName $Agents-PrimaryManagementServer $PrimaryMgmtServer-ActionAccount $InstallAccount-AgentActionAccount $AgentActionAccount-Confirm


You can use this script in following steps:    

  1. Download the script and copy it to your Server.
  2. Open it using PowerShell
  3. Scroll down to the end of the script file, and then add Operations Manager Server name, Credentials and target machine which want to deploy Agent on it.
  4. Save the file and then run the script on the computer.