$SID = (Get-LocalUser -Name "Студент").SID.Value
$RegPathRestrict = "Registry::HKEY_USERS\$SID\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\RestrictRun"
$CurrentApps = Get-ItemProperty -Path $RegPathRestrict -ErrorAction SilentlyContinue
$NextIndex = 1
if ($CurrentApps) {
$Indices = $CurrentApps.PSObject.Properties | Where-Object { $_.Name -match '^\d+$' } | ForEach-Object { [int]$_.Name }
if ($Indices) { $NextIndex = ($Indices | Measure-Object -Maximum).Maximum + 1 }
}
Set-ItemProperty -Path $RegPathRestrict -Name ([string]$NextIndex) -Value "python-setup.exe" -Type String -Force
Write-Host "Файл python-setup.exe успешно добавлен в Белый список реестра!" -ForegroundColor Green