Генерация пароля: различия между версиями
Перейти к навигации
Перейти к поиску
Onix (обсуждение | вклад) Новая страница: «Function Generate-Complex-Domain-Password ([Parameter(Mandatory=$true)][int]$PassLenght) { Add-Type -AssemblyName System.Web $requirementsPassed = $false do { $newPassword=[System.Web.Security.Membership]::GeneratePassword($PassLenght,1) If (($newPassword -match '[a-z]') ` -and ($newPassword -match '[A-Z]') ` -and ($newPassword -match '[1-9]') ` -and ($newPassword -notmatch '[0oO\{\}\(\)\;\:\\\/\*\+\<\>l\^_\?\[\]\|\.\-\=]') ) { $requirementsPassed=$True } }...» |
Onix (обсуждение | вклад) мНет описания правки |
||
| Строка 1: | Строка 1: | ||
Function Generate-Complex-Domain-Password ([Parameter(Mandatory=$true)][int]$PassLenght) | <pre>Function Generate-Complex-Domain-Password ([Parameter(Mandatory=$true)][int]$PassLenght) | ||
{ | { | ||
Add-Type -AssemblyName System.Web | Add-Type -AssemblyName System.Web | ||
| Строка 16: | Строка 16: | ||
return $newPassword | return $newPassword | ||
} | } | ||
Generate-Complex-Domain-Password (16) | Generate-Complex-Domain-Password (16)</pre> | ||
[[Category:Powershell]] | |||
Версия от 11:39, 5 мая 2025
Function Generate-Complex-Domain-Password ([Parameter(Mandatory=$true)][int]$PassLenght)
{
Add-Type -AssemblyName System.Web
$requirementsPassed = $false
do {
$newPassword=[System.Web.Security.Membership]::GeneratePassword($PassLenght,1)
If (($newPassword -match '[a-z]') `
-and ($newPassword -match '[A-Z]') `
-and ($newPassword -match '[1-9]') `
-and ($newPassword -notmatch '[0oO\{\}\(\)\;\:\\\/\*\+\<\>l\^_\?\[\]\|\.\-\=]')
)
{
$requirementsPassed=$True
}
} While ($requirementsPassed -eq $false)
return $newPassword
}
Generate-Complex-Domain-Password (16)