Генерация пароля: различия между версиями

Материал из WIKI vinote
Перейти к навигации Перейти к поиску
Новая страница: «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 } }...»
 
мНет описания правки
 
(не показана 1 промежуточная версия этого же участника)
Строка 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
Строка 8: Строка 8:
-and ($newPassword -match '[A-Z]') `
-and ($newPassword -match '[A-Z]') `
-and ($newPassword -match '[1-9]') `
-and ($newPassword -match '[1-9]') `
-and ($newPassword -match '[!@#$%\^&*]') `
-and ($newPassword -notmatch '[0oO\{\}\(\)\;\:\\\/\*\+\<\>l\^_\?\[\]\|\.\-\=]')  
-and ($newPassword -notmatch '[0oO\{\}\(\)\;\:\\\/\*\+\<\>l\^_\?\[\]\|\.\-\=]')  
)
)
Строка 16: Строка 17:
return $newPassword
return $newPassword
}
}
Generate-Complex-Domain-Password (16)
Generate-Complex-Domain-Password (16)</pre>
[[Category:Powershell]]

Текущая версия от 09:52, 13 мая 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 -match '[!@#$%\^&*]') `
-and ($newPassword -notmatch '[0oO\{\}\(\)\;\:\\\/\*\+\<\>l\^_\?\[\]\|\.\-\=]') 
)
{
$requirementsPassed=$True
}
} While ($requirementsPassed -eq $false)
return $newPassword
}
Generate-Complex-Domain-Password (16)