Repository navigation
Commit c5bd5cb
committed
(DSC) Handle when a scope has no installed resources
Prior to this change, the `PSResourceList` resource would fail during
`export` operations when a scope had no installed resources because
it would emit an empty/invalid item. The non-terminating error for
no resources in a scope was also erroneously emitted.
This change:
1. Defines the `GetAllPsResourcesInScope` function as a wrapper around
`Get-PsResource` to retrieve all resources in a given scope,
returning an empty array if no resources are found and erroring if
the command fails for any other reason.
1. Updates `PopulatePSResourceListObject` to handle empty resource
arrays gracefully, emitting an info message instead of invalid data.1 parent 928b50d commit c5bd5cb
1 file changed
Lines changed: 46 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
624 | 624 | | |
625 | 625 | | |
626 | 626 | | |
627 | | - | |
628 | | - | |
629 | | - | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
630 | 633 | | |
631 | 634 | | |
632 | 635 | | |
| |||
844 | 847 | | |
845 | 848 | | |
846 | 849 | | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
847 | 866 | | |
848 | 867 | | |
849 | 868 | | |
| |||
891 | 910 | | |
892 | 911 | | |
893 | 912 | | |
894 | | - | |
895 | | - | |
896 | | - | |
897 | | - | |
898 | | - | |
899 | | - | |
900 | | - | |
901 | | - | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
902 | 925 | | |
903 | 926 | | |
904 | | - | |
905 | | - | |
906 | | - | |
907 | | - | |
908 | | - | |
909 | | - | |
910 | | - | |
911 | | - | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
912 | 939 | | |
913 | 940 | | |
914 | 941 | | |
| |||
0 commit comments