I'm trying to script something which I've done parts of in the past, but not together at once and need some assistance, please...
Overall, I'm trying to add hostnames as direct members to a different collection referenced on the same row of a CSV source. Below is an example of the CSV source which states the hostname in the first column and its domain in a 2nd column. A collection already exists per domain which is "Prod Servers: domainfqdn". For example, below is a similar CSV with headers:
svr_name,svc_domainfqdn
SYSTEM1,DOMAIN.5.com
SYSTEM2,DOMAIN.6.com
SYSTEM3,DOMAIN.4.org
SYSTEM8,DOMAIN.6.local
The desired result is that once the script executes, the following occurs:
The hostname "SYSTEM1" is added via direct rule to the collection "Prod Servers: DOMAIN.5.com"
The hostname "SYSTEM2" is added via direct rule to the collection "Prod Servers: DOMAIN.6.com"
The hostname "SYSTEM3" is added via direct rule to the collection "Prod Servers: DOMAIN.4.org"
The hostname "SYSTEM8" is added via direct rule to the collection "Prod Servers: DOMAIN.6.local"
I've added systems to a single collection many times before using powerShell using something similar to the below, but am at a loss for how to add to multiple collections all within the same source.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.
Hey Guys / Niall -
I'm trying to script something which I've done parts of in the past, but not together at once and need some assistance, please...
Overall, I'm trying to add hostnames as direct members to a different collection referenced on the same row of a CSV source. Below is an example of the CSV source which states the hostname in the first column and its domain in a 2nd column. A collection already exists per domain which is "Prod Servers: domainfqdn". For example, below is a similar CSV with headers:
The desired result is that once the script executes, the following occurs:
I've added systems to a single collection many times before using powerShell using something similar to the below, but am at a loss for how to add to multiple collections all within the same source.
I've already created the collections for each domain, so no need to have the script check for them or do so.
Any suggestions? Thanks!
Share this post
Link to post
Share on other sites