Distinguishing LInux Media Agents from Windows using PS SDK V2

  • 3 October 2022
  • 5 replies

Is there a canonical way using the Powershelll SDK V2 to tell the Linux media agents from the Windows media agents? 

(When it comes time each month to apply Windows patches, putting the Linux media agents into maintenance mode just because they’re media agents aggravates my OCD.) 

5 replies

Userlevel 4
Badge +10

Hello @Nick Laflamme II 


I am not sure if this will be the answer you want but will definitely be easy and would work:) Could you create a couple of client computer groups with the automatic selection rules for media agent package or role and OS is Linux or windows. 

then simply run the maintenance task on the windows only group?





Userlevel 7
Badge +18

@Nick Laflamme II unfortunately this is not so easy as I would like it to be. I think you can only achieve this by iterating through the output of "get-server -ShowOnlyInfrastructureMachines $true" and parsing the output of it per item to compare it against the get-MediaAgent output. 

as suggested by @Graham Swift the easiest way is to setup smart server groups en populate them dynamically using automatic association rules. once you have prepped the groups it becomes much easier to achieve the end-goal by leveraging Get-ServerGroupDetail which contains a member called AssociatedServers. 

I prefer solutions that don’t have prerequisites, like setting up a smart client group. I understand the logic and don’t disagree with it; it’s just not “the way I roll.” I might as well depend on our local naming convention for media agents. OK, end of digression, back to implementing now that I know I wasn’t missing anything. 😎

Userlevel 7
Badge +18

I feel your "pain”, but I think the issue here is how Commvault threads a MA. It's just a role that is applied to a server object so they decouple it and glue it together. Now it might be that there is V2 API call that you can perform which addresses this automatically which is currently not being used by the SDK. So you might consider looking into swagger to see if you find the nugget.

Oh, absolutely, if it’s not in the REST API, I can’t expect it in the SDK. If it’s in the REST API, there’s always Invoke-RESTmethod. 😀 For example, I’m now looking for ways to set maintenance mode….