WindowsExe.ArgumentCompleters.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196

#
# .SYNOPSIS
#
# Complete parameters and arguments to PowerShell.exe
#
function PowerShellExeCompletion
{
    param($wordToComplete, $commandAst)

    $tryParameters = $true
    $last = if ($wordToComplete) { -2 } else { -1 }
    $parameterAst = $commandAst.CommandElements[$last] -as [System.Management.Automation.Language.CommandParameterAst]
    if ($parameterAst -ne $null)
    {
        if ("File".StartsWith($parameterAst.ParameterName, "OrdinalIgnoreCase"))
        {
            Get-CompletionWithExtension $wordToComplete '.ps1'
            return
        }

        $completions = $null

        if ("InputFormat".StartsWith($parameterAst.ParameterName, "OrdinalIgnoreCase") -or
            "OutputFormat".StartsWith($parameterAst.ParameterName, "OrdinalIgnoreCase"))
        {
            $completions = "Text", "XML"
        }
        elseif ("WindowStyle".StartsWith($parameterAst.ParameterName, "OrdinalIgnoreCase"))
        {
            $completions = "Normal", "Minimized", "Maximized", "Hidden"
        }
        elseif ("ExecutionPolicy".StartsWith($parameterAst.ParameterName, "OrdinalIgnoreCase"))
        {
            $completions = ([Microsoft.PowerShell.ExecutionPolicy] | Get-Member -Static -MemberType Property).Name
        }

        $tryParameters = ($completions.Length -eq 0)

        $completions | Where-Object { $_ -match "^$wordToComplete" } | ForEach-Object { New-CompletionResult $_ }
    }

    if ($tryParameters -and ($wordToComplete.StartsWith("-") -or "" -eq $wordToComplete))
    {
        echo -- -PSConsoleFile -Version -NoLogo -NoExit -Sta -NoProfile -NonInteractive `
            -InputFormat -OutputFormat -WindowStyle -EncodedCommand -File -ExecutionPolicy `
            -Command |
            Where-Object { $_ -like "$wordToComplete*" } |
            Sort-Object |
            ForEach-Object {
                New-CompletionResult $_
            }
    }
}


#
# .SYNOPSIS
#
# Complete parameters and arguments to net.exe
#
function NetExeCompletion
{
    param($wordToComplete, $commandAst)

    $commandTree = Get-CompletionPrivateData -Key NetExeCompletionCommandTree
    if ($null -eq $commandTree)
    {
        Set-Alias -Name nct -Value New-CommandTree

        Import-LocalizedData -BindingVariable msgTable -FileName WindowsExe.Messages.psd1

        $commandTree = & {
            nct ACCOUNTS $msgTable.net_ACCOUNTS {
                nct -Argument '/FORCELOGOFF:' $msgTable.net_ACCOUNTS_FORCELOGOFF
                nct -Argument '/MINPWLEN:' $msgTable.net_ACCOUNTS_MINPWLEN
                nct -Argument '/MAXPWAGE:' $msgTable.net_ACCOUNTS_MAXPWAGE
                nct -Argument '/MINPWAGE:' $msgTable.net_ACCOUNTS_MINPWAGE
                nct -Argument '/DOMAIN' $msgTable.net_ACCOUNTS_DOMAIN
            }

            nct COMPUTER $msgTable.net_COMPUTER {
                nct '/ADD' $msgTable.net_COMPUTER_ADD
                nct '/DEL' $msgTable.net_COMPUTER_DEL
            }

            nct CONFIG $msgTable.net_CONFIG {
                nct SERVER $msgTable.net_CONFIG_SERVER
                nct WORKSTATION $msgTable.net_CONFIG_WORKSTATION
            }

            nct CONTINUE $msgTable.Net_CONTINUE {
                nct {
                    param($wordToComplete, $commandAst)

                    Get-Service |
                        Where-Object {
                            $_.Status -eq [System.ServiceProcess.ServiceControllerStatus]::Paused -and
                            ($_.Name -like "$wordToComplete*" -or $_.DisplayName -like "$wordToComplete*") } |
                        Sort-Object DisplayName |
                        ForEach-Object {
                            New-CompletionResult $_.DisplayName -ToolTip "Name: $($_.Name)"
                        }
                }
            }

            nct FILE $msgTable.net_FILE {
                nct {
                    param($wordToComplete, $commandAst)
                    net file |
                        ForEach-Object {
                            # It'd be better to parse the header and use the columns
                            # in tooltips but nobody will probably ever notice this
                            # completion anyway.
                            if ($_ -match '\s*(\d+)\s+(.*)')
                            {
                                if ($matches[1] -like "$wordToComplete*")
                                {
                                    New-CompletionResult $_ -ToolTip $matches[2]
                                }
                            }
                        }
                }
                nct -Argument '/CLOSE' $msgTable.net_FILE_CLOSE
            }

            nct GROUP $msgTable.net_GROUP {
                nct -Argument '/COMMENT:' $msgTable.net_GROUP_COMMENT
                nct -Argument '/DOMAIN' $msgTable.net_GROUP_DOMAIN
                nct -Argument '/ADD' $msgTable.net_GROUP_ADD
                nct -Argument '/DELETE' $msgTable.net_GROUP_DELETE
            }

            nct HELP $msgTable.net_HELP {
                echo ACCOUNTS COMPUTER CONFIG CONTINUE FILE GROUP HELP `
                     HELPMSG LOCALGROUP PAUSE SESSION SHARE START `
                     STATISTICS STOP TIME USE USER VIEW |
                     ForEach-Object {
                        nct $_ ($msgTable.net_HELP_COMMAND + $_)
                     }

                nct NAMES $msgTable.net_HELP_NAMES
                nct SERVICES $msgTable.net_HELP_SERVICES
                nct SYNTAX $msgTable.net_HELP_SYNTAX
            }

            nct HELPMSG $msgTable.net_HELPMSG

            nct LOCALGROUP $msgTable.net_LOCALGROUP {
                nct -Argument '/COMMENT:' $msgTable.net_LOCALGROUP_COMMENT
                nct -Argument '/DOMAIN' $msgTable.net_LOCALGROUP_DOMAIN
                nct -Argument '/ADD' $msgTable.net_LOCALGROUP_ADD
                nct -Argument '/DELETE' $msgTable.net_LOCALGROUP_DELETE
            }

            nct PAUSE $msgTable.net_PAUSE {
                nct {
                    param($wordToComplete, $commandAst)

                    Get-Service |
                        Where-Object {
                            $_.CanPauseAndContinue -and
                            ($_.Name -like "$wordToComplete*" -or $_.DisplayName -like "$wordToComplete*") } |
                        Sort-Object DisplayName |
                        ForEach-Object {
                            New-CompletionResult $_.DisplayName -ToolTip "Name: $($_.Name)"
                        }
                }
            }

            nct SESSION $msgTable.net_SESSION {
                nct -Argument '/DELETE' $msgTable.net_SESSION_DELETE
                nct -Argument '/LIST' $msgTable.net_SESSION_LIST
            }

            nct SHARE $msgTable.net_SHARE {
                nct -Argument '/GRANT:' $msgTable.net_SHARE_GRANT
                nct -Argument '/USERS:' $msgTable.net_SHARE_USERS
                nct -Argument '/UNLIMITED' $msgTable.net_SHARE_UNLIMITED
                nct -Argument '/REMARK:' $msgTable.net_SHARE_REMARK
                nct -Argument '/DELETE' $msgTable.net_SHARE_DELETE
                nct -Argument '/CACHE:Manual' $msgTable.net_SHARE_CACHE_Manual
                nct -Argument '/CACHE:Documents' $msgTable.net_SHARE_CACHE_Documents
                nct -Argument '/CACHE:Programs' $msgTable.net_SHARE_CACHE_Programs
                nct -Argument '/CACHE:BranchCache' $msgTable.net_SHARE_CACHE_BranchCache
                nct -Argument '/CACHE:None' $msgTable.net_SHARE_CACHE_None
            }

            nct START $msgTable.net_START {
                nct {
                    param($wordToComplete, $commandAst)

                    Get-Service |
                        Where-Object {
                            $_.Status -eq [System.ServiceProcess.ServiceControllerStatus]::Stopped -and
                            ($_.Name -like "$wordToComplete*" -or $_.DisplayName -like "$wordToComplete*") } |
                        Sort-Object DisplayName |
                        ForEach-Object {
                            New-CompletionResult $_.DisplayName -ToolTip "Name: $($_.Name)"
                        }
                }
            }

            nct STATISTICS $msgTable.net_STATISTICS {
                nct SERVER $msgTable.net_STATISTICS_SERVER
                nct WORKSTATION $msgTable.net_STATISTICS_WORKSTATION
            }

            nct STOP $msgTable.net_STOP {
                nct {
                    param($wordToComplete, $commandAst)

                    Get-Service |
                        Where-Object {
                            $_.CanStop -and
                            ($_.Name -like "$wordToComplete*" -or $_.DisplayName -like "$wordToComplete*") } |
                        Sort-Object DisplayName |
                        ForEach-Object {
                            New-CompletionResult $_.DisplayName -ToolTip "Name: $($_.Name)"
                        }
                }
            }

            nct TIME $msgTable.net_TIME {
                nct -Argument '/DOMAIN' $msgTable.net_TIME_DOMAIN
                nct -Argument '/RTSDOMAIN' $msgTable.net_TIME_RTSDOMAIN
                nct -Argument '/SET' $msgTable.net_TIME_SET
            }

            nct USE $msgTable.net_USE {
                nct -Argument '/USER:' $msgTable.net_USE_USER
                nct -Argument '/SMARTCARD' $msgTable.net_USE_SMARTCARD
                nct -Argument '/SAVECRED' $msgTable.net_USE_SAVECRED
                nct -Argument '/DELETE' $msgTable.net_USE_DELETE
                nct -Argument '/PERSISTENT:YES' $msgTable.net_USE_PERSISTENT
                nct -Argument '/PERSISTENT:NO' $msgTable.net_USE_PERSISTENT
            }

            nct USER $msgTable.net_USER {
                # We could be much smarter here - many of the options
                # aren't valid if /ADD or /DELETE is specified.
                nct -Argument '/DOMAIN' $msgTable.net_USER_DOMAIN
                nct -Argument '/ADD' $msgTable.net_USER_ADD
                nct -Argument '/DELETE' $msgTable.net_USER_DELETE
                nct -Argument '/ACTIVE:YES' $msgTable.net_USER_ACTIVE
                nct -Argument '/ACTIVE:NO' $msgTable.net_USER_ACTIVE
                nct -Argument '/COMMENT:' $msgTable.net_USER_COMMENT
                nct -Argument '/COUNTRYCODE:' $msgTable.net_USER_COUNTRYCODE
                nct -Argument '/EXPIRES:' $msgTable.net_USER_EXPIRES
                nct -Argument '/EXPIRES:NEVER' $msgTable.net_USER_EXPIRES
                nct -Argument '/FULLNAME:' $msgTable.net_USER_FULLNAME
                nct -Argument '/HOMEDIR:' $msgTable.net_USER_HOMEDIR
                nct -Argument '/PASSWORDCHG:YES' $msgTable.net_USER_PASSWORDCHG
                nct -Argument '/PASSWORDCHG:NO' $msgTable.net_USER_PASSWORDCHG
                nct -Argument '/PASSWORDREQ:YES' $msgTable.net_USER_PASSWORDREQ
                nct -Argument '/PASSWORDREQ:NO' $msgTable.net_USER_PASSWORDREQ
                nct -Argument '/LOGONPASSWORDCHG:YES' $msgTable.net_USER_LOGONPASSWORDCHG
                nct -Argument '/LOGONPASSWORDCHG:NO' $msgTable.net_USER_LOGONPASSWORDCHG
                nct -Argument '/PROFILEPATH:' $msgTable.net_USER_PROFILEPATH
                nct -Argument '/SCRIPTPATH:' $msgTable.net_USER_SCRIPTPATH
                nct -Argument '/TIMES:' $msgTable.net_USER_TIMES
                nct -Argument '/TIMES:ALL' $msgTable.net_USER_TIMES
                nct -Argument '/USERCOMMENT:' $msgTable.net_USER_USERCOMMENT
                nct -Argument '/WORKSTATIONS:' $msgTable.net_USER_WORKSTATIONS
            }

            nct VIEW $msgTable.net_VIEW {
                nct -Argument '/DOMAIN:' $msgTable.net_VIEW_DOMAIN
                nct -Argument '/CACHE' $msgTable.net_VIEW_CACHE
                nct -Argument '/ALL' $msgTable.net_VIEW_ALL
            }
        }

        Set-CompletionPrivateData -Key NetExeCompletionCommandTree -Value $commandTree
    }

    Get-CommandTreeCompletion $wordToComplete $commandAst $commandTree
}


#
# .SYNOPSIS
#
# Complete parameters and arguments to netsh.exe
#
function NetshExeCompletion
{
    param($wordToComplete, $commandAst)

    $commandTree = Get-CompletionPrivateData -Key NetshExeCompletionCommandTree
    if ($null -eq $commandTree)
    {
        Set-Alias -Name nct -Value New-CommandTree

        Import-LocalizedData -BindingVariable msgTable -FileName WindowsExe.Messages.psd1

        $commandTree = & {
            # Generated by:
            # $x = GenNetshCommandTree
            # $x.SubCommands | clip

            nct add $msgTable.netsh_add {
                nct helper $msgTable.netsh_add_helper
            }

            nct advfirewall $msgTable.netsh_advfirewall {
                nct consec $msgTable.netsh_advfirewall_consec {
                    nct add $msgTable.netsh_advfirewall_consec_add {
                        nct rule $msgTable.netsh_advfirewall_consec_add_rule
                    }
                    nct delete $msgTable.netsh_advfirewall_consec_delete {
                        nct rule $msgTable.netsh_advfirewall_consec_delete_rule
                    }
                    nct dump $msgTable.netsh_advfirewall_consec_dump
                    nct help $msgTable.netsh_advfirewall_consec_help
                    nct set $msgTable.netsh_advfirewall_consec_set {
                        nct rule $msgTable.netsh_advfirewall_consec_set_rule
                    }
                    nct show $msgTable.netsh_advfirewall_consec_show {
                        nct rule $msgTable.netsh_advfirewall_consec_show_rule
                    }
                }
                nct dump $msgTable.netsh_advfirewall_dump
                nct export $msgTable.netsh_advfirewall_export
                nct firewall $msgTable.netsh_advfirewall_firewall {
                    nct add $msgTable.netsh_advfirewall_firewall_add {
                        nct rule $msgTable.netsh_advfirewall_firewall_add_rule
                    }
                    nct delete $msgTable.netsh_advfirewall_firewall_delete {
                        nct rule $msgTable.netsh_advfirewall_firewall_delete_rule
                    }
                    nct dump $msgTable.netsh_advfirewall_firewall_dump
                    nct help $msgTable.netsh_advfirewall_firewall_help
                    nct set $msgTable.netsh_advfirewall_firewall_set {
                        nct rule $msgTable.netsh_advfirewall_firewall_set_rule
                    }
                    nct show $msgTable.netsh_advfirewall_firewall_show {
                        nct rule $msgTable.netsh_advfirewall_firewall_show_rule
                    }
                }
                nct help $msgTable.netsh_advfirewall_help
                nct import $msgTable.netsh_advfirewall_import
                nct mainmode $msgTable.netsh_advfirewall_mainmode {
                    nct add $msgTable.netsh_advfirewall_mainmode_add {
                        nct rule $msgTable.netsh_advfirewall_mainmode_add_rule
                    }
                    nct delete $msgTable.netsh_advfirewall_mainmode_delete {
                        nct rule $msgTable.netsh_advfirewall_mainmode_delete_rule
                    }
                    nct dump $msgTable.netsh_advfirewall_mainmode_dump
                    nct help $msgTable.netsh_advfirewall_mainmode_help
                    nct set $msgTable.netsh_advfirewall_mainmode_set {
                        nct rule $msgTable.netsh_advfirewall_mainmode_set_rule
                    }
                    nct show $msgTable.netsh_advfirewall_mainmode_show {
                        nct rule $msgTable.netsh_advfirewall_mainmode_show_rule
                    }
                }
                nct monitor $msgTable.netsh_advfirewall_monitor {
                    nct delete $msgTable.netsh_advfirewall_monitor_delete
                    nct dump $msgTable.netsh_advfirewall_monitor_dump
                    nct help $msgTable.netsh_advfirewall_monitor_help
                    nct show $msgTable.netsh_advfirewall_monitor_show {
                        nct consec $msgTable.netsh_advfirewall_monitor_show_consec
                        nct currentprofile $msgTable.netsh_advfirewall_monitor_show_currentprofile
                        nct firewall $msgTable.netsh_advfirewall_monitor_show_firewall
                        nct mainmode $msgTable.netsh_advfirewall_monitor_show_mainmode
                        nct mmsa $msgTable.netsh_advfirewall_monitor_show_mmsa
                        nct qmsa $msgTable.netsh_advfirewall_monitor_show_qmsa
                    }
                }
                nct reset $msgTable.netsh_advfirewall_reset
                nct set $msgTable.netsh_advfirewall_set {
                    nct allprofiles $msgTable.netsh_advfirewall_set_allprofiles
                    nct currentprofile $msgTable.netsh_advfirewall_set_currentprofile
                    nct domainprofile $msgTable.netsh_advfirewall_set_domainprofile
                    nct global $msgTable.netsh_advfirewall_set_global
                    nct privateprofile $msgTable.netsh_advfirewall_set_privateprofile
                    nct publicprofile $msgTable.netsh_advfirewall_set_publicprofile
                }
                nct show $msgTable.netsh_advfirewall_show {
                    nct allprofiles $msgTable.netsh_advfirewall_show_allprofiles
                    nct currentprofile $msgTable.netsh_advfirewall_show_currentprofile
                    nct domainprofile $msgTable.netsh_advfirewall_show_domainprofile
                    nct global $msgTable.netsh_advfirewall_show_global
                    nct privateprofile $msgTable.netsh_advfirewall_show_privateprofile
                    nct publicprofile $msgTable.netsh_advfirewall_show_publicprofile
                    nct store $msgTable.netsh_advfirewall_show_store
                }
            }

            nct branchcache $msgTable.netsh_branchcache {
                nct dump $msgTable.netsh_branchcache_dump
                nct exportkey $msgTable.netsh_branchcache_exportkey
                nct flush $msgTable.netsh_branchcache_flush
                nct help $msgTable.netsh_branchcache_help
                nct importkey $msgTable.netsh_branchcache_importkey
                nct reset $msgTable.netsh_branchcache_reset
                nct set $msgTable.netsh_branchcache_set {
                    nct cachesize $msgTable.netsh_branchcache_set_cachesize
                    nct key $msgTable.netsh_branchcache_set_key
                    nct localcache $msgTable.netsh_branchcache_set_localcache
                    nct publicationcache $msgTable.netsh_branchcache_set_publicationcache
                    nct publicationcachesize $msgTable.netsh_branchcache_set_publicationcachesize
                    nct service $msgTable.netsh_branchcache_set_service
                }
                nct show $msgTable.netsh_branchcache_show {
                    nct hostedcache $msgTable.netsh_branchcache_show_hostedcache
                    nct localcache $msgTable.netsh_branchcache_show_localcache
                    nct publicationcache $msgTable.netsh_branchcache_show_publicationcache
                    nct status $msgTable.netsh_branchcache_show_status
                }
                nct smb $msgTable.netsh_branchcache_smb {
                    nct dump $msgTable.netsh_branchcache_smb_dump
                    nct help $msgTable.netsh_branchcache_smb_help
                    nct set $msgTable.netsh_branchcache_smb_set {
                        nct latency $msgTable.netsh_branchcache_smb_set_latency
                    }
                    nct show $msgTable.netsh_branchcache_smb_show {
                        nct latency $msgTable.netsh_branchcache_smb_show_latency
                    }
                }
            }

            nct bridge $msgTable.netsh_bridge {
                nct dump $msgTable.netsh_bridge_dump
                nct help $msgTable.netsh_bridge_help
                nct install $msgTable.netsh_bridge_install
                nct set $msgTable.netsh_bridge_set {
                    nct adapter $msgTable.netsh_bridge_set_adapter
                }
                nct show $msgTable.netsh_bridge_show {
                    nct adapter $msgTable.netsh_bridge_show_adapter
                }
                nct uninstall $msgTable.netsh_bridge_uninstall
            }

            nct delete $msgTable.netsh_delete {
                nct helper $msgTable.netsh_delete_helper
            }

            nct dhcpclient $msgTable.netsh_dhcpclient

            nct dnsclient $msgTable.netsh_dnsclient {
                nct add $msgTable.netsh_dnsclient_add {
                    nct dnsservers $msgTable.netsh_dnsclient_add_dnsservers
                }
                nct delete $msgTable.netsh_dnsclient_delete {
                    nct dnsservers $msgTable.netsh_dnsclient_delete_dnsservers
                }
                nct dump $msgTable.netsh_dnsclient_dump
                nct help $msgTable.netsh_dnsclient_help
                nct set $msgTable.netsh_dnsclient_set {
                    nct dnsservers $msgTable.netsh_dnsclient_set_dnsservers
                }
                nct show $msgTable.netsh_dnsclient_show {
                    nct state $msgTable.netsh_dnsclient_show_state
                }
            }

            nct dump $msgTable.netsh_dump

            nct exec $msgTable.netsh_exec

            nct firewall $msgTable.netsh_firewall {
                nct add $msgTable.netsh_firewall_add
                nct delete $msgTable.netsh_firewall_delete
                nct dump $msgTable.netsh_firewall_dump
                nct help $msgTable.netsh_firewall_help
                nct set $msgTable.netsh_firewall_set
                nct show $msgTable.netsh_firewall_show
            }

            nct help $msgTable.netsh_help

            nct http $msgTable.netsh_http {
                nct add $msgTable.netsh_http_add {
                    nct cacheparam $msgTable.netsh_http_add_cacheparam
                    nct iplisten $msgTable.netsh_http_add_iplisten
                    nct sslcert $msgTable.netsh_http_add_sslcert
                    nct timeout $msgTable.netsh_http_add_timeout
                    nct urlacl $msgTable.netsh_http_add_urlacl
                }
                nct delete $msgTable.netsh_http_delete {
                    nct cache $msgTable.netsh_http_delete_cache
                    nct iplisten $msgTable.netsh_http_delete_iplisten
                    nct sslcert $msgTable.netsh_http_delete_sslcert
                    nct timeout $msgTable.netsh_http_delete_timeout
                    nct urlacl $msgTable.netsh_http_delete_urlacl
                }
                nct dump $msgTable.netsh_http_dump
                nct flush $msgTable.netsh_http_flush {
                    nct logbuffer $msgTable.netsh_http_flush_logbuffer
                }
                nct help $msgTable.netsh_http_help
                nct show $msgTable.netsh_http_show {
                    nct cacheparam $msgTable.netsh_http_show_cacheparam
                    nct cachestate $msgTable.netsh_http_show_cachestate
                    nct iplisten $msgTable.netsh_http_show_iplisten
                    nct servicestate $msgTable.netsh_http_show_servicestate
                    nct sslcert $msgTable.netsh_http_show_sslcert
                    nct timeout $msgTable.netsh_http_show_timeout
                    nct urlacl $msgTable.netsh_http_show_urlacl
                }
            }

            nct interface $msgTable.netsh_interface {
                nct dump $msgTable.netsh_interface_dump
                nct help $msgTable.netsh_interface_help
                nct httpstunnel $msgTable.netsh_interface_httpstunnel {
                    nct add $msgTable.netsh_interface_httpstunnel_add {
                        nct interface $msgTable.netsh_interface_httpstunnel_add_interface
                    }
                    nct delete $msgTable.netsh_interface_httpstunnel_delete {
                        nct interface $msgTable.netsh_interface_httpstunnel_delete_interface
                    }
                    nct dump $msgTable.netsh_interface_httpstunnel_dump
                    nct help $msgTable.netsh_interface_httpstunnel_help
                    nct reset $msgTable.netsh_interface_httpstunnel_reset
                    nct set $msgTable.netsh_interface_httpstunnel_set {
                        nct interface $msgTable.netsh_interface_httpstunnel_set_interface
                    }
                    nct show $msgTable.netsh_interface_httpstunnel_show {
                        nct interfaces $msgTable.netsh_interface_httpstunnel_show_interfaces
                        nct statistics $msgTable.netsh_interface_httpstunnel_show_statistics
                    }
                }
                nct isatap $msgTable.netsh_interface_isatap {
                    nct dump $msgTable.netsh_interface_isatap_dump
                    nct help $msgTable.netsh_interface_isatap_help
                    nct set $msgTable.netsh_interface_isatap_set {
                        nct router $msgTable.netsh_interface_isatap_set_router
                        nct state $msgTable.netsh_interface_isatap_set_state
                    }
                    nct show $msgTable.netsh_interface_isatap_show {
                        nct router $msgTable.netsh_interface_isatap_show_router
                        nct state $msgTable.netsh_interface_isatap_show_state
                    }
                }
                nct portproxy $msgTable.netsh_interface_portproxy {
                    nct add $msgTable.netsh_interface_portproxy_add
                    nct delete $msgTable.netsh_interface_portproxy_delete
                    nct dump $msgTable.netsh_interface_portproxy_dump
                    nct help $msgTable.netsh_interface_portproxy_help
                    nct reset $msgTable.netsh_interface_portproxy_reset
                    nct set $msgTable.netsh_interface_portproxy_set
                    nct show $msgTable.netsh_interface_portproxy_show {
                        nct all $msgTable.netsh_interface_portproxy_show_all
                    }
                }
                nct set $msgTable.netsh_interface_set {
                    nct interface $msgTable.netsh_interface_set_interface
                }
                nct show $msgTable.netsh_interface_show {
                    nct interface $msgTable.netsh_interface_show_interface
                }
                nct tcp $msgTable.netsh_interface_tcp {
                    nct add $msgTable.netsh_interface_tcp_add {
                        nct chimneyapplication $msgTable.netsh_interface_tcp_add_chimneyapplication
                        nct chimneyport $msgTable.netsh_interface_tcp_add_chimneyport
                        nct supplementalport $msgTable.netsh_interface_tcp_add_supplementalport
                        nct supplementalsubnet $msgTable.netsh_interface_tcp_add_supplementalsubnet
                    }
                    nct delete $msgTable.netsh_interface_tcp_delete {
                        nct chimneyapplication $msgTable.netsh_interface_tcp_delete_chimneyapplication
                        nct chimneyport $msgTable.netsh_interface_tcp_delete_chimneyport
                        nct supplementalport $msgTable.netsh_interface_tcp_delete_supplementalport
                        nct supplementalsubnet $msgTable.netsh_interface_tcp_delete_supplementalsubnet
                    }
                    nct dump $msgTable.netsh_interface_tcp_dump
                    nct help $msgTable.netsh_interface_tcp_help
                    nct reset $msgTable.netsh_interface_tcp_reset
                    nct set $msgTable.netsh_interface_tcp_set {
                        nct global $msgTable.netsh_interface_tcp_set_global
                        nct heuristics $msgTable.netsh_interface_tcp_set_heuristics
                        nct security $msgTable.netsh_interface_tcp_set_security
                        nct supplemental $msgTable.netsh_interface_tcp_set_supplemental
                    }
                    nct show $msgTable.netsh_interface_tcp_show {
                        nct chimneyapplications $msgTable.netsh_interface_tcp_show_chimneyapplications
                        nct chimneyports $msgTable.netsh_interface_tcp_show_chimneyports
                        nct chimneystats $msgTable.netsh_interface_tcp_show_chimneystats
                        nct global $msgTable.netsh_interface_tcp_show_global
                        nct heuristics $msgTable.netsh_interface_tcp_show_heuristics
                        nct netdmastats $msgTable.netsh_interface_tcp_show_netdmastats
                        nct rscstats $msgTable.netsh_interface_tcp_show_rscstats
                        nct security $msgTable.netsh_interface_tcp_show_security
                        nct supplemental $msgTable.netsh_interface_tcp_show_supplemental
                        nct supplementalports $msgTable.netsh_interface_tcp_show_supplementalports
                        nct supplementalsubnets $msgTable.netsh_interface_tcp_show_supplementalsubnets
                    }
                }
                nct teredo $msgTable.netsh_interface_teredo {
                    nct dump $msgTable.netsh_interface_teredo_dump
                    nct help $msgTable.netsh_interface_teredo_help
                    nct set $msgTable.netsh_interface_teredo_set {
                        nct state $msgTable.netsh_interface_teredo_set_state
                    }
                    nct show $msgTable.netsh_interface_teredo_show {
                        nct state $msgTable.netsh_interface_teredo_show_state
                    }
                }
            }

            nct ipsec $msgTable.netsh_ipsec {
                nct dump $msgTable.netsh_ipsec_dump
                nct dynamic $msgTable.netsh_ipsec_dynamic {
                    nct add $msgTable.netsh_ipsec_dynamic_add {
                        nct mmpolicy $msgTable.netsh_ipsec_dynamic_add_mmpolicy
                        nct qmpolicy $msgTable.netsh_ipsec_dynamic_add_qmpolicy
                        nct rule $msgTable.netsh_ipsec_dynamic_add_rule
                    }
                    nct delete $msgTable.netsh_ipsec_dynamic_delete {
                        nct all $msgTable.netsh_ipsec_dynamic_delete_all
                        nct mmpolicy $msgTable.netsh_ipsec_dynamic_delete_mmpolicy
                        nct qmpolicy $msgTable.netsh_ipsec_dynamic_delete_qmpolicy
                        nct rule $msgTable.netsh_ipsec_dynamic_delete_rule
                        nct sa $msgTable.netsh_ipsec_dynamic_delete_sa
                    }
                    nct dump $msgTable.netsh_ipsec_dynamic_dump
                    nct help $msgTable.netsh_ipsec_dynamic_help
                    nct set $msgTable.netsh_ipsec_dynamic_set {
                        nct config $msgTable.netsh_ipsec_dynamic_set_config
                        nct mmpolicy $msgTable.netsh_ipsec_dynamic_set_mmpolicy
                        nct qmpolicy $msgTable.netsh_ipsec_dynamic_set_qmpolicy
                        nct rule $msgTable.netsh_ipsec_dynamic_set_rule
                    }
                    nct show $msgTable.netsh_ipsec_dynamic_show {
                        nct all $msgTable.netsh_ipsec_dynamic_show_all
                        nct config $msgTable.netsh_ipsec_dynamic_show_config
                        nct mmfilter $msgTable.netsh_ipsec_dynamic_show_mmfilter
                        nct mmpolicy $msgTable.netsh_ipsec_dynamic_show_mmpolicy
                        nct mmsas $msgTable.netsh_ipsec_dynamic_show_mmsas
                        nct qmfilter $msgTable.netsh_ipsec_dynamic_show_qmfilter
                        nct qmpolicy $msgTable.netsh_ipsec_dynamic_show_qmpolicy
                        nct qmsas $msgTable.netsh_ipsec_dynamic_show_qmsas
                        nct rule $msgTable.netsh_ipsec_dynamic_show_rule
                    }
                }
                nct help $msgTable.netsh_ipsec_help
                nct static $msgTable.netsh_ipsec_static {
                    nct add $msgTable.netsh_ipsec_static_add {
                        nct filter $msgTable.netsh_ipsec_static_add_filter
                        nct filteraction $msgTable.netsh_ipsec_static_add_filteraction
                        nct filterlist $msgTable.netsh_ipsec_static_add_filterlist
                        nct policy $msgTable.netsh_ipsec_static_add_policy
                        nct rule $msgTable.netsh_ipsec_static_add_rule
                    }
                    nct delete $msgTable.netsh_ipsec_static_delete {
                        nct all $msgTable.netsh_ipsec_static_delete_all
                        nct filter $msgTable.netsh_ipsec_static_delete_filter
                        nct filteraction $msgTable.netsh_ipsec_static_delete_filteraction
                        nct filterlist $msgTable.netsh_ipsec_static_delete_filterlist
                        nct policy $msgTable.netsh_ipsec_static_delete_policy
                        nct rule $msgTable.netsh_ipsec_static_delete_rule
                    }
                    nct dump $msgTable.netsh_ipsec_static_dump
                    nct exportpolicy $msgTable.netsh_ipsec_static_exportpolicy
                    nct help $msgTable.netsh_ipsec_static_help
                    nct importpolicy $msgTable.netsh_ipsec_static_importpolicy
                    nct set $msgTable.netsh_ipsec_static_set {
                        nct batch $msgTable.netsh_ipsec_static_set_batch
                        nct defaultrule $msgTable.netsh_ipsec_static_set_defaultrule
                        nct filteraction $msgTable.netsh_ipsec_static_set_filteraction
                        nct filterlist $msgTable.netsh_ipsec_static_set_filterlist
                        nct policy $msgTable.netsh_ipsec_static_set_policy
                        nct rule $msgTable.netsh_ipsec_static_set_rule
                        nct store $msgTable.netsh_ipsec_static_set_store
                    }
                    nct show $msgTable.netsh_ipsec_static_show {
                        nct all $msgTable.netsh_ipsec_static_show_all
                        nct filteraction $msgTable.netsh_ipsec_static_show_filteraction
                        nct filterlist $msgTable.netsh_ipsec_static_show_filterlist
                        nct gpoassignedpolicy $msgTable.netsh_ipsec_static_show_gpoassignedpolicy
                        nct policy $msgTable.netsh_ipsec_static_show_policy
                        nct rule $msgTable.netsh_ipsec_static_show_rule
                        nct store $msgTable.netsh_ipsec_static_show_store
                    }
                }
            }

            nct lan $msgTable.netsh_lan {
                nct add $msgTable.netsh_lan_add {
                    nct profile $msgTable.netsh_lan_add_profile
                }
                nct delete $msgTable.netsh_lan_delete {
                    nct profile $msgTable.netsh_lan_delete_profile
                }
                nct dump $msgTable.netsh_lan_dump
                nct export $msgTable.netsh_lan_export {
                    nct profile $msgTable.netsh_lan_export_profile
                }
                nct help $msgTable.netsh_lan_help
                nct reconnect $msgTable.netsh_lan_reconnect
                nct set $msgTable.netsh_lan_set {
                    nct allowexplicitcreds $msgTable.netsh_lan_set_allowexplicitcreds
                    nct autoconfig $msgTable.netsh_lan_set_autoconfig
                    nct blockperiod $msgTable.netsh_lan_set_blockperiod
                    nct eapuserdata $msgTable.netsh_lan_set_eapuserdata
                    nct profileparameter $msgTable.netsh_lan_set_profileparameter
                    nct tracing $msgTable.netsh_lan_set_tracing
                }
                nct show $msgTable.netsh_lan_show {
                    nct interfaces $msgTable.netsh_lan_show_interfaces
                    nct profiles $msgTable.netsh_lan_show_profiles
                    nct settings $msgTable.netsh_lan_show_settings
                    nct tracing $msgTable.netsh_lan_show_tracing
                }
            }

            nct mbn $msgTable.netsh_mbn {
                nct add $msgTable.netsh_mbn_add {
                    nct profile $msgTable.netsh_mbn_add_profile
                }
                nct connect $msgTable.netsh_mbn_connect
                nct delete $msgTable.netsh_mbn_delete {
                    nct profile $msgTable.netsh_mbn_delete_profile
                }
                nct disconnect $msgTable.netsh_mbn_disconnect
                nct dump $msgTable.netsh_mbn_dump
                nct help $msgTable.netsh_mbn_help
                nct set $msgTable.netsh_mbn_set {
                    nct profileparameter $msgTable.netsh_mbn_set_profileparameter
                    nct tracing $msgTable.netsh_mbn_set_tracing
                }
                nct show $msgTable.netsh_mbn_show {
                    nct capability $msgTable.netsh_mbn_show_capability
                    nct connection $msgTable.netsh_mbn_show_connection
                    nct homeprovider $msgTable.netsh_mbn_show_homeprovider
                    nct interfaces $msgTable.netsh_mbn_show_interfaces
                    nct pin $msgTable.netsh_mbn_show_pin
                    nct pinlist $msgTable.netsh_mbn_show_pinlist
                    nct preferredproviders $msgTable.netsh_mbn_show_preferredproviders
                    nct profiles $msgTable.netsh_mbn_show_profiles
                    nct provisionedcontexts $msgTable.netsh_mbn_show_provisionedcontexts
                    nct radio $msgTable.netsh_mbn_show_radio
                    nct readyinfo $msgTable.netsh_mbn_show_readyinfo
                    nct signal $msgTable.netsh_mbn_show_signal
                    nct smsconfig $msgTable.netsh_mbn_show_smsconfig
                    nct tracing $msgTable.netsh_mbn_show_tracing
                    nct visibleproviders $msgTable.netsh_mbn_show_visibleproviders
                }
            }

            nct namespace $msgTable.netsh_namespace {
                nct dump $msgTable.netsh_namespace_dump
                nct help $msgTable.netsh_namespace_help
                nct show $msgTable.netsh_namespace_show {
                    nct effectivepolicy $msgTable.netsh_namespace_show_effectivepolicy
                    nct policy $msgTable.netsh_namespace_show_policy
                }
            }

            nct nap $msgTable.netsh_nap {
                nct client $msgTable.netsh_nap_client {
                    nct add $msgTable.netsh_nap_client_add {
                        nct server $msgTable.netsh_nap_client_add_server
                        nct trustedservergroup $msgTable.netsh_nap_client_add_trustedservergroup
                    }
                    nct delete $msgTable.netsh_nap_client_delete {
                        nct server $msgTable.netsh_nap_client_delete_server
                        nct trustedservergroup $msgTable.netsh_nap_client_delete_trustedservergroup
                    }
                    nct dump $msgTable.netsh_nap_client_dump
                    nct export $msgTable.netsh_nap_client_export
                    nct help $msgTable.netsh_nap_client_help
                    nct import $msgTable.netsh_nap_client_import
                    nct rename $msgTable.netsh_nap_client_rename {
                        nct server $msgTable.netsh_nap_client_rename_server
                        nct trustedservergroup $msgTable.netsh_nap_client_rename_trustedservergroup
                    }
                    nct reset $msgTable.netsh_nap_client_reset {
                        nct configuration $msgTable.netsh_nap_client_reset_configuration
                        nct csp $msgTable.netsh_nap_client_reset_csp
                        nct enforcement $msgTable.netsh_nap_client_reset_enforcement
                        nct hash $msgTable.netsh_nap_client_reset_hash
                        nct server $msgTable.netsh_nap_client_reset_server
                        nct tracing $msgTable.netsh_nap_client_reset_tracing
                        nct trustedservergroup $msgTable.netsh_nap_client_reset_trustedservergroup
                        nct userinterface $msgTable.netsh_nap_client_reset_userinterface
                    }
                    nct set $msgTable.netsh_nap_client_set {
                        nct csp $msgTable.netsh_nap_client_set_csp
                        nct enforcement $msgTable.netsh_nap_client_set_enforcement
                        nct hash $msgTable.netsh_nap_client_set_hash
                        nct server $msgTable.netsh_nap_client_set_server
                        nct tracing $msgTable.netsh_nap_client_set_tracing
                        nct userinterface $msgTable.netsh_nap_client_set_userinterface
                    }
                    nct show $msgTable.netsh_nap_client_show {
                        nct configuration $msgTable.netsh_nap_client_show_configuration
                        nct csps $msgTable.netsh_nap_client_show_csps
                        nct grouppolicy $msgTable.netsh_nap_client_show_grouppolicy
                        nct hashes $msgTable.netsh_nap_client_show_hashes
                        nct state $msgTable.netsh_nap_client_show_state
                        nct trustedservergroup $msgTable.netsh_nap_client_show_trustedservergroup
                    }
                }
                nct dump $msgTable.netsh_nap_dump
                nct help $msgTable.netsh_nap_help
                nct hra $msgTable.netsh_nap_hra
                nct reset $msgTable.netsh_nap_reset {
                    nct configuration $msgTable.netsh_nap_reset_configuration
                }
                nct show $msgTable.netsh_nap_show {
                    nct configuration $msgTable.netsh_nap_show_configuration
                }
            }

            nct netio $msgTable.netsh_netio {
                nct add $msgTable.netsh_netio_add {
                    nct bindingfilter $msgTable.netsh_netio_add_bindingfilter
                }
                nct delete $msgTable.netsh_netio_delete {
                    nct bindingfilter $msgTable.netsh_netio_delete_bindingfilter
                }
                nct dump $msgTable.netsh_netio_dump
                nct help $msgTable.netsh_netio_help
                nct show $msgTable.netsh_netio_show {
                    nct bindingfilters $msgTable.netsh_netio_show_bindingfilters
                }
            }

            nct ras $msgTable.netsh_ras {
                nct aaaa $msgTable.netsh_ras_aaaa {
                    nct add $msgTable.netsh_ras_aaaa_add {
                        nct acctserver $msgTable.netsh_ras_aaaa_add_acctserver
                        nct authserver $msgTable.netsh_ras_aaaa_add_authserver
                    }
                    nct delete $msgTable.netsh_ras_aaaa_delete {
                        nct acctserver $msgTable.netsh_ras_aaaa_delete_acctserver
                        nct authserver $msgTable.netsh_ras_aaaa_delete_authserver
                    }
                    nct dump $msgTable.netsh_ras_aaaa_dump
                    nct help $msgTable.netsh_ras_aaaa_help
                    nct set $msgTable.netsh_ras_aaaa_set {
                        nct accounting $msgTable.netsh_ras_aaaa_set_accounting
                        nct acctserver $msgTable.netsh_ras_aaaa_set_acctserver
                        nct authentication $msgTable.netsh_ras_aaaa_set_authentication
                        nct authserver $msgTable.netsh_ras_aaaa_set_authserver
                        nct ipsecpolicy $msgTable.netsh_ras_aaaa_set_ipsecpolicy
                    }
                    nct show $msgTable.netsh_ras_aaaa_show {
                        nct accounting $msgTable.netsh_ras_aaaa_show_accounting
                        nct acctserver $msgTable.netsh_ras_aaaa_show_acctserver
                        nct authentication $msgTable.netsh_ras_aaaa_show_authentication
                        nct authserver $msgTable.netsh_ras_aaaa_show_authserver
                        nct ipsecpolicy $msgTable.netsh_ras_aaaa_show_ipsecpolicy
                    }
                }
                nct add $msgTable.netsh_ras_add {
                    nct authtype $msgTable.netsh_ras_add_authtype
                    nct link $msgTable.netsh_ras_add_link
                    nct multilink $msgTable.netsh_ras_add_multilink
                    nct registeredserver $msgTable.netsh_ras_add_registeredserver
                }
                nct delete $msgTable.netsh_ras_delete {
                    nct authtype $msgTable.netsh_ras_delete_authtype
                    nct link $msgTable.netsh_ras_delete_link
                    nct multilink $msgTable.netsh_ras_delete_multilink
                    nct registeredserver $msgTable.netsh_ras_delete_registeredserver
                }
                nct diagnostics $msgTable.netsh_ras_diagnostics {
                    nct dump $msgTable.netsh_ras_diagnostics_dump
                    nct help $msgTable.netsh_ras_diagnostics_help
                    nct set $msgTable.netsh_ras_diagnostics_set {
                        nct cmtracing $msgTable.netsh_ras_diagnostics_set_cmtracing
                        nct loglevel $msgTable.netsh_ras_diagnostics_set_loglevel
                        nct modemtracing $msgTable.netsh_ras_diagnostics_set_modemtracing
                        nct rastracing $msgTable.netsh_ras_diagnostics_set_rastracing
                        nct securityeventlog $msgTable.netsh_ras_diagnostics_set_securityeventlog
                        nct tracefacilities $msgTable.netsh_ras_diagnostics_set_tracefacilities
                    }
                    nct show $msgTable.netsh_ras_diagnostics_show {
                        nct all $msgTable.netsh_ras_diagnostics_show_all
                        nct cmtracing $msgTable.netsh_ras_diagnostics_show_cmtracing
                        nct configuration $msgTable.netsh_ras_diagnostics_show_configuration
                        nct installation $msgTable.netsh_ras_diagnostics_show_installation
                        nct loglevel $msgTable.netsh_ras_diagnostics_show_loglevel
                        nct logs $msgTable.netsh_ras_diagnostics_show_logs
                        nct modemtracing $msgTable.netsh_ras_diagnostics_show_modemtracing
                        nct rastracing $msgTable.netsh_ras_diagnostics_show_rastracing
                        nct securityeventlog $msgTable.netsh_ras_diagnostics_show_securityeventlog
                        nct tracefacilities $msgTable.netsh_ras_diagnostics_show_tracefacilities
                    }
                }
                nct dump $msgTable.netsh_ras_dump
                nct help $msgTable.netsh_ras_help
                nct ip $msgTable.netsh_ras_ip {
                    nct add $msgTable.netsh_ras_ip_add {
                        nct range $msgTable.netsh_ras_ip_add_range
                    }
                    nct delete $msgTable.netsh_ras_ip_delete {
                        nct pool $msgTable.netsh_ras_ip_delete_pool
                        nct range $msgTable.netsh_ras_ip_delete_range
                    }
                    nct dump $msgTable.netsh_ras_ip_dump
                    nct help $msgTable.netsh_ras_ip_help
                    nct set $msgTable.netsh_ras_ip_set {
                        nct access $msgTable.netsh_ras_ip_set_access
                        nct addrassign $msgTable.netsh_ras_ip_set_addrassign
                        nct addrreq $msgTable.netsh_ras_ip_set_addrreq
                        nct broadcastnameresolution $msgTable.netsh_ras_ip_set_broadcastnameresolution
                        nct negotiation $msgTable.netsh_ras_ip_set_negotiation
                        nct preferredadapter $msgTable.netsh_ras_ip_set_preferredadapter
                    }
                    nct show $msgTable.netsh_ras_ip_show {
                        nct config $msgTable.netsh_ras_ip_show_config
                        nct preferredadapter $msgTable.netsh_ras_ip_show_preferredadapter
                    }
                }
                nct set $msgTable.netsh_ras_set {
                    nct authmode $msgTable.netsh_ras_set_authmode
                    nct client $msgTable.netsh_ras_set_client
                    nct conf $msgTable.netsh_ras_set_conf
                    nct portstatus $msgTable.netsh_ras_set_portstatus
                    nct type $msgTable.netsh_ras_set_type
                    nct user $msgTable.netsh_ras_set_user
                    nct wanports $msgTable.netsh_ras_set_wanports
                }
                nct show $msgTable.netsh_ras_show {
                    nct activeservers $msgTable.netsh_ras_show_activeservers
                    nct authmode $msgTable.netsh_ras_show_authmode
                    nct authtype $msgTable.netsh_ras_show_authtype
                    nct client $msgTable.netsh_ras_show_client
                    nct conf $msgTable.netsh_ras_show_conf
                    nct link $msgTable.netsh_ras_show_link
                    nct multilink $msgTable.netsh_ras_show_multilink
                    nct portstatus $msgTable.netsh_ras_show_portstatus
                    nct registeredserver $msgTable.netsh_ras_show_registeredserver
                    nct status $msgTable.netsh_ras_show_status
                    nct type $msgTable.netsh_ras_show_type
                    nct user $msgTable.netsh_ras_show_user
                    nct wanports $msgTable.netsh_ras_show_wanports
                }
            }

            nct rpc $msgTable.netsh_rpc {
                nct add $msgTable.netsh_rpc_add
                nct delete $msgTable.netsh_rpc_delete
                nct dump $msgTable.netsh_rpc_dump
                nct filter $msgTable.netsh_rpc_filter {
                    nct add $msgTable.netsh_rpc_filter_add {
                        nct condition $msgTable.netsh_rpc_filter_add_condition
                        nct filter $msgTable.netsh_rpc_filter_add_filter
                        nct rule $msgTable.netsh_rpc_filter_add_rule
                    }
                    nct delete $msgTable.netsh_rpc_filter_delete {
                        nct filter $msgTable.netsh_rpc_filter_delete_filter
                        nct rule $msgTable.netsh_rpc_filter_delete_rule
                    }
                    nct dump $msgTable.netsh_rpc_filter_dump
                    nct help $msgTable.netsh_rpc_filter_help
                    nct show $msgTable.netsh_rpc_filter_show {
                        nct filter $msgTable.netsh_rpc_filter_show_filter
                    }
                }
                nct help $msgTable.netsh_rpc_help
                nct reset $msgTable.netsh_rpc_reset
                nct show $msgTable.netsh_rpc_show
            }

            nct set $msgTable.netsh_set {
                nct machine $msgTable.netsh_set_machine
            }

            nct show $msgTable.netsh_show {
                nct alias $msgTable.netsh_show_alias
                nct helper $msgTable.netsh_show_helper
            }

            nct trace $msgTable.netsh_trace {
                nct convert $msgTable.netsh_trace_convert
                nct correlate $msgTable.netsh_trace_correlate
                nct diagnose $msgTable.netsh_trace_diagnose
                nct dump $msgTable.netsh_trace_dump
                nct help $msgTable.netsh_trace_help
                nct show $msgTable.netsh_trace_show {
                    nct CaptureFilterHelp $msgTable.netsh_trace_show_CaptureFilterHelp
                    nct globalKeywordsAndLevels $msgTable.netsh_trace_show_globalKeywordsAndLevels
                    nct helperclass $msgTable.netsh_trace_show_helperclass
                    nct interfaces $msgTable.netsh_trace_show_interfaces
                    nct provider $msgTable.netsh_trace_show_provider
                    nct providers $msgTable.netsh_trace_show_providers
                    nct scenario $msgTable.netsh_trace_show_scenario
                    nct scenarios $msgTable.netsh_trace_show_scenarios
                    nct status $msgTable.netsh_trace_show_status
                }
                nct start $msgTable.netsh_trace_start
                nct stop $msgTable.netsh_trace_stop
            }

            nct wcn $msgTable.netsh_wcn {
                nct dump $msgTable.netsh_wcn_dump
                nct enroll $msgTable.netsh_wcn_enroll
                nct help $msgTable.netsh_wcn_help
                nct query $msgTable.netsh_wcn_query
            }

            nct wfp $msgTable.netsh_wfp {
                nct capture $msgTable.netsh_wfp_capture {
                    nct start $msgTable.netsh_wfp_capture_start
                    nct status $msgTable.netsh_wfp_capture_status
                    nct stop $msgTable.netsh_wfp_capture_stop
                }
                nct dump $msgTable.netsh_wfp_dump
                nct help $msgTable.netsh_wfp_help
                nct set $msgTable.netsh_wfp_set {
                    nct options $msgTable.netsh_wfp_set_options
                }
                nct show $msgTable.netsh_wfp_show {
                    nct appid $msgTable.netsh_wfp_show_appid
                    nct boottimepolicy $msgTable.netsh_wfp_show_boottimepolicy
                    nct filters $msgTable.netsh_wfp_show_filters
                    nct netevents $msgTable.netsh_wfp_show_netevents
                    nct options $msgTable.netsh_wfp_show_options
                    nct security $msgTable.netsh_wfp_show_security
                    nct state $msgTable.netsh_wfp_show_state
                    nct sysports $msgTable.netsh_wfp_show_sysports
                }
            }

            nct winhttp $msgTable.netsh_winhttp {
                nct dump $msgTable.netsh_winhttp_dump
                nct help $msgTable.netsh_winhttp_help
                nct import $msgTable.netsh_winhttp_import {
                    nct proxy $msgTable.netsh_winhttp_import_proxy
                }
                nct reset $msgTable.netsh_winhttp_reset {
                    nct proxy $msgTable.netsh_winhttp_reset_proxy
                    nct tracing $msgTable.netsh_winhttp_reset_tracing
                }
                nct set $msgTable.netsh_winhttp_set {
                    nct proxy $msgTable.netsh_winhttp_set_proxy
                    nct tracing $msgTable.netsh_winhttp_set_tracing
                }
                nct show $msgTable.netsh_winhttp_show {
                    nct proxy $msgTable.netsh_winhttp_show_proxy
                    nct tracing $msgTable.netsh_winhttp_show_tracing
                }
            }

            nct winsock $msgTable.netsh_winsock {
                nct audit $msgTable.netsh_winsock_audit {
                    nct trail $msgTable.netsh_winsock_audit_trail
                }
                nct dump $msgTable.netsh_winsock_dump
                nct help $msgTable.netsh_winsock_help
                nct remove $msgTable.netsh_winsock_remove {
                    nct provider $msgTable.netsh_winsock_remove_provider
                }
                nct reset $msgTable.netsh_winsock_reset
                nct set $msgTable.netsh_winsock_set {
                    nct autotuning $msgTable.netsh_winsock_set_autotuning
                }
                nct show $msgTable.netsh_winsock_show {
                    nct autotuning $msgTable.netsh_winsock_show_autotuning
                    nct catalog $msgTable.netsh_winsock_show_catalog
                }
            }

            nct wlan $msgTable.netsh_wlan {
                nct add $msgTable.netsh_wlan_add {
                    nct filter $msgTable.netsh_wlan_add_filter
                    nct profile $msgTable.netsh_wlan_add_profile
                }
                nct connect $msgTable.netsh_wlan_connect
                nct delete $msgTable.netsh_wlan_delete {
                    nct filter $msgTable.netsh_wlan_delete_filter
                    nct profile $msgTable.netsh_wlan_delete_profile
                }
                nct disconnect $msgTable.netsh_wlan_disconnect
                nct dump $msgTable.netsh_wlan_dump
                nct export $msgTable.netsh_wlan_export {
                    nct hostednetworkprofile $msgTable.netsh_wlan_export_hostednetworkprofile
                    nct profile $msgTable.netsh_wlan_export_profile
                }
                nct help $msgTable.netsh_wlan_help
                nct refresh $msgTable.netsh_wlan_refresh {
                    nct hostednetwork $msgTable.netsh_wlan_refresh_hostednetwork
                }
                nct reportissues $msgTable.netsh_wlan_reportissues
                nct set $msgTable.netsh_wlan_set {
                    nct allowexplicitcreds $msgTable.netsh_wlan_set_allowexplicitcreds
                    nct autoconfig $msgTable.netsh_wlan_set_autoconfig
                    nct blockednetworks $msgTable.netsh_wlan_set_blockednetworks
                    nct blockperiod $msgTable.netsh_wlan_set_blockperiod
                    nct createalluserprofile $msgTable.netsh_wlan_set_createalluserprofile
                    nct hostednetwork $msgTable.netsh_wlan_set_hostednetwork
                    nct profileorder $msgTable.netsh_wlan_set_profileorder
                    nct profileparameter $msgTable.netsh_wlan_set_profileparameter
                    nct profiletype $msgTable.netsh_wlan_set_profiletype
                    nct tracing $msgTable.netsh_wlan_set_tracing
                }
                nct show $msgTable.netsh_wlan_show {
                    nct all $msgTable.netsh_wlan_show_all
                    nct allowexplicitcreds $msgTable.netsh_wlan_show_allowexplicitcreds
                    nct autoconfig $msgTable.netsh_wlan_show_autoconfig
                    nct blockednetworks $msgTable.netsh_wlan_show_blockednetworks
                    nct createalluserprofile $msgTable.netsh_wlan_show_createalluserprofile
                    nct drivers $msgTable.netsh_wlan_show_drivers
                    nct filters $msgTable.netsh_wlan_show_filters
                    nct hostednetwork $msgTable.netsh_wlan_show_hostednetwork
                    nct interfaces $msgTable.netsh_wlan_show_interfaces
                    nct networks $msgTable.netsh_wlan_show_networks
                    nct onlyUseGPProfilesforAllowedNetworks $msgTable.netsh_wlan_show_onlyUseGPProfilesforAllowedNetworks
                    nct profiles $msgTable.netsh_wlan_show_profiles
                    nct settings $msgTable.netsh_wlan_show_settings
                    nct tracing $msgTable.netsh_wlan_show_tracing
                }
                nct start $msgTable.netsh_wlan_start {
                    nct hostednetwork $msgTable.netsh_wlan_start_hostednetwork
                }
                nct stop $msgTable.netsh_wlan_stop {
                    nct hostednetwork $msgTable.netsh_wlan_stop_hostednetwork
                }
            }
        }

        Set-CompletionPrivateData -Key NetshExeCompletionCommandTree -Value $commandTree
    }

    Get-CommandTreeCompletion $wordToComplete $commandAst $commandTree
}


#
# .SYNOPSIS
#
# Complete parameters and arguments to bcedit.exe
#
function BCDEditExeCompletion
{
    param($wordToComplete, $commandAst)

    $BCDEditSwitches = Get-CompletionPrivateData -Key BCDEdit
    if ($null -eq $BCDEditSwitches)
    {
        # This is a very naive implementation - parse the output of bcdedit
        # run a couple different ways to collect candidate completions.

        $switches = bcdedit /? 2>$null | ForEach-Object { [regex]::Matches($_, '/\w+').Value } | Sort-Object -Unique
        $switches += '/?'

        $nestedSwitches = @()
        foreach ($switch in $switches)
        {
            $nestedSwitches += bcdedit /? $switch 2>$null | ForEach-Object { [regex]::Matches($_, '/\w+').Value }
        }

        $BCDEditSwitches = ($switches += $nestedSwitches) | Sort-Object -Unique
        Set-CompletionPrivateData -Key BCDEdit -Value $BCDEditSwitches
    }

    $BCDEditSwitches |
        Where-Object { $_ -like "$wordToComplete*" } |
        ForEach-Object { New-CompletionResult $_ }

    # Also complete GUIDs and named configs - don't cache these, they might change
    # TODO: This can be smarter, I think it can suggest things that don't work.
    # TODO: THe following doesn't do anything useful if the process isn't elevated.
    bcdedit /ENUM 2>$null |
        ForEach-Object { [regex]::Matches($_, '\{[\w-]+\}').Value } |
        Sort-Object -Unique |
        Where-Object { $_ -like "$wordToComplete*" } |
        ForEach-Object { New-CompletionResult $_ }
}


Register-ArgumentCompleter `
    -Command 'PowerShell' `
    -Native `
    -Description 'Complete parameters and arguments to powershell.exe' `
    -ScriptBlock $function:PowerShellExeCompletion


Register-ArgumentCompleter `
    -Command 'Net' `
    -Native `
    -Description 'Complete arguments to net.exe' `
    -ScriptBlock $function:NetExeCompletion


Register-ArgumentCompleter `
    -Command 'Netsh' `
    -Native `
    -Description 'Complete arguments to netsh.exe' `
    -ScriptBlock $function:NetshExeCompletion


Register-ArgumentCompleter `
    -Command 'bcdedit' `
    -Native `
    -Description 'Complete arguments to bcdedit.exe' `
    -ScriptBlock $function:BCDEditExeCompletion