Products
Solutions
Resources
Customers
Company

Sign in
My Account.
The AppDynamics PowerShell module for .NET agent management provides a set of cmdlets to administrator AppDynamics .NET agents. It includes commands to manage agent inventory, versioning, deployment, and configuration. The script uses PowerShell remoting to manage agents on remote servers so you can use the module to administer agents locally or access remote agents in a datacenter.
To start using the library:
1. Download the module.
2. Unblock the file in Windows.
3. Launch Power Shell and import the module: Import-Module .\AppDynamics.psm1
4. While loading, the module checks for PowerShell version 3.0 or later and if the current user has administrative permissions. It issues a warning if there are problems.
5. Execute commands.
PowerShell 3.0 or later
Windows 7/2003/2008/2008R2/2012/2012R2
Administrator level access for local machine management
Domain administrator access for remote agent management
Many of the cmdlets share the following options:
ComputerName machine1.example.com, machine2.example.com, machine3.example.com
( Get-Content <path to text file> )
.ComputerName ( Get-Content .\Agents.txt )
RestartWindowsServices WindowsService1, WindowsService2, WindowsService3
c$\Temp\AppDynamics\Install\.
RemoteShare d$\temp\AppDynamics\
-RemotePath d:\temp\AppDynamics\
The Get-Agent
cmdlet checks if the .NET Agent is installed and, if so, returns the version.
Get-Agent
# Check agent inventory on the local machine.
Get-Agent
# Check agent inventory on multiple remote machines.
Get-Agent -ComputerName machine1.example.com, machine2.example.com, machine3.example.com
# Check agent inventory on a list of machines and export the results.
Get-Agent -ComputerName ( Get-Content .\servers.txt ) | Export-Csv .\Agents.txt
The Install-Agent
cmdlet installs new agents locally or on remote servers. Optionally restart IIS or Windows services after installation, supply a template configuration, or copy bits to the remote servers from a central location. Once install completes, Install-Agent automatically starts the AppDynamics.Agent.Coordinator service.
See the bottom of this document for information on generating a template configuration file.
Install-Agent <path to MSI installer> <path to configuration template>
#Install the agent locally with no configuration file.
Install-Agent .\dotNetAgentSetup-x64-3.9.5.0.msi
#Install the agent locally with a configuration file.
Install-Agent .\dotNetAgentSetup-x64-3.9.5.0.msi .\template.xml
#Install the agent on a single remote host.
Install-Agent .\dotNetAgentSetup-x64-3.9.5.0.msi .\template.xml -ComputerName machine1.example.com
#Install the agent on multiple remote servers and restart IIS.
Install-Agent .\dotNetAgentSetup-x64-3.9.5.0.msi .\template.xml -ComputerName ( Get-Content .\servers.txt ) -RestartIIS
#Install the agent on multiple remote servers. Restart IIS and and a list of Windows services.
Install-Agent .\dotNetAgentSetup-x64-3.9.5.0.msi .\template.xml -ComputerName ( Get-Content .\servers.txt ) -RestartIIS -RestartWindowsServices Service1, Service2, Service3
You can use the Install-Agent
cmdlet to upgrade the agent. When Install-Agent finds an existing agent on the server, it uses the following logic:
It is very important to restart IIS and/or Windows services instrumented with the .NET Agent. Otherwise uninstall could fail due to locked agent files.
Update-Configuration
cmdlet allows you to set the agent-controller connection. After you restart the instrumented application(s), either as part of the command or later, the new configuration takes effect and overrides any existing ones.
Update-Configuration -Host <FQDN of Controller> -Port <Controller port> -SSL -Application <Controller business application> -AccountName <Controller account> -AccessKey <Controller access key>
See .NET Agent Configuration Properties for definitions of the command options.
#Configure connection to a single-tenant controller with SSL. Restart IIS.
Update-Configuration -Host "controller.example.com" -Port 443 -SSL -Application "Demo Application" -ComputerName machine1.example.com -RestartIIS
#Configure connection to a multi-tenant controller without SSL. Restart IIS and Windows services.
Update-Configuration -Host "controller.saas.example.com" -Port 80 -SSL:$false -Application "Demo Application" -AccountName "MyAccount" -AccessKey "secret$" -ComputerName ( Get-Content .\servers.txt ) -RestartIIS -RestartWindowsServices Service1, Service2, Service3
Update-ConfigurationFromTemplate
cmdlet applies a new configuration template to existing installed agents. Update-ConfigurationFromTemplate <path to configuration template>
#Update agent config locally.
Update-ConfigurationFromTemplate .\template.xml
#Update agent configuration on a series of remote machines and restart IIS
Update-ConfigurationFromTemplate .\template.xml -ComputerName machine1.example.com, machine2.example.com, machine3.example.com
#Update agent configuration on a series of remote machines. Restart IIS and Windows Services
Update-ConfigurationFromTemplate .\template.xml -ComputerName ( Get-Content .\servers.txt ) -RestartIIS -RestartWindowsServices Service1, Service2, Service3
#Install agent configuration remotely. Restart IIS and a Windows Service. Change the location of the remote and local share paths.
Update-ConfigurationFromTemplate .\template.xml -ComputerName ( Get-Content .\servers.txt ) -RestartIIS -RestartWindowsServices Service1 -RemoteShare d$\temp\AppDynamics\ -RemotePath d:\temp\AppDynamics\
Uninstall-Agent
cmdlet uninstalls the .NET Agent from local or remote server(s) from the command line.
Uninstall-Agent
#Uninstall the agent locally. Restart IIS
Uninstall-Agent -RestartIIS
#Uninstall the agent locally. Restart IIS and Windows services.
Uninstall-Agent -RestartIIS -RestartWindowsServices Service1, Service2
##Uninstall the agent remotely. Restart IIS and Windows services.
Uninstall-Agent -RestartIIS -RestartWindowsServices Service1, Service2 -ComputerName machine1.example.com, machine2.example.com
Restart-Coordinator
restarts AppDynamics.Agent.Coordinator windows service.
Restart-Coordinator
#Restart the agent coordinator on multiple remote machines.
Restart-Coordinator -ComputerName machine1.example.com, machine2.example.com
Restart-Coordinator -ComputerName ( Get-Content .\servers.txt )
Get-MsiVersion
cmdlet returns the version of a local msi installer package.Get-MsiVersion <path to MSI installer>
Don't use config.xml as template configuration. Installation will fail because the template configuration requires configuration properties in addition to the config.xml elements.
The most common issue with uninstallation/upgrade is caused by monitored processes locking the agent files. When this happens PowerShell commands return only the generic messages from the Windows installer. For example: “Error 1603”.
How to approach this situation:
Additionally grab the MSI log from the server, logs are %TEMP\AppDynamicsInstall.log and %TEMP\AppDynamicsUninstall.log
If you can’t identify the root cause and resolve the problem then contact AppDynamics support.
v 1.5.3 Update
-SharepointInstall
A new parameter “-SharepointInstall” is introduced for the commandlet “Install-Agent”. This sets the LoaderOptmization Registry key to 1 at the below locations. This setting is specific to address the sharepoint crashes when instrumented with Appdynamics.
HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NETFramework HKLM:\SOFTWARE\Microsoft\.NETFramework
Usage
Install-Agent .\dotNetAgentSetup64.msi -SharePointInstall