Hi There,
I have be trying to run a script i found on this site but with no Joy. the script is :
$list = get-content C:\Hostnames.txt
$agents = foreach($agent in $list){get-agent | where{$_.ComputerName -eq $agent}}
Uninstall-Agent -AgentManagedComputer $agents
where i am just trying with a test server in the Hostnames.txt file. when i run this script i get the below error:
Uninstall-Agent : Cannot validate argument on parameter 'AgentManagedComputer'. Theargument is null or empty. Supply an argument that is not null or empty and then try the command again.
At C:\scom.ps1:3 char:38
+ Uninstall-Agent -AgentManagedComputer <<<< $agents
+ CategoryInfo : InvalidData: (:) [Uninstall-Agent], ParameterBinding
ValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Enterpris
eManagement.OperationsManager.ClientShell.UninstallAgentManagedComputerCmdlet Is there anything i am doing wrong here? or is there another way of uninstalling over a 100 SCOM 2007 R2 agents from servers. Many Thanks for any feedback.