Merge pull request #11 from hajdbo/patch-1

added ErrorAction SilentlyContinue to Get-ChildItem
This commit is contained in:
Matt Graeber
2013-08-17 17:04:15 -07:00
+2 -2
View File
@@ -64,8 +64,8 @@
if (((Get-WmiObject Win32_ComputerSystem).partofdomain) -eq $False) {throw 'Machine is not joined to a domain.'}
if (($Env:USERDNSDOMAIN) -eq $Null) {throw 'Account is not a domain account.'}
#discover potential files containing passwords
$XMlFiles = Get-ChildItem -Path "\\$Env:USERDNSDOMAIN\SYSVOL" -Recurse -Include 'groups.xml','services.xml','scheduledtasks.xml','datasources.xml'
#discover potential files containing passwords ; not complaining in case of denied access to a directory
$XMlFiles = Get-ChildItem -Path "\\$Env:USERDNSDOMAIN\SYSVOL" -Recurse -ErrorAction SilentlyContinue -Include 'groups.xml','services.xml','scheduledtasks.xml','datasources.xml'
foreach ($File in $XMLFiles) {