Fixing issues 228, 252, 255
This commit is contained in:
29
Vagrant/scripts/configure-rdp-user-gpo.ps1
Normal file
29
Vagrant/scripts/configure-rdp-user-gpo.ps1
Normal file
@@ -0,0 +1,29 @@
|
||||
# Purpose: Install the GPO that allows windomain\vagrant to RDP
|
||||
Write-Host "Importing the GPO to allow windomain/vagrant to RDP..."
|
||||
Import-GPO -BackupGpoName 'Allow Domain Users RDP' -Path "c:\vagrant\resources\GPO\rdp_users" -TargetName 'Allow Domain Users RDP' -CreateIfNeeded
|
||||
|
||||
$OU = "ou=Workstations,dc=windomain,dc=local"
|
||||
$gPLinks = $null
|
||||
$gPLinks = Get-ADOrganizationalUnit -Identity $OU -Properties name,distinguishedName, gPLink, gPOptions
|
||||
$GPO = Get-GPO -Name 'Allow Domain Users RDP'
|
||||
If ($gPLinks.LinkedGroupPolicyObjects -notcontains $gpo.path)
|
||||
{
|
||||
New-GPLink -Name 'Allow Domain Users RDP' -Target $OU -Enforced yes
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Host "Allow Domain Users RDP GPO was already linked at $OU. Moving On."
|
||||
}
|
||||
$OU = "ou=Servers,dc=windomain,dc=local"
|
||||
$gPLinks = $null
|
||||
$gPLinks = Get-ADOrganizationalUnit -Identity $OU -Properties name,distinguishedName, gPLink, gPOptions
|
||||
$GPO = Get-GPO -Name 'Allow Domain Users RDP'
|
||||
If ($gPLinks.LinkedGroupPolicyObjects -notcontains $gpo.path)
|
||||
{
|
||||
New-GPLink -Name 'Allow Domain Users RDP' -Target $OU -Enforced yes
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Host "Allow Domain Users RDP GPO was already linked at $OU. Moving On."
|
||||
}
|
||||
gpupdate /force
|
||||
Reference in New Issue
Block a user