forked from achawla5/PSScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScreenCaptureProtection.ps1
More file actions
37 lines (28 loc) · 1.27 KB
/
ScreenCaptureProtection.ps1
File metadata and controls
37 lines (28 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<#Author : Akash Chawla
# Usage : Screen capture protection
#>
#######################################
# Screen capture protection #
#######################################
$stopwatch = [System.Diagnostics.Stopwatch]::StartNew()
Write-Host '*** AVD AIB CUSTOMIZER PHASE: Screen capture protection ***'
$screenCaptureRegistryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services"
$screenCaptureRegistryName = "fEnableScreenCaptureProtection"
$screenCaptureRegistryValue = "1"
IF(!(Test-Path $screenCaptureRegistryPath)) {
New-Item -Path $screenCaptureRegistryPath -Force | Out-Null
}
try {
New-ItemProperty -Path $screenCaptureRegistryPath -Name $screenCaptureRegistryName -Value $screenCaptureRegistryValue -PropertyType DWORD -Force | Out-Null
}
catch {
Write-Host "*** AVD AIB CUSTOMIZER PHASE: Screen capture protection - Cannot add the registry key *** : [$($_.Exception.Message)]"
Write-Host "Message: [$($_.Exception.Message)"]
}
$stopwatch.Stop()
$elapsedTime = $stopwatch.Elapsed
Write-Host "*** AVD AIB CUSTOMIZER PHASE: Screen capture protection - Exit Code: $LASTEXITCODE ***"
Write-Host "*** AVD AIB CUSTOMIZER PHASE: Screen capture protection - Time taken: $elapsedTime ***"
#############
# END #
#############