added new scripts
This commit is contained in:
2
Active directory/New-admins-exempel.csv
Normal file
2
Active directory/New-admins-exempel.csv
Normal file
@@ -0,0 +1,2 @@
|
||||
name,
|
||||
firstname lastname
|
||||
|
19
Active directory/servicedesk-accounts.ps1
Normal file
19
Active directory/servicedesk-accounts.ps1
Normal file
@@ -0,0 +1,19 @@
|
||||
Import-Module ActiveDirectory
|
||||
|
||||
$AdminUsers = Import-Csv -Path "C:\Temp\New-admins.csv" -Encoding UTF8 -delimiter ","
|
||||
|
||||
$AdminUPNAddress = "upnadress"
|
||||
$UsernamePrefix = "suffix"
|
||||
$AdminOU = "oupath"
|
||||
|
||||
foreach ($Adminuser in $AdminUsers)
|
||||
{
|
||||
$AdminFistname,$AdminLastname = ($Adminuser.name).Split(" ")
|
||||
$AdminUsernamePart = $AdminFistname.substring(0,2)+$AdminLastname.substring(0,2)
|
||||
#$AdminDisplayName = $AdminFistname $AdminLastname
|
||||
$AdminUsername = "$UsernamePrefix.$AdminUsernamePart"
|
||||
New-ADUser -DisplayName "ADM - $AdminFistname $AdminLastname" -Name "ADM - $AdminFistname $AdminLastname" -GivenName "$AdminFistname" -Surname "$AdminLastname" -SamAccountName "$AdminUsername" -UserPrincipalName "$AdminUsername@$AdminUPNAddress" -Path "$AdminOU" -AccountPassword(ConvertTo-SecureString "2de!9F&y$!xCUvbB" -AsPlainText -force) -Enabled $true -Description "autocreated account"
|
||||
Add-ADGroupMember -Identity "Tietoevry-Servicedesk" -Members $AdminUsername
|
||||
|
||||
Write-Output "ADM - $AdminFistname $AdminLastname - $AdminUsername";
|
||||
}
|
||||
Reference in New Issue
Block a user