scripts/powershell/create_users_csv.ps1 aktualisiert
Inserted default OU
This commit is contained in:
parent
15e1be8db1
commit
02766e1bf9
@ -19,6 +19,8 @@ $delimiter = [string]$meta.delimiter
|
|||||||
if ([string]::IsNullOrWhiteSpace($delimiter)) { $delimiter = ',' }
|
if ([string]::IsNullOrWhiteSpace($delimiter)) { $delimiter = ',' }
|
||||||
$hasHeader = [bool]($meta.has_header -as [bool])
|
$hasHeader = [bool]($meta.has_header -as [bool])
|
||||||
$dryRun = [bool]($meta.dry_run -as [bool])
|
$dryRun = [bool]($meta.dry_run -as [bool])
|
||||||
|
$defaultOu = [string]$meta.default_ou
|
||||||
|
|
||||||
|
|
||||||
if (-not (Test-Path -Path $csvFile)) {
|
if (-not (Test-Path -Path $csvFile)) {
|
||||||
Write-Output (@{ success = $false; message = "CSV file not found: $csvFile" } | ConvertTo-Json -Compress)
|
Write-Output (@{ success = $false; message = "CSV file not found: $csvFile" } | ConvertTo-Json -Compress)
|
||||||
@ -60,6 +62,11 @@ foreach ($row in $items) {
|
|||||||
$ou = $row.ou
|
$ou = $row.ou
|
||||||
$groups = $row.groups
|
$groups = $row.groups
|
||||||
|
|
||||||
|
if ([string]::IsNullOrWhiteSpace($ou) -and -not [string]::IsNullOrWhiteSpace($defaultOu)) {
|
||||||
|
$ou = $defaultOu
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if ([string]::IsNullOrWhiteSpace($sam) -or [string]::IsNullOrWhiteSpace($pass)) {
|
if ([string]::IsNullOrWhiteSpace($sam) -or [string]::IsNullOrWhiteSpace($pass)) {
|
||||||
$results += @{ sam = $sam; success = $false; message = 'Missing samaccountname or password' }
|
$results += @{ sam = $sam; success = $false; message = 'Missing samaccountname or password' }
|
||||||
$failCount++
|
$failCount++
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user