This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
powershell [2023/02/27 09:49] val |
powershell [2025/10/13 13:18] (current) val |
||
---|---|---|---|
Line 29: | Line 29: | ||
* [[https://www.alitajran.com/create-active-directory-users-from-csv-with-powershell/|Create Active Directory Users from CSV with PowerShell]] | * [[https://www.alitajran.com/create-active-directory-users-from-csv-with-powershell/|Create Active Directory Users from CSV with PowerShell]] | ||
<code> | <code> | ||
- | PS C:\> notepad C:\temp\NewUsersFinal.csv !!!UTF-8 | + | PS C:\> notepad C:\NewUsersFinal.csv !!!UTF-8 |
</code><code> | </code><code> | ||
FirstName;Initials;Lastname;Username;Email;Password;Telephone | FirstName;Initials;Lastname;Username;Email;Password;Telephone | ||
- | Ivan;I;Ivanov;user1;user1@corp13.un;Pa$$w0rd1;401 | ||
Petr;P;Petrov;user2;user2@corp13.un;Pa$$w0rd2;402 | Petr;P;Petrov;user2;user2@corp13.un;Pa$$w0rd2;402 | ||
Сидор;С;Сидоров;user3;user3@corp13.un;Pa$$w0rd3;403 | Сидор;С;Сидоров;user3;user3@corp13.un;Pa$$w0rd3;403 | ||
</code><code> | </code><code> | ||
- | PS C:\> notepad C:\Scripts\Add-NewUsers.ps1 | + | PS C:\> notepad C:\Add-NewUsers.ps1 |
</code><code> | </code><code> | ||
Import-Module ActiveDirectory | Import-Module ActiveDirectory | ||
| | ||
- | $ADUsers = Import-Csv C:\temp\NewUsersFinal.csv -Delimiter ";" | + | $ADUsers = Import-Csv C:\NewUsersFinal.csv -Delimiter ";" |
foreach ($User in $ADUsers) { | foreach ($User in $ADUsers) { | ||
Line 67: | Line 66: | ||
} | } | ||
</code><code> | </code><code> | ||
- | PS C:\> C:\Scripts\Add-NewUsers.ps1 | + | PS C:\> C:\Add-NewUsers.ps1 |
</code> | </code> | ||
Line 95: | Line 94: | ||
</code> | </code> | ||
+ | ===== Создание Kerberos Principal ===== | ||
+ | <code> | ||
+ | $x = Read-Host -Prompt "Ваш X"; New-ADUser -Name "gatehttp" -SamAccountName "gatehttp" -AccountPassword(ConvertTo-SecureString -AsPlainText 'Pa$$w0rd' -Force) -Enabled $true -ChangePasswordAtLogon $false -CannotChangePassword $true -UserPrincipalName gatehttp@corp$X.un -DisplayName gatehttp -PasswordNeverExpires $true | ||
+ | </code> |