MichaelGrafnetter / DSInternals

Directory Services Internals (DSInternals) PowerShell Module and Framework
https://www.dsinternals.com
MIT License
1.65k stars 254 forks source link

Not working afte update DSInternal #80

Closed pogreb closed 5 years ago

pogreb commented 5 years ago

Hi! This script work is OK on DSInternal 2.5 $DictFile = "C:\DSInternals\password2.txt" $DC = "ll.local" $Domain = "DC=ll, DC=local" $Dict = Get-Content $DictFile | ConvertTo-NTHashDictionary Get-ADReplAccount -All -Server $DC -NamingContext $Domain | Test-PasswordQuality -WeakPasswordHashes $Dict -ShowPlainTextPasswords -IncludeDisabledAccounts $EWB.Saveas('C:\password.txt') After update DSInternal to 3.2 my script not working I run script $Dict = Get-Content $DictFile $DictFile = C:\DSInternals\PasswordDict1.txt Get-ADReplAccount -All -Server $DC -NamingContext $Domain | Test-PasswordQuality -WeakPasswords $Dict -ShowPlainTextPasswords -IncludeDisabledAccounts

No Error, no results, no end work script Please help me repare work my script/ Thank you!

MichaelGrafnetter commented 5 years ago

Hi @pogreb , the -ShowPlainTextPasswords parameter of Test-PasswordQuality cmdlet had been removed in version 3.0 due to some performance optimizations, see the Changelog. Does the Get-ADReplAccount cmdlet give you any results? Could you please just try running this?

$Dict = Get-Content 'C:\DSInternals\PasswordDict1.txt'
Get-ADReplAccount -All -Server $DC -NamingContext $Domain | Test-PasswordQuality -WeakPasswords $Dict
pogreb commented 5 years ago

Hi Michael! Thanks for the answer. I'm use DSInternals version 3.3 I changed your request and ran $DC = "mall-s-dc5" $Domain = "DC=mall, DC=local" $Dict = Get-Content 'C:\DSInternals\PasswordDict1.txt' Get-ADReplAccount -All -Server $DC -NamingContext $Domain | Test-PasswordQuality -WeakPasswordsHashes $Dict In response, again an error on the parameter "WeakPasswords" I could not find the parameter -WeakPasswords and write -WeakPasswordsHashes Got an error Origina Test-PasswordQuality : Не удается привязать параметр "WeakPasswordHashes". Не удается преобразовать значение "ZZZZZZZZZZZZZZZZZZZZ" типа "System.String" в тип "System.Collections.Generic.IDi ctionary2[System.Byte[],System.String]". строка:4 знак:102

"ZZZZZZZZZZZZZZZZZZZZ" - This is the only password in the file C:\DSInternals\PasswordDict1.txt

Big thanks for the help.

MichaelGrafnetter commented 5 years ago

The error you are describing is still from 2.5. Please make sure that you deleted the old version of the module and that you are using 3.3 exclusively.

pogreb commented 5 years ago

current version powershell 4.0. Do I need to upgrade powershell to 5 version? Thanks

MichaelGrafnetter commented 5 years ago

I meant DSInternals version, not PowerShell version.

pogreb commented 5 years ago

Hi, Michael! I'm run get-module -listAvailable Script 3.3 DSInternals {ConvertTo-NTHash, ConvertTo-LMHash, Set-SamAccountPasswordHash, ConvertFrom-UnicodePassword...}

After i'm run $DC = "mall-s-dc5" $Domain = "DC=mall,DC=local" $Dict = Get-Content 'C:\DSInternals\PasswordDict1.txt' Get-ADReplAccount -All -Server $DC -NamingContext $Domain | Test-PasswordQuality -WeakPasswordsHashes $Dict

Error original `строка:1 знак:20

Error translate `line: 1 character: 20

MichaelGrafnetter commented 5 years ago

You either need to only use a single command per line or separate them with a semicolon ; But that is basic PowerShell syntax stuff and has nothing to do with DSInternals.

pogreb commented 5 years ago

Hi! Michael, I run script $DC = "mall-s-dc5"; $Domain = "DC=mall, DC=local"; $Dict = Get-Content 'C:\DSInternals\PasswordDict1.txt'; Get-ADReplAccount -All -Server $DC -NamingContext $Domain | Test-PasswordQuality -WeakPasswords $Dict

But the execution of the script freezes. If you leave only one password in the dictionary, the script works. Password file size 21mb

MichaelGrafnetter commented 5 years ago

For how long does it freeze? Did you give it some time, like at least 10 minutes? Passing such huge arrays of strings is never a good idea in PowerShell.

Why don't you do the following instead of using Get-Content?

$DC = "mall-s-dc5"
$Domain = "DC=mall, DC=local"
$Dict = 'C:\DSInternals\PasswordDict1.txt'
Get-ADReplAccount -All -Server $DC -NamingContext $Domain |
       Test-PasswordQuality -WeakPasswordsFile $Dict
pogreb commented 5 years ago

Thank you very much, everything works fine. But, in version 2.6. showed with what password from the dictionary there is a coincidence, now there is no

MichaelGrafnetter commented 5 years ago

As already said, the -ShowPlainTextPasswords parameter of the Test-PasswordQuality cmdlet had been removed in version 3.0 due to some performance optimizations. It might come back in one of the future versions.

pogreb commented 5 years ago

Michael, big thanks! Nice day!!!