mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-21 07:10:15 -05:00
23 lines
573 B
PowerShell
23 lines
573 B
PowerShell
function Get-IcingaRandomChars()
|
|
{
|
|
param (
|
|
[int]$Count = 10,
|
|
[string]$Symbols = 'abcdefghiklmnoprstuvwxyzABCDEFGHKLMNOPRSTUVWXYZ1234567890!§$%&/()=?}][{@#*+'
|
|
);
|
|
|
|
$RandomChars = '';
|
|
|
|
if ([string]::IsNullOrEmpty($Symbols)) {
|
|
return $RandomChars;
|
|
}
|
|
|
|
while ($Count -gt 0) {
|
|
|
|
[int]$SymbolLength = $Symbols.Length;
|
|
$RandomValue = Get-Random -Minimum 0 -Maximum ($SymbolLength - 1);
|
|
$RandomChars += $Symbols[$RandomValue];
|
|
$Count -= 1;
|
|
}
|
|
|
|
return $RandomChars;
|
|
}
|