I've already seen the other thread, but that was a little bit confusing for me.
So my script looks like this:
#Users and Groups Import-Module ActiveDirectory $csvfile = Join-Path(Split-Path $MyInvocation.MyCommand.Path) "ADUsers.csv" $csv = Import-Csv "$csvfile" -Delim ';' New-ADOrganizationalUnit -Name SWDTest -Path "DC=swisscomswd, DC=local" -ProtectedFromAccidentalDeletion $false New-ADOrganizationalUnit -Name Users -Path "OU=SWDTest, DC=swisscomswd, DC=local" -ProtectedFromAccidentalDeletion $false New-ADOrganizationalUnit -Name ServiceAccounts -Path "OU=SWDTest, DC=swisscomswd, DC=local" -ProtectedFromAccidentalDeletion $false Foreach ($line in $csv) { $pw = ConvertTo-SecureString -AsPlainText -Force -String $line.Passwort $pwsecure = ` [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($pw) $HiddenPW = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($pwsecure) New-ADUser -Name $line.LastName -Surname $line.FirstName -DisplayName "$line.Display Text" -AccountPassword $line.HiddenPW -Description $line.Description -SamAccountName $line.AccountID -Path "OU=$($line.OE), DC=swisscmswd, DC=local" } Write-Host -Fore Green "ADDS installed!"
And my csv looks like this:
I still get the error (written in title). Anyone knows why? The message appears as many times, as it has users.
The following is my signature:
Powershell Programmer & Advanced Lua Programmer
Location: Switzerland
Beside that, whenever you see a reply, you think is helpful, click "Vote As Helpful"! And
whenever you see a reply being an answer to the mainquestion of the thread, click "
Mark As Answer"
(if you opened the thread).
Please contact me, before reporting me, thank you.
[string](0..21|%{[char][int]([int]("{0:d}" -f 0x28)+('577076797174-87661607769657424-8687168065964').substring(($_*2),2))})-replace' '