Моя цель - выводить каждый объект группы по отдельности, но в порядке Start_Order. Из Count вы можете видеть, что под одним и тем же именем_сервера есть несколько объектов.
Мой код сейчас упаковывает все вместе.
Вывод должен быть:
Server_Name Service_Name
USOHCLIENT901 DISP01 #organized by Start_Order, Start_Order =1
DISP03 #Start_Order =2
DISP05 #Start_Order =3
$Sourcefile = "C:\Users\StartF.csv"
$StartProperties = (Import-Csv $Sourcefile) | select Ava_Zone,Environment,Server_Name,
Purpose,Service_Name, Start_Order, Start_Flag,
Start_Wait
# $StartProperties
$StartProperties | Group-Object -Property Server_Name | Sort-Object -Property {$_Start_Order}
Count Name Group
----- ---- -----
1 USOHCLIENT901 {@{Ava_Zone=us-east-2a; Environment=DEV; Ser...
13 DEFRCLIENT801 {@{Ava_Zone=de-central-1a; Environment=TEST;...
12 APSGCOGAPP803 {@{Ava_Zone=ap-southeast-1a; Environment=TES...
12 APSGCOGAPP802 {@{Ava_Zone=ap-southeast-1b; Environment=TES...
12 APSGCOGAPP801 {@{Ava_Zone=ap-southeast-1a; Environment=TES...
1 APSGCLIENT801 {@{Ava_Zone=ap-southeast-1a; Environment=TES...
12 USOHCOGAPP803 {@{Ava_Zone=us-east-2a; Environment=TEST; Se...
12 USOHCOGAPP802 {@{Ava_Zone=us-east-2a; Environment=TEST; Se...
12 USOHCOGAPP801 {@{Ava_Zone=us-east-2a; Environment=TEST; Se...
1 USOHCLIENT801 {@{Ava_Zone=us-east-2a; Environment=TEST; Se...
1 {@{Ava_Zone=--; Environment=; Server_Name=; ...
12 DEFRCLIENT903 {@{Ava_Zone=de-central-1a; Environment=DEV; ...
12 DEFRCOGAPP902 {@{Ava_Zone=de-central-1b; Environment=DEV; ...
11 DEFRCOGAPP901 {@{Ava_Zone=de-central-1a; Environment=DEV; ...
2 DEFRCLIENT901 {@{Ava_Zone=de-central-1a; Environment=DEV; ...
12 APSGCOGAPP903 {@{Ava_Zone=ap-southeast-1a; Environment=DEV...
12 APSGCOGAPP902 {@{Ava_Zone=ap-southeast-1b; Environment=DEV...
12 APSGCOGAPP901 {@{Ava_Zone=ap-southeast-1a; Environment=DEV...
1 APSGCLIENT901 {@{Ava_Zone=ap-southeast-1a; Environment=DEV...
12 USOHCOGAPP903 {@{Ava_Zone=us-east-2a; Environment=DEV; Ser...
12 USOHCOGAPP902 {@{Ava_Zone=us-east-2a; Environment=DEV; Ser...
12 USOHCOGAPP901 {@{Ava_Zone=us-east-2a; Environment=DEV; Ser...
12 DEFRCOGAPP802 {@{Ava_Zone=de-central-1b; Environment=TEST;...
12 DEFRCOGAPP803 {@{Ava_Zone=de-central-1a; Environment=TEST;...
Выход PowerShell