Enrich professor profiles and harden client policy
This commit is contained in:
@@ -20,6 +20,23 @@ $remoteDesktopUsersSid = [Security.Principal.SecurityIdentifier]::new('S-1-5-32-
|
||||
$remoteDesktopUsersGroup = ($remoteDesktopUsersSid.Translate([Security.Principal.NTAccount]).Value -split '\\', 2)[1]
|
||||
|
||||
if ($PSCmdlet.ShouldProcess($env:COMPUTERNAME, "Enable RDP and grant $RemoteDesktopPrincipal access")) {
|
||||
foreach ($powerChange in @(
|
||||
@('monitor-timeout-ac', '0'),
|
||||
@('monitor-timeout-dc', '0'),
|
||||
@('standby-timeout-ac', '0'),
|
||||
@('standby-timeout-dc', '0'),
|
||||
@('hibernate-timeout-ac', '0'),
|
||||
@('hibernate-timeout-dc', '0'))) {
|
||||
& powercfg.exe /change $powerChange[0] $powerChange[1]
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "powercfg /change $($powerChange[0]) failed with exit code $LASTEXITCODE."
|
||||
}
|
||||
}
|
||||
& powercfg.exe /hibernate off
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "powercfg /hibernate off failed with exit code $LASTEXITCODE."
|
||||
}
|
||||
|
||||
Set-ItemProperty -LiteralPath 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server' `
|
||||
-Name fDenyTSConnections -Type DWord -Value 0
|
||||
Set-ItemProperty -LiteralPath 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' `
|
||||
@@ -87,4 +104,5 @@ $rdpMembers = @(Get-LocalGroupMember -Group $remoteDesktopUsersGroup -ErrorActio
|
||||
TermService = (Get-Service TermService).Status
|
||||
WinRM = (Get-Service WinRM).Status
|
||||
FirewallProfile = 'Domain'
|
||||
AlwaysOnPowerPolicyApplied = $true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user