A managed computer may have more than one agent installed on it. Not only could there be a local agent, there could be an agent for a remote computer, or an agent for a Net-App server or a cluster. The Get-AEAgentInstances cmdlet finds all agent instances registered with Security Explorer Access Explorer. A filter can be specified to retrieve agent instance information for only a single hosting system. Only managed computers with at least one agent instance (either local or remote) are returned. Note that the computers returned by this cmdlet are not the same as managed hosts; they are the computers that physically host the agent service.
In this example, we look at how to expand the information returned by the Get-AEAgentInstances cmdlet as it is used in other cmdlets, such as the Restart-AEAgent cmdlet. To use the Restart-AEAgent cmdlet to restart an agent on a computer, you need to specify the Agent ID.
The first line stores information on the agent in the $a variable. The second line displays the information stored in the $a.agents property, which is where you find the agent Id, BW_aaabd11494ed4f19921a91b92ee0979d, that you need for the Restart-AEAgent cmdlet.
At some point you may want to look at specific folders and files on a managed computer. The data roots for the agent can be changed with an Access Explorer cmdlet. Note that the cmdlet overwrites the current data roots selection, so if you are already scanning a folder called Files1, and you want to include a folder called Files2, you cannot just add the new folder with the cmdlet. You need to specify both Files 1 and Files 2 in the cmdlet. Also the ID for the agent is required, which can be found using the Get-AEAgentInstances cmdlet. For more information, see .
In this example, the agent with the ID BW_aaabd11494ed4f19921a91b92ee0979d is set to another location for the data roots selection. Any previous setting will be removed as this cmdlet does not add a new data root location, but replaces the current one. Because the managed host ID is provided, the cmdlet does not need to search all of the deployed agent to see if any match the one provided.
In this example, three separate folders on the C:\ Drive are selected for the data roots settings. You can add any number of folders as long as they are separated by a comma. Note that the data root locations are enclosed in quotation marks. The first two data root locations do not need the quotation marks, but the third one does as it contains spaces. It is a good habit to enclose all items like this in quotation marks whether they need them or not.
The restart operations for the specified agent instances are performed asynchronously by the management server. This cmdlet will not wait for the service restart operations to complete before returning.
Restart operations for the agent instances associated with the specified managed computer are performed asynchronously by the management server. This cmdlet will not wait for the service restart operations to complete before returning.
The agent on the managed computer with the ID 33bf3e5b-5edf-4b28-9eee-7fff84de2bca is restarted. Use the Get-AEManagedComputers cmdlet to obtain the value for the ManagedComputerId parameter. This cmdlet does not return any values.