如何组合具有不同属性的自定义 psobject

如何组合具有不同属性的自定义 psobject

我制作了多个 psobject。它们都是具有 noteproperty 属性的相同对象类型。我将示例对象导出为 CSV,可以通过将文件直接导入对象来创建它们

[psobject]$object=Import-Csv <file>.csv

策略对象:

"Type","Policy Name","Policy ENCcription","Store","Last Modified","GUID","Assigned","Polling Interval","MainMode LifeTime","Master PFS","Main Mode Security Method Order(1)","Main Mode Security Method Order(2)","Main Mode Security Method Order(3)","Main Mode Security Method Order(4)","Main Mode Security Method Order(5)","No. of Rules"
"Policy","AD DC Failsafe IPSec policy","Permits inter-DC replication traffic, AD as client....","Local Store","11/2/2017 8","{GUID}","NO","180 minutes","480 minutes / 0 Quick Mode sessions","NO","Encryption     Integrity      DH Group","3ENC          INT1          (2)","3ENC          INT5           (2)","ENC           INT1          (1)","ENC           INT5           (1)","4"

规则对象:

"Type","Rule ID","Rule Name","Rule Description","Last Modified","Activated","Connection Type","Authentication Methods(1)"
"Rule","1,  GUID = {GUID}","NONE","","11/2/2017 8","YES","ALL","KERBEROS"

过滤对象:

"Type","Filter Description","Mirrored","Source IP Address","Source DNS Name","Destination IP Address","Destination Mask","Destination DNS Name","Protocol","Source Port","Destination Port"
"Filter","DC as DNS client.","YES","<My IP Address>","<My IP Address>","<A Specific IP Address>","255.255.255.255","<A Specific IP Address>","UDP","ANY","53"

然后最终结果是一个具有所有属性的对象,我可以将其导出到 CSV 以供 Excel 操作。虽然我只给了你 3 个对象,但我有 5 种对象类型,总共 197 个对象。我计划使用此处的过程来循环遍历其余对象。

相关内容