-
Notifications
You must be signed in to change notification settings - Fork 40
/
PowerView3.cna
6665 lines (6375 loc) · 309 KB
/
PowerView3.cna
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
#
# PowerView 3.0 and SharpView Menu for Cobalt Strike
#
# PowerPick and PowerShell commands requires @harmj0y's PowerView https://github.com/PowerShellMafia/PowerSploit/blob/dev/Recon/PowerView.ps1
# Uses current DEV branch
# Execute-Assembly Requires SharpView https://github.com/tevora-threat/SharpView
#
# If using SharpView make sure the variable $sharviewlocation is set correctly
#
# Creating a credential object will have the creds be in the command (just like PowerView examples)
#
#
# TODO: Support command piping
# Not have to edit source to update SharpView location
#
popup beacon_top {
menu "PowerView 3.0" {
menu "Misc Functions"{
item "Export-PowerViewCSV"{
local('$bid');
foreach $bid ($1){
exportpowerviewcsv($bid);
}
}
item "Resolve-IPAddress"{
local('$bid');
foreach $bid ($1){
resolveipaddress($bid);
}
}
item "ConvertTo-SID"{
local('$bid');
foreach $bid ($1){
converttosid($bid);
}
}
item "Convert-ADName"{
local('$bid');
foreach $bid ($1){
convertadname($bid);
}
}
item "ConvertFrom-UACValue"{
local('$bid');
foreach $bid ($1){
convertfromuacvalue($bid);
}
}
item "Add-RemoteConnection"{
local('$bid');
foreach $bid ($1){
addremoteconnection($bid);
}
}
item "Remove-RemoteConnection"{
local('$bid');
foreach $bid ($1){
removeremoteconnection($bid);
}
}
item "Invoke-UserImpersonation"{
local('$bid');
foreach $bid ($1){
invokeuserimpersonation($bid);
}
}
item "Invoke-RevertToSelf"{
local('$bid');
foreach $bid ($1){
invokereverttoself($bid);
}
}
item "Get-DomainSPNTicket"{
local('$bid');
foreach $bid ($1){
getdomainspnticket($bid);
}
}
item "Invoke-Kerberoast"{
local('$bid');
foreach $bid ($1){
invokekerberoast($bid);
}
}
item "Get-PathAcl"{
local('$bid');
foreach $bid ($1){
getpathacl($bid);
}
}
}
menu "Domain/LDAP Functions"{
item "Get-DomainDNSZone"{
local('$bid');
foreach $bid ($1){
getdomaindnszone($bid);
}
}
item "Get-DomainDNSRecord"{
local('$bid');
foreach $bid ($1){
getdomaindnsrecord($bid);
}
}
item "Get-Domain"{
local('$bid');
foreach $bid ($1){
getdomain($bid);
}
}
item "Get-DomainController"{
local('$bid');
foreach $bid ($1){
getdomaincontroller($bid);
}
}
item "Get-Forest"{
local('$bid');
foreach $bid ($1){
getforest($bid);
}
}
item "Get-ForestDomain"{
local('$bid');
foreach $bid ($1){
getforestdomain($bid);
}
}
item "Get-ForestGlobalCatalog"{
local('$bid');
foreach $bid ($1){
getforestglobalcatalog($bid);
}
}
item "Find-DomainObjectPropertyOutlier"{
local('$bid');
foreach $bid ($1){
finddomainobjectpropertyoutlier($bid);
}
}
item "Get-DomainUser"{
local('$bid');
foreach $bid ($1){
getdomainuser($bid);
}
}
item "New-DomainUser"{
local('$bid');
foreach $bid ($1){
newdomainuser($bid);
}
}
item "Set-DomainUserPassword"{
local('$bid');
foreach $bid ($1){
setdomainuserpassword($bid);
}
}
item "Get-DomainUserEvent"{
local('$bid');
foreach $bid ($1){
getdomainuserevent($bid);
}
}
item "Get-DomainComputer"{
local('$bid');
foreach $bid ($1){
getdomaincomputer($bid);
}
}
item "Get-DomainObject"{
local('$bid');
foreach $bid ($1){
getdomainobject($bid);
}
}
item "Set-DomainObject"{
local('$bid');
foreach $bid ($1){
setdomainobject($bid);
}
}
item "Get-DomainObjectAcl"{
local('$bid');
foreach $bid ($1){
getdomainobjectacl($bid);
}
}
item "Add-DomainObjectAcl"{
local('$bid');
foreach $bid ($1){
adddomainobjectacl($bid);
}
}
item "Find-InterestingDomainAcl"{
local('$bid');
foreach $bid ($1){
findinterestingdomainacl($bid);
}
}
item "Get-DomainOU"{
local('$bid');
foreach $bid ($1){
getdomainou($bid);
}
}
item "Get-DomainSite"{
local('$bid');
foreach $bid ($1){
getdomainsite($bid);
}
}
item "Get-DomainSubnet"{
local('$bid');
foreach $bid ($1){
getdomainsubnet($bid);
}
}
item "Get-DomainSID"{
local('$bid');
foreach $bid ($1){
getdomainsid($bid);
}
}
item "Get-DomainGroup"{
local('$bid');
foreach $bid ($1){
getdomaingroup($bid);
}
}
item "New-DomainGroup"{
local('$bid');
foreach $bid ($1){
newdomaingroup($bid);
}
}
item "Get-DomainManagedSecurityGroup"{
local('$bid');
foreach $bid ($1){
getdomainmanagedsecuritygroup($bid);
}
}
item "Get-DomainGroupMember"{
local('$bid');
foreach $bid ($1){
getdomaingroupmember($bid);
}
}
item "Add-DomainGroupMember"{
local('$bid');
foreach $bid ($1){
adddomaingroupmember($bid);
}
}
item "Get-DomainFileServer"{
local('$bid');
foreach $bid ($1){
getdomainfileserver($bid);
}
}
item "Get-DomainDFSShare"{
local('$bid');
foreach $bid ($1){
getdomaindfsshare($bid);
}
}
}
menu "GPO Functions"{
item "Get-DomainGPO"{
local('$bid');
foreach $bid ($1){
getdomaingpo($bid);
}
}
item "Get-DomainGPOLocalGroup"{
local('$bid');
foreach $bid ($1){
getdomaingpolocalgroup($bid);
}
}
item "Get-DomainGPOUserLocalGroupMapping"{
local('$bid');
foreach $bid ($1){
getdomaingpouserlocalgroupmapping($bid);
}
}
item "Get-DomainGPOComputerLocalGroupMapping"{
local('$bid');
foreach $bid ($1){
getdomaingpocomputerlocalgroupmapping($bid);
}
}
}
menu "Computer Enumeration Functions"{
item "Get-DomainPolicy"{
local('$bid');
foreach $bid ($1){
getdomainpolicy($bid);
}
}
item "Get-NetLocalGroup"{
local('$bid');
foreach $bid ($1){
getnetlocalgroup($bid);
}
}
item "Get-NetLocalGroupMember"{
local('$bid');
foreach $bid ($1){
getnetlocalgroupmember($bid);
}
}
item "Get-NetShare"{
local('$bid');
foreach $bid ($1){
getnetshare($bid);
}
}
item "Get-NetLoggedon"{
local('$bid');
foreach $bid ($1){
getnetloggedon($bid);
}
}
item "Get-NetSession"{
local('$bid');
foreach $bid ($1){
getnetsession($bid);
}
}
item "Get-RegLoggedOn"{
local('$bid');
foreach $bid ($1){
getregloggedon($bid);
}
}
item "Get-NetRDPSession"{
local('$bid');
foreach $bid ($1){
getnetrdpsession($bid);
}
}
item "Test-AdminAccess"{
local('$bid');
foreach $bid ($1){
testadminaccess($bid);
}
}
item "Get-NetComputerSiteName"{
local('$bid');
foreach $bid ($1){
getnetcomputersitename($bid);
}
}
item "Get-WMIRegProxy"{
local('$bid');
foreach $bid ($1){
getwmiregproxy($bid);
}
}
item "Get-WMIRegLastLoggedOn"{
local('$bid');
foreach $bid ($1){
getwmireglastloggedon($bid);
}
}
item "Get-WMIRegCachedRDPConnection"{
local('$bid');
foreach $bid ($1){
getwmiregcachedrdpconnection($bid);
}
}
item "Get-WMIRegMountedDrive"{
local('$bid');
foreach $bid ($1){
getwmiregmounteddrive($bid);
}
}
item "Get-WMIProcess"{
local('$bid');
foreach $bid ($1){
getwmiprocess($bid);
}
}
item "Find-InterestingFile"{
local('$bid');
foreach $bid ($1){
findinterestingfile($bid);
}
}
}
menu "Threaded Meta-Functions"{
item "Find-DomainUserLocation"{
local('$bid');
foreach $bid ($1){
finddomainuserlocation($bid);
}
}
item "Find-DomainProcess"{
local('$bid');
foreach $bid ($1){
finddomainprocess($bid);
}
}
item "Find-DomainUserEvent"{
local('$bid');
foreach $bid ($1){
finddomainuserevent($bid);
}
}
item "Find-DomainShare"{
local('$bid');
foreach $bid ($1){
finddomainshare($bid);
}
}
item "Find-InterestingDomainShareFile"{
local('$bid');
foreach $bid ($1){
findinterestingdomainsharefile($bid);
}
}
item "Find-LocalAdminAccess"{
local('$bid');
foreach $bid ($1){
findlocaladminaccess($bid);
}
}
item "Find-DomainLocalGroupMember"{
local('$bid');
foreach $bid ($1){
finddomainlocalgroupmember($bid);
}
}
}
menu "Domain Trust Functions"{
item "Get-DomainTrust"{
local('$bid');
foreach $bid ($1){
getdomaintrust($bid);
}
}
item "Get-ForestTrust"{
local('$bid');
foreach $bid ($1){
getforesttrust($bid);
}
}
item "Get-DomainForeignUser"{
local('$bid');
foreach $bid ($1){
getdomainforeignuser($bid);
}
}
item "Get-DomainForeignGroupMember"{
local('$bid');
foreach $bid ($1){
getdomainforeigngroupmember($bid);
}
}
item "Get-DomainTrustMapping"{
local('$bid');
foreach $bid ($1){
getdomaintrustmapping($bid);
}
}
}
}
}
#-------------
# Help Menus
#-------------
sub helpexportpowerviewcsv {
show_message("
Function:
Export-PowerViewCSV
Description:
Converts a 'DOMAIN\\username' syntax to a security identifier (SID)
using System.Security.Principal.NTAccount's translate function. If alternate
credentials are supplied, then Get-ADObject is used to try to map the name
to a security identifier.
Parameters:
InputObject: Specifies the objects to export as CSV strings.
Path: Specifies the path to the CSV output file.
Delimiter: Specifies a delimiter to separate the property values. The default is a comma (,)
Append: Indicates that this cmdlet adds the CSV output to the end of the specified file.");
}
sub helpresolveipaddress {
show_message("
Function:
Resolve-IPAddress
Description:
Resolves a given hostename to its associated IPv4 address using
[Net.Dns]::GetHostEntry(). If no hostname is provided, the default
is the IP address of the localhost.");
}
sub helpconverttosid {
show_message("
Function:
ConvertTo-SID
Description:
Converts a 'DOMAIN\\username' syntax to a security identifier (SID)
using System.Security.Principal.NTAccount's translate function. If alternate
credentials are supplied, then Get-ADObject is used to try to map the name
Parameters:
ObjectName: The user/group name to convert, can be 'user' or 'DOMAIN\\user' format.
Domain: Specifies the domain to use for the translation, defaults to the current domain.
Server: Specifies an Active Directory server (domain controller) to bind to for the translation.
Credential: Specifies an alternate credential to use for the translation.");
}
sub helpconvertadname {
show_message("
Function:
Convert-ADName
Description:
This function is heavily based on Bill Stewart's code and Pasquale Lantella's code (in LINK)
and translates Active Directory names between various formats using the NameTranslate COM object.
Parameters:
Identity: Specifies the Active Directory object name to translate, of the following form:
DN short for 'distinguished name'; e.g., 'CN=Phineas Flynn,OU=Engineers,DC=fabrikam,DC=com'
Canonical canonical name; e.g., 'fabrikam.com/Engineers/Phineas Flynn'
NT4 domain\\username; e.g., 'fabrikam\\pflynn'
Display display name, e.g. 'pflynn'
DomainSimple simple domain name format, e.g. '[email protected]'
EnterpriseSimple simple enterprise name format, e.g. '[email protected]'
GUID GUID; e.g., '{95ee9fff-3436-11d1-b2b0-d15ae3ac8436}'
UPN user principal name; e.g., '[email protected]'
CanonicalEx extended canonical name format
SPN service principal name format; e.g. 'HTTP/kairomac.contoso.com'
SID Security Identifier; e.g., 'S-1-5-21-12986231-600641547-709122288-57999'
OutputType: Specifies the output name type you want to convert to, which must be one of the following:
DN short for 'distinguished name'; e.g., 'CN=Phineas Flynn,OU=Engineers,DC=fabrikam,DC=com'
Canonical canonical name; e.g., 'fabrikam.com/Engineers/Phineas Flynn'
NT4 domain\\username; e.g., 'fabrikam\\pflynn'
Display display name, e.g. 'pflynn'
DomainSimple simple domain name format, e.g. '[email protected]'
EnterpriseSimple simple enterprise name format, e.g. '[email protected]'
GUID GUID; e.g., '{95ee9fff-3436-11d1-b2b0-d15ae3ac8436}'
UPN user principal name; e.g., '[email protected]'
CanonicalEx extended canonical name format, e.g. 'fabrikam.com/Users/Phineas Flynn'
SPN service principal name format; e.g. 'HTTP/kairomac.contoso.com'
Domain: Specifies the domain to use for the translation, defaults to the current domain.
Server: Specifies an Active Directory server (domain controller) to bind to for the translation.
Credential: Specifies an alternate credential to use for the translation.");
}
sub helpconvertfromuacvalue {
show_message("
Function:
ConvertFrom-UACValue
Description:
This function will take an integer that represents a User Account
Control (UAC) binary blob and will covert it to an ordered
dictionary with each bitwise value broken out. By default only values
set are displayed- the -ShowAll switch will display all values with
a + next to the ones set.
Parameters:
Value: Specifies the integer UAC value to convert.
ShowAll: Switch. Signals ConvertFrom-UACValue to display all UAC values, with a + indicating the value is currently set.");
}
sub helpaddremoteconnection {
show_message("
Function:
Add-RemoteConnection
Description:
This function uses WNetAddConnection2W to make a 'temporary' (i.e. not saved) connection
to the specified remote -Path (\\\\UNC\\share) with the alternate credentials specified in the
-Credential object. If a -Path isn't specified, a -ComputerName is required to pseudo-mount IPC\$.
Parameters:
ComputerName: Specifies the system to add a \\\\ComputerName\\IPC\$ connection for.
Path: Specifies the remote \\\\UNC\\path to add the connection for.
Credential: A [Management.Automation.PSCredential] object of alternate credentials");
}
sub helpremoveremoteconnection {
show_message("
Function:
Remove-RemoteConnection
Description:
This function uses WNetCancelConnection2 to destroy a connection created by
New-RemoteConnection. If a -Path isn't specified, a -ComputerName is required to
'unmount' \\\\\$ComputerName\\IPC\$.
Parameters:
ComputerName: Specifies the system to remove a \\\\ComputerName\\IPC\$ connection for.
Path: Specifies the remote \\\\UNC\\path to remove the connection for.");
}
sub helpinvokeuserimpersonation {
show_message("
Function:
Invoke-UserImpersonation
Description:
This function uses LogonUser() with the LOGON32_LOGON_NEW_CREDENTIALS LogonType
to simulate 'runas /netonly'. The resulting token is then impersonated with
ImpersonateLoggedOnUser() and the token handle is returned for later usage
Parameters:
Credential: A [Management.Automation.PSCredential] object with alternate credentials
TokenHandle: An IntPtr TokenHandle returned by a previous Invoke-UserImpersonation.
Quiet: Suppress any warnings about STA vs MTA.");
}
sub helpinvokereverttoself {
show_message("
Function:
Invoke-RevertToSelf
Description:
This function uses RevertToSelf() to revert any impersonated tokens.
If -TokenHandle is passed (the token handle returned by Invoke-UserImpersonation),
CloseHandle() is used to close the opened handle.
Parameters:
TokenHandle: An optional IntPtr TokenHandle returned by Invoke-UserImpersonation.");
}
sub helpgetdomainspnticket {
show_message("
Function:
Get-DomainSPNTicket
Description:
This function will either take one/more SPN strings, or one/more PowerView.User objects
(the output from Get-DomainUser) and will request a kerberos ticket for the given SPN
using System.IdentityModel.Tokens.KerberosRequestorSecurityToken. The encrypted
portion of the ticket is then extracted and output in either crackable John or Hashcat
format (deafult of Hashcat).
Parameters:
SPN: Specifies the service principal name to request the ticket for.
User: Specifies a PowerView.User object (result of Get-DomainUser) to request the ticket for.
OutputFormat: Either 'John' for John the Ripper style hash formatting, or 'Hashcat' for Hashcat format.
Credential: A [Management.Automation.PSCredential] object of alternate credentials");
}
sub helpinvokekerberoast {
show_message("
Function:
Invoke-Kerberoast
Description:
Uses Get-DomainUser to query for user accounts with non-null service principle
names (SPNs) and uses Get-SPNTicket to request/extract the crackable ticket information.
Parameters:
Identity: A SamAccountName (e.g. harmj0y), DistinguishedName (e.g. CN=harmj0y,CN=Users,DC=testlab,DC=local),
Domain: Specifies the domain to use for the query, defaults to the current domain.
LDAPFilter: Specifies an LDAP query string that is used to filter Active Directory objects.
SearchBase: The LDAP source to search through, e.g. 'LDAP://OU=secret,DC=testlab,DC=local'
Server: Specifies an Active Directory server (domain controller) to bind to.
SearchScope: Specifies the scope to search under, Base/OneLevel/Subtree (default of Subtree).
ResultPageSize: Specifies the PageSize to set for the LDAP searcher object.
ServerTimeLimit: Specifies the maximum amount of time the server spends searching. Default of 120 seconds.
Tombstone: Switch. Specifies that the searcher should also return deleted/tombstoned objects.
Credential: A [Management.Automation.PSCredential] object of alternate credentials");
}
sub helpgetpathacl {
show_message("
Function:
Get-PathAcl
Description:
Enumerates the ACL for a specified file/folder path, and translates
the access rules for each entry into readable formats. If -Credential is passed,
Add-RemoteConnection/Remove-RemoteConnection is used to temporarily map the remote share.
Parameters:
Path: Specifies the local or remote path to enumerate the ACLs for.
Credential: A [Management.Automation.PSCredential] object of alternate credentials");
}
sub helpgetdomaindnszone {
show_message("
Function:
Get-DomainDNSZone
Parameters:
Domain: The domain to query for zones, defaults to the current domain.
Server: Specifies an Active Directory server (domain controller) to bind to for the search.
Properties: Specifies the properties of the output object to retrieve from the server.
ResultPageSize: Specifies the PageSize to set for the LDAP searcher object.
ServerTimeLimit: Specifies the maximum amount of time the server spends searching. Default of 120 seconds.
FindOne: Only return one result object.
Credential: A [Management.Automation.PSCredential] object of alternate credentials");
}
sub helpgetdomaindnsrecord {
show_message("
Function:
Get-DomainDNSRecord
Description:
Given a specific Active Directory DNS zone name, query for all 'dnsNode'
LDAP entries using that zone as the search base. Return all DNS entry results
and use Convert-DNSRecord to try to convert the binary DNS record blobs.
Parameters:
ZoneName: Specifies the zone to query for records (which can be enumearted with Get-DomainDNSZone).
Domain: The domain to query for zones, defaults to the current domain.
Server: Specifies an Active Directory server (domain controller) to bind to for the search.
Properties: Specifies the properties of the output object to retrieve from the server.
ResultPageSize: Specifies the PageSize to set for the LDAP searcher object.
ServerTimeLimit: Specifies the maximum amount of time the server spends searching. Default of 120 seconds.
FindOne: Only return one result object.
Credential: A [Management.Automation.PSCredential] object of alternate credentials");
}
sub helpgetdomain {
show_message("
Function:
Get-Domain
Description:
Returns a System.DirectoryServices.ActiveDirectory.Domain object for the current
domain or the domain specified with -Domain X.
Parameters:
Domain: Specifies the domain name to query for, defaults to the current domain.
Credential: A [Management.Automation.PSCredential] object of alternate credentials");
}
sub helpgetdomaincontroller {
show_message("
Function:
Get-DomainController
Description:
Enumerates the domain controllers for the current or specified domain.
By default built in .NET methods are used. The -LDAP switch uses Get-DomainComputer
to search for domain controllers.
Parameters:
Domain: The domain to query for domain controllers, defaults to the current domain.
Server: Specifies an Active Directory server (domain controller) to bind to.
LDAP: Switch. Use LDAP queries to determine the domain controllers instead of built in .NET methods.
Credential: A [Management.Automation.PSCredential] object of alternate credentials");
}
sub helpgetforest {
show_message("
Function:
Get-Forest
Description:
Returns a System.DirectoryServices.ActiveDirectory.Forest object for the current
forest or the forest specified with -Forest X.
Parameters:
Forest: The forest name to query for, defaults to the current forest.
Credential: A [Management.Automation.PSCredential] object of alternate credentials");
}
sub helpgetforestdomain {
show_message("
Function:
Get-ForestDomain
Description:
Returns all domains for the current forest or the forest specified
by -Forest X.
Parameters:
Forest: Specifies the forest name to query for domains.
Credential: A [Management.Automation.PSCredential] object of alternate credentials");
}
sub helpgetforestglobalcatalog {
show_message("
Function:
Get-ForestGlobalCatalog
Description:
Returns all global catalogs for the current forest or the forest specified
by -Forest X by using Get-Forest to retrieve the specified forest object
and the .FindAllGlobalCatalogs() to enumerate the global catalogs.
Parameters:
Forest: Specifies the forest name to query for global catalogs.
Credential: A [Management.Automation.PSCredential] object of alternate credentials");
}
sub helpfinddomainobjectpropertyoutlier {
show_message("
Function:
Find-DomainObjectPropertyOutlier
Description:
A 'reference' set of property names is calculated, either from a standard set preserved
for user/group/computers, or from the array of names passed to -ReferencePropertySet, or
from the property names of the passed -ReferenceObject. Every user/group/computer object
(depending on determined class) are enumerated, and for each object, if the object has a
'non-standard' property set (meaning a property not held by the reference set), the object's
samAccountName, property name, and property value are output to the pipeline.
Parameters:
ClassName: Specifies the AD object class to find property outliers for, 'user', 'group', or 'computer'.
ReferencePropertySet: Specifies an array of property names to diff against the class schema.
ReferenceObject: Specicifes the PowerView user/group/computer object to extract property names
Domain: Specifies the domain to use for the query, defaults to the current domain.
LDAPFilter: Specifies an LDAP query string that is used to filter Active Directory objects.
SearchBase: The LDAP source to search through, e.g. 'LDAP://OU=secret,DC=testlab,DC=local'
Server: Specifies an Active Directory server (domain controller) to bind to.
SearchScope: Specifies the scope to search under, Base/OneLevel/Subtree (default of Subtree).
ResultPageSize: Specifies the PageSize to set for the LDAP searcher object.
ServerTimeLimit: Specifies the maximum amount of time the server spends searching. Default of 120 seconds.
Tombstone: Switch. Specifies that the searcher should also return deleted/tombstoned objects.
Credential: A [Management.Automation.PSCredential] object of alternate credentials");
}
sub helpgetdomainuser {
show_message("
Function:
Get-DomainUser
Description:
Builds a directory searcher object using Get-DomainSearcher, builds a custom
LDAP filter based on targeting/filter parameters, and searches for all objects
matching the criteria. To only return specific properties, use
'-Properties samaccountname,usnchanged,...'. By default, all user objects for
the current domain are returned.
Parameters:
Identity: A SamAccountName (e.g. harmj0y), DistinguishedName (e.g. CN=harmj0y,CN=Users,DC=testlab,DC=local),
SPN: Switch. Only return user objects with non-null service principal names.
UACFilter: Dynamic parameter that accepts one or more values from $UACEnum, including
AdminCount: Switch. Return users with '(adminCount=1)' (meaning are/were privileged).
AllowDelegation: Switch. Return user accounts that are not marked as 'sensitive and not allowed for delegation'
DisallowDelegation: Switch. Return user accounts that are marked as 'sensitive and not allowed for delegation'
TrustedToAuth: Switch. Return computer objects that are trusted to authenticate for other principals.
PreauthNotRequired: Switch. Return user accounts with 'Do not require Kerberos preauthentication' set.
Domain: Specifies the domain to use for the query, defaults to the current domain.
LDAPFilter: Specifies an LDAP query string that is used to filter Active Directory objects.
Properties: Specifies the properties of the output object to retrieve from the server.
SearchBase: The LDAP source to search through, e.g. 'LDAP://OU=secret,DC=testlab,DC=local'
Server: Specifies an Active Directory server (domain controller) to bind to.
SearchScope: Specifies the scope to search under, Base/OneLevel/Subtree (default of Subtree).
ResultPageSize: Specifies the PageSize to set for the LDAP searcher object.
ServerTimeLimit: Specifies the maximum amount of time the server spends searching. Default of 120 seconds.
SecurityMasks: Specifies an option for examining security information of a directory object.
Tombstone: Switch. Specifies that the searcher should also return deleted/tombstoned objects.
FindOne: Only return one result object.
Credential: A [Management.Automation.PSCredential] object of alternate credentials
Raw: Switch. Return raw results instead of translating the fields into a custom PSObject.");
}
sub helpnewdomainuser {
show_message("
Function:
New-DomainUser
Description:
First binds to the specified domain context using Get-PrincipalContext.
The bound domain context is then used to create a new
DirectoryServices.AccountManagement.UserPrincipal with the specified user properties.
Parameters:
SamAccountName: Specifies the Security Account Manager (SAM) account name of the user to create.
AccountPassword: Specifies the password for the created user. Mandatory.
Name: Specifies the name of the user to create. If not provided, defaults to SamAccountName.
DisplayName: Specifies the display name of the user to create. If not provided, defaults to SamAccountName.
Description: Specifies the description of the user to create.
Domain: Specifies the domain to use to search for user/group principals, defaults to the current domain.
Credential: A [Management.Automation.PSCredential] object of alternate credentials");
}
sub helpsetdomainuserpassword {
show_message("
Function:
Set-DomainUserPassword
Description:
First binds to the specified domain context using Get-PrincipalContext.
The bound domain context is then used to search for the specified user -Identity,
which returns a DirectoryServices.AccountManagement.UserPrincipal object. The
SetPassword() function is then invoked on the user, setting the password to -AccountPassword.
Parameters:
Identity: A user SamAccountName (e.g. User1), DistinguishedName (e.g. CN=user1,CN=Users,DC=testlab,DC=local),
AccountPassword: Specifies the password to reset the target user's to. Mandatory.
Domain: Specifies the domain to use to search for the user identity, defaults to the current domain.
Credential: A [Management.Automation.PSCredential] object of alternate credentials");
}
sub helpgetdomainuserevent {
show_message("
Function:
Get-DomainUserEvent
Description:
This function uses an XML path filter passed to Get-WinEvent to retrieve
security events with IDs of 4624 (logon events) or 4648 (explicit credential
logon events) from -StartTime (default of now-1 day) to -EndTime (default of now).
Parameters:
ComputerName: Specifies the computer name to retrieve events from, default of localhost.
StartTime: The [DateTime] object representing the start of when to collect events.
EndTime: The [DateTime] object representing the end of when to collect events.
MaxEvents: The maximum number of events to retrieve. Default of 5000.
Credential: A [Management.Automation.PSCredential] object of alternate credentials");
}
sub helpgetdomaincomputer {
show_message("
Function:
Get-DomainComputer
Description:
Builds a directory searcher object using Get-DomainSearcher, builds a custom
LDAP filter based on targeting/filter parameters, and searches for all objects
matching the criteria. To only return specific properties, use
'-Properties samaccountname,usnchanged,...'. By default, all computer objects for
the current domain are returned.
Parameters:
Identity: A SamAccountName (e.g. WINDOWS10\$), DistinguishedName (e.g. CN=WINDOWS10,CN=Computers,DC=testlab,DC=local),
UACFilter: Dynamic parameter that accepts one or more values from $UACEnum, including
Unconstrained: Switch. Return computer objects that have unconstrained delegation.
TrustedToAuth: Switch. Return computer objects that are trusted to authenticate for other principals.
Printers: Switch. Return only printers.
SPN: Return computers with a specific service principal name, wildcards accepted.
OperatingSystem: Return computers with a specific operating system, wildcards accepted.
ServicePack: Return computers with a specific service pack, wildcards accepted.
SiteName: Return computers in the specific AD Site name, wildcards accepted.
Ping: Switch. Ping each host to ensure it's up before enumerating.
Domain: Specifies the domain to use for the query, defaults to the current domain.
LDAPFilter: Specifies an LDAP query string that is used to filter Active Directory objects.
Properties: Specifies the properties of the output object to retrieve from the server.
SearchBase: The LDAP source to search through, e.g. 'LDAP://OU=secret,DC=testlab,DC=local'
Server: Specifies an Active Directory server (domain controller) to bind to.
SearchScope: Specifies the scope to search under, Base/OneLevel/Subtree (default of Subtree).
ResultPageSize: Specifies the PageSize to set for the LDAP searcher object.
ServerTimeLimit: Specifies the maximum amount of time the server spends searching. Default of 120 seconds.
SecurityMasks: Specifies an option for examining security information of a directory object.
Tombstone: Switch. Specifies that the searcher should also return deleted/tombstoned objects.
FindOne: Only return one result object.
Credential: A [Management.Automation.PSCredential] object of alternate credentials
Raw: Switch. Return raw results instead of translating the fields into a custom PSObject.");
}
sub helpgetdomainobject {
show_message("
Function:
Get-DomainObject
Description:
Builds a directory searcher object using Get-DomainSearcher, builds a custom
LDAP filter based on targeting/filter parameters, and searches for all objects
matching the criteria. To only return specific properties, use
'-Properties samaccountname,usnchanged,...'. By default, all objects for
the current domain are returned.
Parameters:
Identity: A SamAccountName (e.g. harmj0y), DistinguishedName (e.g. CN=harmj0y,CN=Users,DC=testlab,DC=local),
UACFilter: Dynamic parameter that accepts one or more values from $UACEnum, including
Domain: Specifies the domain to use for the query, defaults to the current domain.
LDAPFilter: Specifies an LDAP query string that is used to filter Active Directory objects.
Properties: Specifies the properties of the output object to retrieve from the server.
SearchBase: The LDAP source to search through, e.g. 'LDAP://OU=secret,DC=testlab,DC=local'
Server: Specifies an Active Directory server (domain controller) to bind to.
SearchScope: Specifies the scope to search under, Base/OneLevel/Subtree (default of Subtree).
ResultPageSize: Specifies the PageSize to set for the LDAP searcher object.
ServerTimeLimit: Specifies the maximum amount of time the server spends searching. Default of 120 seconds.
SecurityMasks: Specifies an option for examining security information of a directory object.
Tombstone: Switch. Specifies that the searcher should also return deleted/tombstoned objects.
FindOne: Only return one result object.
Credential: A [Management.Automation.PSCredential] object of alternate credentials
Raw: Switch. Return raw results instead of translating the fields into a custom PSObject.");
}
sub helpsetdomainobject {
show_message("
Function:
Set-DomainObject
Description:
Splats user/object targeting parameters to Get-DomainObject, returning the raw
searchresult object. Retrieves the raw directoryentry for the object, and sets
any values from -Set @{}, XORs any values from -XOR @{}, and clears any values