Delegieren von Rechten der MDT-Dienstkonten
Set-OUPermissions
Standardmäßig kann jeder Benutzer zehn Computer zur Domäne hinzufügen. Dabei wird automatisch im Container Computers
ein Computerkonto erstellt. Soll ein Benutzer mehr als diese zehn Computer zur Domäne hinzufügen, dann benötigt er entweder die Rechte eines Domänen-Admins oder ihm muss die entsprechende Objektverwaltung delegiert worden sein. (Quelle: W2019AVN, S.111)
Damit das Benutzerkonto MDT_JD
die Berechtigungen zur Erstellung von Computerkonten (ohne Einschränkung der maximalen Anzahl von 10 Computerkonten) erhält, kann mit dem kostenlosen PowerShell-Skript Set-OUPermissions.ps1
diese Einschränkung aufgehoben werden.
Dazu muss das PowerShell-Script auf DC01
kopiert und dort mit den richtigen Parametern ausgeführt werden. Stellen Sie außerdem sicher, dass PowerShell-Skripte am Domänen-Controller ausgeführt werden dürfen (Set-ExecutionPolicy
). Dies können Sie in einer privilegierten PowerShell-Sitzung umstellen:
Set-ExecutionPolicy -ExecutionPolicy Bypass -Force
cd C:\Scripts # In das richtige Verzeichnis wechseln
.\Set-OUPermissions.ps1 -Account MDT_JD -TargetOU "CN=Computers"
Alternativ kann natürlich auch jede beliebige Organisationseinheit als TargetOU
gewählt werden, z.B. "OU=Clients,OU=Computer,OU=Hauptquartier,OU=Wien,OU=Contoso"
oder "OU=Arbeitsstationen,OU=Computer,OU=Contoso"
.
Das Script Set-OUPermissions.ps1
ist leider nicht mehr aus der Originalquelle verfügbar. Sie können es aber vom Moodle-Kurs herunterladen oder von unterhalb kopieren und als PowerShell-Script (Dateiendung .ps1
) abspeichern:
<#
Created: 2016-04-06
Version: 1.1
Author Mikael Nystrom and Johan Arwidmark
Homepage: http://deploymentartist.com
Disclaimer:
This script is provided "AS IS" with no warranties, confers no rights and
is not supported by the authors or DeploymentArtist.
Author - Mikael Nystrom
Twitter: @mikael_nystrom
Blog : http://deploymentbunny.com
Author - Johan Arwidmark
Twitter: @jarwidmark
Blog : http://deploymentresearch.com
#>
Param
(
[parameter(mandatory=$true,HelpMessage="Please, provide the account name.")][ValidateNotNullOrEmpty()]$Account,
[parameter(mandatory=$true,HelpMessage="Please, provide the target OU.")][ValidateNotNullOrEmpty()]$TargetOU
)
# Start logging to screen
Write-host (get-date -Format u)" - Starting"
# This i what we typed in
Write-host "Account to search for is" $Account
Write-Host "OU to search for is" $TargetOU
if ($TargetOU -like '*dc=*')
{
Write-Warning "Oupps, only specify the OU path. We get the domain for you..."
Break
}
$CurrentDomain = Get-ADDomain
$OrganizationalUnitDN = $TargetOU+","+$CurrentDomain
$SearchAccount = Get-ADUser $Account
$SAM = $SearchAccount.SamAccountName
$UserAccount = $CurrentDomain.NetBIOSName+"\"+$SAM
Write-Host "Account is = $UserAccount"
Write-host "OU is =" $OrganizationalUnitDN
dsacls.exe $OrganizationalUnitDN /G $UserAccount":CCDC;Computer" /I:T | Out-Null
dsacls.exe $OrganizationalUnitDN /G $UserAccount":LC;;Computer" /I:S | Out-Null
dsacls.exe $OrganizationalUnitDN /G $UserAccount":RC;;Computer" /I:S | Out-Null
dsacls.exe $OrganizationalUnitDN /G $UserAccount":WD;;Computer" /I:S | Out-Null
dsacls.exe $OrganizationalUnitDN /G $UserAccount":WP;;Computer" /I:S | Out-Null
dsacls.exe $OrganizationalUnitDN /G $UserAccount":RP;;Computer" /I:S | Out-Null
dsacls.exe $OrganizationalUnitDN /G $UserAccount":CA;Reset Password;Computer" /I:S | Out-Null
dsacls.exe $OrganizationalUnitDN /G $UserAccount":CA;Change Password;Computer" /I:S | Out-Null
dsacls.exe $OrganizationalUnitDN /G $UserAccount":WS;Validated write to service principal name;Computer" /I:S | Out-Null
dsacls.exe $OrganizationalUnitDN /G $UserAccount":WS;Validated write to DNS host name;Computer" /I:S | Out-Null
dsacls.exe $OrganizationalUnitDN
Last updated
Was this helpful?